mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
Fixed bug when inserting strings beginning by single quotes. MDL-10788
This commit is contained in:
parent
dda4bbbf25
commit
295ce0c81e
1 changed files with 10 additions and 3 deletions
|
@ -1,4 +1,6 @@
|
||||||
<?php /// $Id $
|
<?php
|
||||||
|
|
||||||
|
/// $Id $
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
|
@ -7,7 +9,7 @@
|
||||||
// ADOdb - Database Abstraction Library for PHP //
|
// ADOdb - Database Abstraction Library for PHP //
|
||||||
// http://adodb.sourceforge.net/ //
|
// http://adodb.sourceforge.net/ //
|
||||||
// //
|
// //
|
||||||
// Copyright (C) 2000-2006 John Lim (jlim\@natsoft.com.my) //
|
// Copyright (C) 2000-2007 John Lim (jlim\@natsoft.com.my) //
|
||||||
// All rights reserved. //
|
// All rights reserved. //
|
||||||
// Released under both BSD license and LGPL library license. //
|
// Released under both BSD license and LGPL library license. //
|
||||||
// Whenever there is any discrepancy between the two licenses, //
|
// Whenever there is any discrepancy between the two licenses, //
|
||||||
|
@ -125,6 +127,7 @@ class ADODB_mssql_n extends ADODB_mssql {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Analyse literals to prepend the N char to them if their contents aren't numeric
|
/// Analyse literals to prepend the N char to them if their contents aren't numeric
|
||||||
if (!empty($literals)) {
|
if (!empty($literals)) {
|
||||||
foreach ($literals as $key=>$value) {
|
foreach ($literals as $key=>$value) {
|
||||||
|
@ -140,6 +143,10 @@ class ADODB_mssql_n extends ADODB_mssql {
|
||||||
$result = str_replace(array_keys($literals), $literals, $result);
|
$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
|
/// Re-apply pairs of single-quotes to the text
|
||||||
if (!empty($pairs)) {
|
if (!empty($pairs)) {
|
||||||
$result = str_replace(array_keys($pairs), $pairs, $result);
|
$result = str_replace(array_keys($pairs), $pairs, $result);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue