Does the JDBC spec prevent '?' from being used as an operator (outside of quotes)?

前端 未结 3 1058
生来不讨喜
生来不讨喜 2020-11-29 11:01

From Sam Macbeth\'s question:

Is there anything in the JDBC spec which allows a ? to be escaped and be anything other than a parameter placeholder?

3条回答
  •  青春惊慌失措
    2020-11-29 11:45

    If you have the latest postgresql driver you can use:

    ??
    

    Changing the original query:

    SELECT * FROM tbl WHERE tbl.data ?? 'abc'
    

    Details are in this pull request - https://github.com/pgjdbc/pgjdbc/pull/227 This change was made long after the original question, but it's worth noting that there's an easy answer now.

提交回复
热议问题