cancel
Showing results for 
Search instead for 
Did you mean: 

Using hexadecimal escapes in parameterized query

Former Member
3,136

I can't get a result set when using hexadecimal escapes in a parameterized query versus a straight SQL query.

Examples from log (so you can see what the server is seeing):

Without a parameter (results returned as expected):

+2,<,289,PREPARE,SELECT PROD_CODE FROM PRODUCTS WHERE INFO = 't\\x00e\\x00c\\x00h'

Using a parameter, apparently identical to hard-coded value above (no results returned):

=,<,289,PREPARE,SELECT PROD_CODE FROM PRODUCTS WHERE INFO = ?  
+1,H,289,0,varchar,'t\\x00e\\x00c\\x00h'

Is it not possible to do this using parameters?

Fyi, the reason behind this approach is to find some data stored as Unicode inside a long varchar field.

Using SQL Anywhere 12.0.1.3994, Delphi XE

Update: Code Example (Object Pascal)

qryNoParams.SQL.Text := 'SELECT PROD_CODE FROM PRODUCTS WHERE INFO = ' + QuotedStr('t\\x00e\\x00c\\x00h');
qryNoParams.Open; {expected result set returned}

qryParams.SQL.Text := 'SELECT PROD_CODE FROM PRODUCTS WHERE INFO = :INFO';
qryParams.ParamByName('INFO').AsString := 't\\x00e\\x00c\\x00h';
qryParams.Open;  {no result set}

Accepted Solutions (0)

Answers (0)