Subject Re: [firebird-support] Firebird equivalent to MySql escape string?
Author Martijn Tonies
> > Is there a Firebird equivalent (or even the need for such?) to the mysql
function mysql_escape_string? I am porting an application from mysql to
firebird and have encountered this function call. It appears to me that the
functionality included in this function is not needed in Firebird, since
Firebird can handle newlines, etc. in sql strings without any problem. I
thought I'd double-check with the experts, though, just to be sure.
> The real problems are quotes inside of strings. They'd terminate the
> string literal in the SQL
> statement, although they might be part of the string.
> Firebird has support for query parameters for such needs. Most
> Firebird access libraries
> handle them quite differently, so you'd need to check your library's
> documentation.
> For API-level access, read the API Guide, page 104,
> Chapter "Method 3: Query statements with parameters"

And ... :-)

Many of the languages used to build applications with Firebird have
a way of duplicating single quotes to two single quotes, avoiding this
problem as well.


would become

which is fine - 1 quote is escaped by doubling the single quote.

Hope this helps.

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Upscene Productions
Database development questions? Check the forum!