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.
thank you
George
Disclaimer The information in this e-mail and any attachments is confidential. It is intended solely for the attention and use of the named addressee(s). If you are not the intended recipient, or person responsible for delivering this information to the intended recipient, please notify the sender immediately. Unless you are the intended recipient or his/her representative you are not authorized to, and must not, read, copy, distribute, use or retain this message or any part of it. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
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