Skip to content

Commit

Permalink
Replace question marks only in PreparedStatements
Browse files Browse the repository at this point in the history
Question marks in the query text should be replaced with positional
parameters ($1, $2, ...) only in java.sql.PreparedStatement.
In a java.sql.Statement they should be left alone.
  • Loading branch information
Laurenz Albe committed Nov 18, 2015
1 parent fad7f52 commit 3d30a4c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions org/postgresql/core/Parser.java
Expand Up @@ -83,6 +83,9 @@ public static List<NativeQuery> parseJdbcSql(String query, boolean standardConfo
break;

case '?':
if (!withParameters)
break;

nativeSql.append(aChars, fragmentStart, i - fragmentStart);
if (i + 1 < aChars.length && aChars[i + 1] == '?') /* replace ?? with ? */
{
Expand Down

0 comments on commit 3d30a4c

Please sign in to comment.