def testConvertDirtyQueryToPstmt(self): """ Make sure we can convert some raw SQL into a prepared statement even if it contains some regex borking chars. """ query = "select dollars from dual where 1 = 1 and x = 1.0 and r = '$500.00' " values = JSONArray() nQuery = QueryExecutor.convertQueryToPstmt(query, values) assert(nQuery == "select dollars from dual where ? = ? and x = ? and r = ? ") assert(values.toString() == '["1","1","1.0","\\\$500.00"]')
def testConvertQueryToPstmt(self): """ Make sure we can convert some raw SQL into a prepared statement """ query = "select sysdate from dual where 1 = 1 and x = 1.0 and r = 'test' " values = JSONArray() nQuery = QueryExecutor.convertQueryToPstmt(query, values) assert(nQuery == "select sysdate from dual where ? = ? and x = ? and r = ? ") assert(values.toString() == '["1","1","1.0","test"]')