Jump to content
php.lv forumi

SQL sagatavošana priekš Firebird datubāzes


andrisp

Recommended Posts

Kā sagatovot stringu ievietošanai SQL pieprasījumā priekš firebird(interbase) ?

 

Tā lai ibase_query("SELECT * FROM `table` WHERE smth = '".$str."'"), kur $str = "SIA 'Vējiņs'" nenogljukotu.

 

Kautkas līdzīgs mysql_real_escape_string ?

Link to comment
Share on other sites

google blin.

 

/*
			 * ibase doesn't seem to have the ability to pass a
			 * parameter along unchanged, so strip off quotes from start
			 * and end, plus turn two single quotes to one single quote,
			 * in order to avoid the quotes getting escaped by
			 * ibase and ending up in the database.
			 */
			$data[$key] = preg_replace("/^'(.*)'$/", "\\1", $data[$key]);
			$data[$key] = str_replace("''", "'", $data[$key]);

 

PS: iz PEAR paņemts http://www.koders.com/php/fid75758F63BAAEC...54463E5FFB.aspx

Edited by Delfins
Link to comment
Share on other sites

×
×
  • Create New...