On Donnerstag, 7. Juni 2007, Papadopoulos Georgios wrote:
Hello all,
I am using
modparam("unixodbc", "use_escape_common", 1)
and the result is that if I have a string like he'llo (single quote
between the e and l), it becomes he\'llo which is not working in sql.
The result should be he''llo (two single quotes between e and l). The
reason is that unixodbc uses the core function escape_common(). I think
that unixodbc whould have two parameters like
modparam("unixodbc", "use_escape_character", "'")
modparam("unixodbc", "escaped_characters", "'\%^")
use_escape_character would be null by default and if it is not null it
would be the character to use for escaping.
escaped_characters would be a list of characters that should be escaped
by the character defined above.
I have patched unixodbc to use its own escape function instead, but it
would be nice if this was a configurable option that others could use. I
could try to implement this if there is an interest. Please let me know
your thoughts.
Hello George,
sorry for the late reply. Yes, improvements of the unixodbc escape functions
would be nice. Do you add another function for escaping to unixodbc, or do
you use some provided functions from the odbc driver?
In the past we had the problem that different odbc drivers need different
escape signs. So the mechanism you suggested above (have options for the
escaping) would provide a solution for this problem.
Cheers,
Henning