Oracle statements with question marks

Hi Nathan,

   It’s been a while since my last question :).

   But first of all I would like to let you know that we are using liquibase with very good results so far. So thanks a lot for all the effort you put in this tool.

   Now here comes the question… I found something that is happening when you have ? in your statements, not always but in some cases they are replaced by :1, :2 and so on.

   I my case we found this from a comment we have in a stored procedure (of course a comment is not that bad, but it could happen with real code):

    --        ?PARAMETER.OBJECT_NAME? AS custom_field_4, --        ?PARAMETER.PARAM_NAME?  AS custom_field_5,

   So I modified a bit this (for testing purposes only):

           class ExecuteStatementCallback implements StatementCallback {            public Object doInStatement(Statement stmt) throws SQLException, DatabaseException {                for (String statement : applyVisitors(sql, sqlVisitors)) {                    if (database instanceof OracleDatabase) {                        statement = statement.replaceFirst("/\\s*/\\s*$", ""); //remove duplicated /'s                    }

                       log.debug("Executing EXECUTE database command: "+statement);
                       stmt.execute(statement);
                   }
                   return null;
               }

               public SqlStatement getStatement() {
                   return sql;
               }
           }

and I added this stmt.setEscapeProcessing(false); right before the execute call. And it is working.

I’m not going to change this at this moment because we found a workaround.

Do you think this should be added to liquibase to avoid this kind of issues? I don’t know if someone is putting jdbc escape sequences in their sql code either.

Ref: http://stackoverflow.com/questions/3862585/jdbc-statement-setescapeprocessingfalse

Thanks a lot,
Alexis.

I think that is a good idea to include.  It should reduce overhead and issues like you saw, and since we don’t support ?'s in statements it shouldn’t be needed.

I added it to trunk for 2.0

Thanks for the heads up, and I’m glad liquibase is working well for you.

Nathan