Subject | Re: [firebird-support] Firebird equivalent to MySql escape string? |
---|---|
Author | Martijn Tonies |
Post date | 2005-10-19T07:03:37Z |
> > Is there a Firebird equivalent (or even the need for such?) to the mysqlfunction 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.
>And ... :-)
> 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"
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.
Eg:
O'Conners
would become
O''Conners
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
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com