From: stronk7 Date: Fri, 10 Aug 2007 00:50:04 +0000 (+0000) Subject: Fixed bug when inserting strings beginning by single quotes. MDL-10788 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=27baf81851fc83f969679fbaf4f88da55edfb378;p=moodle.git Fixed bug when inserting strings beginning by single quotes. MDL-10788 Merged from MOODLE_18_STABLE --- diff --git a/lib/adodb/drivers/adodb-mssql_n.inc.php b/lib/adodb/drivers/adodb-mssql_n.inc.php index d112f89ab6..e740aacffa 100644 --- a/lib/adodb/drivers/adodb-mssql_n.inc.php +++ b/lib/adodb/drivers/adodb-mssql_n.inc.php @@ -1,4 +1,4 @@ -$value) { @@ -142,6 +143,10 @@ class ADODB_mssql_n extends ADODB_mssql { $result = str_replace(array_keys($literals), $literals, $result); } + /// Any pairs followed by N' must be switched to N' followed by those pairs + /// (or strings beginning with single quotes will fail) + $result = preg_replace("/((<@#@#@PAIR-(\d+)@#@#@>)+)N'/", "N'$1", $result); + /// Re-apply pairs of single-quotes to the text if (!empty($pairs)) { $result = str_replace(array_keys($pairs), $pairs, $result); @@ -163,4 +168,4 @@ class ADORecordset_mssql_n extends ADORecordset_mssql { $this->ADORecordset_mssql($id,$mode); } } -?> \ No newline at end of file +?>