46 if (!defined(
'ADODB_DIR'))
die();
49 if (!defined(
'SINGLEQUOTE')) define(
'SINGLEQUOTE',
"'");
51 include_once(ADODB_DIR.
'/drivers/adodb-mssql.inc.php');
54 var $databaseType =
"mssql_n";
76 function _appendN(
$sql) {
81 if (strpos(
$sql, SINGLEQUOTE) ===
false) {
87 if ((substr_count(
$sql, SINGLEQUOTE) & 1)) {
89 ADOConnection::outp(
"{$this->databaseType} internal transformation: not converted. Wrong number of quotes (odd)");
96 $regexp =
'/(\\\\' . SINGLEQUOTE .
'[^' . SINGLEQUOTE .
'])/';
99 ADOConnection::outp(
"{$this->databaseType} internal transformation: not converted. Found bad use of backslash + single quote");
106 $regexp =
'/(' . SINGLEQUOTE . SINGLEQUOTE .
')/';
108 if ($list_of_pairs) {
109 foreach (array_unique($list_of_pairs[0]) as $key=>$value) {
110 $pairs[
'<@#@#@PAIR-'.$key.
'@#@#@>'] = $value;
119 $regexp =
'/(N?' . SINGLEQUOTE .
'.*?' . SINGLEQUOTE .
')/is';
121 if ($list_of_literals) {
122 foreach (array_unique($list_of_literals[0]) as $key=>$value) {
123 $literals[
'<#@#@#LITERAL-'.$key.
'#@#@#>'] = $value;
134 if (!is_numeric(trim($value, SINGLEQUOTE))) {
136 $literals[$key] =
'N' . trim($value,
'N');
157 ADOConnection::outp(
"{$this->databaseType} internal transformation:<br>{$sql}<br>to<br>{$result}");
165 var $databaseType =
"mssql_n";
if(!defined('SINGLEQUOTE')) define('SINGLEQUOTE' drivers adodb mssql inc php t an odd number of single quotes(this can cause problems below *and should be considered one wrong SQL). Exit with debug info. */if((substr_count($sql SINGLEQUOTE $regexp)
if(preg_match($regexp, $sql)) $pairs
Remove pairs of single-quotes.
_query($sql, $inputarr=false)
ADORecordset_mssql_n($id, $mode=false)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
if($list_of_pairs) $literals
Remove the rest of literals present in the query.
debug($variable='', $name=' *variable *', $line=' *line *', $file=' *file *', $recursiveDepth=3, $debugLevel=E_DEBUG)