Created
May 31, 2012 15:44
-
-
Save dregad/2844276 to your computer and use it in GitHub Desktop.
MantisBT / ADOdb diffs upstream 5.10 vs 1.2.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r -w -u mantis_adodb5.10/adodb-datadict.inc.php ../dev/mantisbt/library/adodb/adodb-datadict.inc.php | |
--- mantis_adodb5.10/adodb-datadict.inc.php 2012-05-31 14:56:22.450304922 +0200 | |
+++ ../dev/mantisbt/library/adodb/adodb-datadict.inc.php 2012-05-31 14:57:37.554308740 +0200 | |
@@ -715,12 +715,12 @@ | |
$ftype = $this->_GetSize($ftype, $ty, $fsize, $fprec); | |
- if ($ty == 'X' || $ty == 'X2' || $ty == 'B') $fnotnull = false; // some blob types do not accept nulls | |
+ //if ($ty == 'X' || $ty == 'X2' || $ty == 'B') $fnotnull = false; // some blob types do not accept nulls | |
if ($fprimary) $pkey[] = $fname; | |
// some databases do not allow blobs to have defaults | |
- if ($ty == 'X') $fdefault = false; | |
+ //if ($ty == 'X') $fdefault = false; | |
// build list of indexes | |
if ($findex != '') { | |
diff -r -w -u mantis_adodb5.10/adodb.inc.php ../dev/mantisbt/library/adodb/adodb.inc.php | |
--- mantis_adodb5.10/adodb.inc.php 2012-05-31 14:56:22.490304924 +0200 | |
+++ ../dev/mantisbt/library/adodb/adodb.inc.php 2012-05-31 14:57:37.590308742 +0200 | |
@@ -177,7 +177,7 @@ | |
/** | |
* ADODB version as a string. | |
*/ | |
- $ADODB_vers = 'V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved. Released BSD & LGPL.'; | |
+ $ADODB_vers = 'V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved. Released BSD & LGPL. MantisBT Version'; | |
/** | |
* Determines whether recordset->RecordCount() is used. | |
@@ -2537,8 +2537,8 @@ | |
if ($rr[1] <= TIMESTAMP_FIRST_YEAR && $rr[2]<= 1) return 0; | |
// h-m-s-MM-DD-YY | |
- if (!isset($rr[5])) return adodb_mktime(0,0,0,$rr[2],$rr[3],$rr[1]); | |
- return @adodb_mktime($rr[5],$rr[6],$rr[7],$rr[2],$rr[3],$rr[1]); | |
+ if (!isset($rr[5])) return adodb_mktime(0,0,0,(int)$rr[2],(int)$rr[3],(int)$rr[1]); | |
+ return @adodb_mktime((int)$rr[5],(int)$rr[6],(int)$rr[7],(int)$rr[2],(int)$rr[3],(int)$rr[1]); | |
} | |
/** | |
diff -r -w -u mantis_adodb5.10/adodb-lib.inc.php ../dev/mantisbt/library/adodb/adodb-lib.inc.php | |
--- mantis_adodb5.10/adodb-lib.inc.php 2012-05-31 14:56:22.466304923 +0200 | |
+++ ../dev/mantisbt/library/adodb/adodb-lib.inc.php 2012-05-31 14:57:37.566308741 +0200 | |
@@ -1012,6 +1012,7 @@ | |
if (!is_numeric($val)) $val = (integer) $val; | |
break; | |
+ | |
default: | |
$val = str_replace(array("'"," ","("),"",$arrFields[$fname]); // basic sql injection defence | |
if (empty($val)) $val = '0'; | |
diff -r -w -u mantis_adodb5.10/datadict/datadict-mssql.inc.php ../dev/mantisbt/library/adodb/datadict/datadict-mssql.inc.php | |
--- mantis_adodb5.10/datadict/datadict-mssql.inc.php 2012-05-31 14:56:22.690304934 +0200 | |
+++ ../dev/mantisbt/library/adodb/datadict/datadict-mssql.inc.php 2012-05-31 14:57:37.794308752 +0200 | |
@@ -123,19 +123,66 @@ | |
return $sql; | |
} | |
- /* | |
- function AlterColumnSQL($tabname, $flds) | |
+ function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') | |
{ | |
$tabname = $this->TableName ($tabname); | |
$sql = array(); | |
- list($lines,$pkey) = $this->_GenFields($flds); | |
+ | |
+ list($lines,$pkey,$idxs) = $this->_GenFields($flds); | |
+ // genfields can return FALSE at times | |
+ if ($lines == null) $lines = array(); | |
+ $alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' '; | |
foreach($lines as $v) { | |
- $sql[] = "ALTER TABLE $tabname $this->alterCol $v"; | |
+ | |
+ $not_null = false; | |
+ if ($not_null = preg_match('/NOT NULL/i',$v)) { | |
+ $v = preg_replace('/NOT NULL/i','',$v); | |
+ } | |
+ | |
+ if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) { | |
+ list(,$colname,$default) = $matches; | |
+ $existing = $this->MetaColumns($tabname); | |
+ $constraintname = false; | |
+ $rs = $this->connection->Execute( "select name from sys.default_constraints WHERE object_name(parent_object_id) = '" . $tabname ."' AND col_name(parent_object_id, parent_column_id) = '" . $colname . "'"); | |
+ if ( is_object($rs) ) { | |
+ $row = $rs->FetchRow(); | |
+ if ( $row['name'] !== null ) { | |
+ $constraintname = $row[ 'name' ]; | |
+ } else { | |
+ $constraintname = $row[0]; | |
+ } | |
+ } | |
+ $v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v); | |
+ $t = trim(str_replace('DEFAULT '.$default,'',$v)); | |
+ if ( $constraintname != false ) { | |
+ $sql[] = 'ALTER TABLE '.$tabname.' DROP CONSTRAINT '. $constraintname; | |
+ } | |
+ $sql[] = $alter . $colname . ' ' . $t ; | |
+ if ( $constraintname != false ) { | |
+ $sql[] = 'ALTER TABLE '.$tabname.' ADD CONSTRAINT '.$constraintname.' DEFAULT ' . $default . ' FOR ' . $colname; | |
+ } else { | |
+ $sql[] = 'ALTER TABLE '.$tabname.' ADD CONSTRAINT DF__'. $tabname . '__'. $colname. '__' . dechex(rand()) .' DEFAULT ' . $default . ' FOR ' . $colname; | |
+ } | |
+ if ($not_null) { | |
+ $sql[] = $alter . $colname . ' ' . $t . ' NOT NULL'; | |
+ } | |
+ } else { | |
+ if ($not_null) { | |
+ $sql[] = $alter . $v . ' NOT NULL'; | |
+ } else { | |
+ $sql[] = $alter . $v; | |
+ } | |
+ } | |
+ } | |
+ if (is_array($idxs)) { | |
+ foreach($idxs as $idx => $idxdef) { | |
+ $sql_idxs = $this->CreateIndexSql($idx, $tabname, $idxdef['cols'], $idxdef['opts']); | |
+ $sql = array_merge($sql, $sql_idxs); | |
} | |
+ } | |
return $sql; | |
} | |
- */ | |
function DropColumnSQL($tabname, $flds) | |
{ | |
@@ -145,6 +192,19 @@ | |
$f = array(); | |
$s = 'ALTER TABLE ' . $tabname; | |
foreach($flds as $v) { | |
+ $rs = $this->connection->Execute( "select name from sys.default_constraints WHERE object_name(parent_object_id) = '" . $tabname ."' AND col_name(parent_object_id, parent_column_id) = '" . $v . "'"); | |
+ if ( is_object($rs) ) { | |
+ $row = $rs->FetchRow(); | |
+ if ( $row['name'] !== null ) { | |
+ $constraintname = $row[ 'name' ]; | |
+ } else { | |
+ $constraintname = $row[0]; | |
+ } | |
+ if ( $constraintname != false ) { | |
+ $sql[] = 'ALTER TABLE '.$tabname.' DROP CONSTRAINT '. $constraintname; | |
+ } | |
+ } | |
+ | |
$f[] = "\n$this->dropCol ".$this->NameQuote($v); | |
} | |
$s .= implode(', ',$f); | |
diff -r -w -u mantis_adodb5.10/datadict/datadict-mssqlnative.inc.php ../dev/mantisbt/library/adodb/datadict/datadict-mssqlnative.inc.php | |
--- mantis_adodb5.10/datadict/datadict-mssqlnative.inc.php 2012-05-31 14:56:22.702304935 +0200 | |
+++ ../dev/mantisbt/library/adodb/datadict/datadict-mssqlnative.inc.php 2012-05-31 14:57:37.806308753 +0200 | |
@@ -69,7 +69,7 @@ | |
case 'TINYINT': return 'I1'; | |
case 'SMALLINT': return 'I2'; | |
case 'BIGINT': return 'I8'; | |
- | |
+ case 'SMALLDATETIME': return 'T'; | |
case 'REAL': | |
case 'FLOAT': return 'F'; | |
default: return parent::MetaType($t,$len,$fieldobj); | |
@@ -121,19 +121,62 @@ | |
return $sql; | |
} | |
- /* | |
- function AlterColumnSQL($tabname, $flds) | |
+ function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') | |
{ | |
$tabname = $this->TableName ($tabname); | |
$sql = array(); | |
- list($lines,$pkey) = $this->_GenFields($flds); | |
+ | |
+ list($lines,$pkey,$idxs) = $this->_GenFields($flds); | |
+ // genfields can return FALSE at times | |
+ if ($lines == null) $lines = array(); | |
+ $alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' '; | |
foreach($lines as $v) { | |
- $sql[] = "ALTER TABLE $tabname $this->alterCol $v"; | |
+ | |
+ $not_null = false; | |
+ if ($not_null = preg_match('/NOT NULL/i',$v)) { | |
+ $v = preg_replace('/NOT NULL/i','',$v); | |
+ } | |
+ | |
+ if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) { | |
+ list(,$colname,$default) = $matches; | |
+ $existing = $this->MetaColumns($tabname); | |
+ $constraintname = false; | |
+ $rs = $this->connection->Execute( "select name from sys.default_constraints WHERE object_name(parent_object_id) = '" . $tabname ."' AND col_name(parent_object_id, parent_column_id) = '" . $colname . "'"); | |
+ if ( is_object($rs) ) { | |
+ $row = $rs->FetchRow(); | |
+ $constraintname = $row[0]; | |
+ } | |
+ $v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v); | |
+ $t = trim(str_replace('DEFAULT '.$default,'',$v)); | |
+ if ( $constraintname != false ) { | |
+ $sql[] = 'ALTER TABLE '.$tabname.' DROP CONSTRAINT '. $constraintname; | |
+ } | |
+ $sql[] = $alter . $colname . ' ' . $t ; | |
+ if ( $constraintname != false ) { | |
+ $sql[] = 'ALTER TABLE '.$tabname.' ADD CONSTRAINT '.$constraintname.' DEFAULT ' . $default . ' FOR ' . $colname; | |
+ } else { | |
+ $sql[] = 'ALTER TABLE '.$tabname.' ADD CONSTRAINT DF__'. $tabname . '__'. $colname. '__' . dechex(rand()) .' DEFAULT ' . $default . ' FOR ' . $colname; | |
+ } | |
+ if ($not_null) { | |
+ $sql[] = $alter . $colname . ' ' . $t . ' NOT NULL'; | |
+ } | |
+ } else { | |
+ if ($not_null) { | |
+ $sql[] = $alter . $v . ' NOT NULL'; | |
+ } else { | |
+ $sql[] = $alter . $v; | |
+ } | |
+ } | |
+ } | |
+ if (is_array($idxs)) { | |
+ foreach($idxs as $idx => $idxdef) { | |
+ $sql_idxs = $this->CreateIndexSql($idx, $tabname, $idxdef['cols'], $idxdef['opts']); | |
+ $sql = array_merge($sql, $sql_idxs); | |
} | |
+ } | |
return $sql; | |
} | |
- */ | |
function DropColumnSQL($tabname, $flds) | |
{ | |
@@ -143,6 +186,13 @@ | |
$f = array(); | |
$s = 'ALTER TABLE ' . $tabname; | |
foreach($flds as $v) { | |
+ $rs = $this->connection->Execute( "select name from sys.default_constraints WHERE object_name(parent_object_id) = '" . $tabname ."' AND col_name(parent_object_id, parent_column_id) = '" . $v . "'"); | |
+ if ( is_object($rs) ) { | |
+ $row = $rs->FetchRow(); | |
+ $constraintname = $row[0]; | |
+ $sql[] = 'ALTER TABLE '.$tabname.' DROP CONSTRAINT '. $constraintname; | |
+ } | |
+ | |
$f[] = "\n$this->dropCol ".$this->NameQuote($v); | |
} | |
$s .= implode(', ',$f); | |
diff -r -w -u mantis_adodb5.10/datadict/datadict-postgres.inc.php ../dev/mantisbt/library/adodb/datadict/datadict-postgres.inc.php | |
--- mantis_adodb5.10/datadict/datadict-postgres.inc.php 2012-05-31 14:56:22.698304934 +0200 | |
+++ ../dev/mantisbt/library/adodb/datadict/datadict-postgres.inc.php 2012-05-31 14:57:37.802308753 +0200 | |
@@ -136,7 +136,7 @@ | |
if (($not_null = preg_match('/NOT NULL/i',$v))) { | |
$v = preg_replace('/NOT NULL/i','',$v); | |
} | |
- if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) { | |
+ if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) { | |
list(,$colname,$default) = $matches; | |
$sql[] = $alter . str_replace('DEFAULT '.$default,'',$v); | |
$sql[] = 'UPDATE '.$tabname.' SET '.$colname.'='.$default; | |
@@ -188,6 +188,7 @@ | |
$tabname = $this->TableName($tabname); | |
$sql = array(); | |
list($lines,$pkey) = $this->_GenFields($flds); | |
+ $set_null = false; | |
$alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' '; | |
foreach($lines as $v) { | |
if ($not_null = preg_match('/NOT NULL/i',$v)) { | |
@@ -200,11 +201,19 @@ | |
$v = preg_replace('/\sNULL/i','',$v); | |
} | |
- if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) { | |
+ if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) { | |
+ $existing = $this->MetaColumns($tabname); | |
list(,$colname,$default) = $matches; | |
$v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v); | |
- $sql[] = $alter . $colname . ' TYPE ' . str_replace('DEFAULT '.$default,'',$v); | |
+ $t = trim(str_replace('DEFAULT '.$default,'',$v)); | |
+ if ( $existing[strtoupper($colname)]->type == 'bool' && $t == 'INTEGER') { | |
+ $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' DROP DEFAULT'; | |
+ $sql[] = $alter . $colname . ' TYPE ' . $t . ' USING (redirect_delay::BOOL)::INT '; | |
$sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET DEFAULT ' . $default; | |
+ } else { | |
+ $sql[] = $alter . $colname . ' TYPE ' . $t; | |
+ $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET DEFAULT ' . $default; | |
+ } | |
} | |
else { | |
// drop default? | |
@@ -213,7 +222,7 @@ | |
$sql[] = $alter . $colname . ' TYPE ' . $rest; | |
} | |
- list($colname) = explode(' ',$v); | |
+ //list($colname) = explode(' ',$v); | |
if ($not_null) { | |
// this does not error out if the column is already not null | |
$sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET NOT NULL'; | |
@@ -223,6 +232,7 @@ | |
$sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' DROP NOT NULL'; | |
} | |
} | |
+ | |
return $sql; | |
} | |
diff -r -w -u mantis_adodb5.10/drivers/adodb-db2.inc.php ../dev/mantisbt/library/adodb/drivers/adodb-db2.inc.php | |
--- mantis_adodb5.10/drivers/adodb-db2.inc.php 2012-05-31 14:56:22.602304929 +0200 | |
+++ ../dev/mantisbt/library/adodb/drivers/adodb-db2.inc.php 2012-05-31 14:57:37.706308748 +0200 | |
@@ -24,9 +24,6 @@ | |
--------------------------------------------------------------------------------------*/ | |
- | |
- | |
- | |
class ADODB_db2 extends ADOConnection { | |
var $databaseType = "db2"; | |
var $fmtDate = "'Y-m-d'"; | |
@@ -36,7 +33,10 @@ | |
var $sysDate = 'CURRENT DATE'; | |
var $sysTimeStamp = 'CURRENT TIMESTAMP'; | |
- var $fmtTimeStamp = "'Y-m-d H:i:s'"; | |
+ // See #8386 for more details | |
+ // original: var $fmtTimeStamp = "'Y-m-d-H:i:s'"; | |
+ // DB2 valid formats: Y-m-d-H.i.s (IBM SQL format, center dash and dots) or Y-m-d H:i:s (ISO format, center space and colons). Since i5/OS v5r3 supports only IBM SQL format, we'll use it: Y-m-d-H.i.s | |
+ var $fmtTimeStamp = "'Y-m-d-H.i.s'"; | |
var $replaceQuote = "''"; // string to use to replace quotes | |
var $dataProvider = "db2"; | |
var $hasAffectedRows = true; | |
@@ -58,7 +58,9 @@ | |
function _insertid() | |
{ | |
- return ADOConnection::GetOne('VALUES IDENTITY_VAL_LOCAL()'); | |
+ // See #8385 for more details. | |
+ // original: return ADOConnection::GetOne('VALUES IDENTITY_VAL_LOCAL()'); | |
+ return ADOConnection::GetOne('SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1'); | |
} | |
function ADODB_db2() | |
@@ -138,7 +140,10 @@ | |
{ | |
if (empty($ts) && $ts !== 0) return 'null'; | |
if (is_string($ts)) $ts = ADORecordSet::UnixTimeStamp($ts); | |
- return 'TO_DATE('.adodb_date($this->fmtTimeStamp,$ts).",'YYYY-MM-DD HH24:MI:SS')"; | |
+ | |
+ // See #8387 for more details | |
+ // original: return 'TO_DATE('.adodb_date($this->fmtTimeStamp,$ts).",'YYYY-MM-DD HH24:MI:SS')"; | |
+ return adodb_date($this->fmtTimeStamp,$ts); | |
} | |
// Format date column in sql string given an input format that understands Y M D | |
@@ -421,13 +426,18 @@ | |
} | |
- function MetaTables($ttype=false,$schema=false) | |
+ // See #8384 for more details | |
+ // @@@ original: function MetaTables($ttype=false,$schema=false) | |
+ // DB2/400 Allow table and schema as optional parameters. | |
+ function MetaTables($ttype=false,$showSchema=false, $qtable="%", $qschema="%") | |
{ | |
global $ADODB_FETCH_MODE; | |
$savem = $ADODB_FETCH_MODE; | |
$ADODB_FETCH_MODE = ADODB_FETCH_NUM; | |
- $qid = db2_tables($this->_connectionID); | |
+ | |
+ // @@@ original: $qid = db2_tables($this->_connectionID); | |
+ $qid = db2_tables($this->_connectionID, null, $qschema, $qtable); | |
$rs = new ADORecordSet_db2($qid); | |
@@ -447,13 +457,14 @@ | |
for ($i=0; $i < sizeof($arr); $i++) { | |
if (!$arr[$i][2]) continue; | |
$type = $arr[$i][3]; | |
- $owner = $arr[$i][1]; | |
- $schemaval = ($schema) ? $arr[$i][1].'.' : ''; | |
+ // @@@ original: DB2/400 $schemaval = ($schema) ? $arr[$i][1].'.' : ''; | |
+ // use $showSchema instead of $schema, for consistency with odbc_db2.inc.php | |
+ $schemaval = ($showSchema) ? $arr[$i][1].'.' : ''; | |
if ($ttype) { | |
if ($isview) { | |
if (strncmp($type,'V',1) === 0) $arr2[] = $schemaval.$arr[$i][2]; | |
- } else if (strncmp($owner,'SYS',3) !== 0) $arr2[] = $schemaval.$arr[$i][2]; | |
- } else if (strncmp($owner,'SYS',3) !== 0) $arr2[] = $schemaval.$arr[$i][2]; | |
+ } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $schemaval.$arr[$i][2]; | |
+ } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $schemaval.$arr[$i][2]; | |
} | |
return $arr2; | |
} | |
diff -r -w -u mantis_adodb5.10/drivers/adodb-mssql.inc.php ../dev/mantisbt/library/adodb/drivers/adodb-mssql.inc.php | |
--- mantis_adodb5.10/drivers/adodb-mssql.inc.php 2012-05-31 14:56:22.614304930 +0200 | |
+++ ../dev/mantisbt/library/adodb/drivers/adodb-mssql.inc.php 2012-05-31 14:57:37.714308748 +0200 | |
@@ -14,7 +14,6 @@ | |
*/ | |
- | |
// security - hide paths | |
if (!defined('ADODB_DIR')) die(); | |
diff -r -w -u mantis_adodb5.10/drivers/adodb-mysqli.inc.php ../dev/mantisbt/library/adodb/drivers/adodb-mysqli.inc.php | |
--- mantis_adodb5.10/drivers/adodb-mysqli.inc.php 2012-05-31 14:56:22.626304931 +0200 | |
+++ ../dev/mantisbt/library/adodb/drivers/adodb-mysqli.inc.php 2012-05-31 14:57:37.726308749 +0200 | |
@@ -309,7 +309,7 @@ | |
} | |
- function MetaIndexes ($table, $primary = FALSE) | |
+ function MetaIndexes ($table, $primary = FALSE, $owner=false) | |
{ | |
// save old fetch mode | |
global $ADODB_FETCH_MODE; | |
@@ -672,6 +672,7 @@ | |
$fnarr = array_merge( array($stmt,$a) , $inputarr); | |
$ret = call_user_func_array('mysqli_stmt_bind_param',$fnarr); | |
+ | |
$ret = mysqli_stmt_execute($stmt); | |
return $ret; | |
} | |
@@ -1109,6 +1110,7 @@ | |
$this->ADORecordSet_array($id,$mode); | |
} | |
+ | |
function MetaType($t, $len = -1, $fieldobj = false) | |
{ | |
if (is_object($t)) { | |
diff -r -w -u mantis_adodb5.10/drivers/adodb-mysql.inc.php ../dev/mantisbt/library/adodb/drivers/adodb-mysql.inc.php | |
--- mantis_adodb5.10/drivers/adodb-mysql.inc.php 2012-05-31 14:56:22.586304929 +0200 | |
+++ ../dev/mantisbt/library/adodb/drivers/adodb-mysql.inc.php 2012-05-31 14:57:37.686308747 +0200 | |
@@ -133,6 +133,7 @@ | |
function qstr($s,$magic_quotes=false) | |
{ | |
if (is_null($s)) return 'NULL'; | |
+ | |
if (!$magic_quotes) { | |
if (ADODB_PHPVER >= 0x4300) { | |
diff -r -w -u mantis_adodb5.10/drivers/adodb-odbc.inc.php ../dev/mantisbt/library/adodb/drivers/adodb-odbc.inc.php | |
--- mantis_adodb5.10/drivers/adodb-odbc.inc.php 2012-05-31 14:56:22.638304931 +0200 | |
+++ ../dev/mantisbt/library/adodb/drivers/adodb-odbc.inc.php 2012-05-31 14:57:37.738308749 +0200 | |
@@ -531,6 +531,9 @@ | |
$this->_lastAffectedRows = 0; | |
if ($stmtid) { | |
+ if (!is_array($sql) && preg_match('/^\\s*insert/i', $sql)) { | |
+ return $stmtid; | |
+ } | |
if (@odbc_num_fields($stmtid) == 0) { | |
$this->_lastAffectedRows = odbc_num_rows($stmtid); | |
$stmtid = true; | |
diff -r -w -u mantis_adodb5.10/drivers/adodb-odbc_mssql.inc.php ../dev/mantisbt/library/adodb/drivers/adodb-odbc_mssql.inc.php | |
--- mantis_adodb5.10/drivers/adodb-odbc_mssql.inc.php 2012-05-31 14:56:22.626304931 +0200 | |
+++ ../dev/mantisbt/library/adodb/drivers/adodb-odbc_mssql.inc.php 2012-05-31 14:57:37.730308749 +0200 | |
@@ -72,8 +72,12 @@ | |
// the same scope. A scope is a module -- a stored procedure, trigger, | |
// function, or batch. Thus, two statements are in the same scope if | |
// they are in the same stored procedure, function, or batch. | |
+ if ($this->lastInsID !== false) { | |
+ return $this->lastInsID; // InsID from sp_executesql call | |
+ } else { | |
return $this->GetOne($this->identitySQL); | |
} | |
+ } | |
function MetaForeignKeys($table, $owner=false, $upper=false) | |
@@ -180,8 +184,21 @@ | |
function _query($sql,$inputarr=false) | |
{ | |
if (is_string($sql)) $sql = str_replace('||','+',$sql); | |
+ $getIdentity = false; | |
+ if (!is_array($sql) && preg_match('/^\\s*insert/i', $sql)) { | |
+ $getIdentity = true; | |
+ $sql .= (preg_match('/;\\s*$/i', $sql) ? ' ' : '; ') . $this->identitySQL . ' as insertid'; | |
+ } | |
+ | |
+ if ($getIdentity) { | |
+ $res = ADODB_odbc::_query($sql,$inputarr); | |
+ $row = odbc_fetch_array($res); | |
+ $this->lastInsID = isset($row['insertid']) ? (int)$row['insertid'] : false; | |
+ } else { | |
+ $this->lastInsID = false; | |
return ADODB_odbc::_query($sql,$inputarr); | |
} | |
+ } | |
function SetTransactionMode( $transaction_mode ) | |
{ | |
diff -r -w -u mantis_adodb5.10/drivers/adodb-pdo.inc.php ../dev/mantisbt/library/adodb/drivers/adodb-pdo.inc.php | |
--- mantis_adodb5.10/drivers/adodb-pdo.inc.php 2012-05-31 14:56:22.558304927 +0200 | |
+++ ../dev/mantisbt/library/adodb/drivers/adodb-pdo.inc.php 2012-05-31 14:57:37.662308745 +0200 | |
@@ -441,7 +441,7 @@ | |
return false; | |
} | |
- function MetaColumns() | |
+ function MetaColumns($table,$normalize=true) | |
{ | |
return false; | |
} | |
diff -r -w -u mantis_adodb5.10/drivers/adodb-postgres64.inc.php ../dev/mantisbt/library/adodb/drivers/adodb-postgres64.inc.php | |
--- mantis_adodb5.10/drivers/adodb-postgres64.inc.php 2012-05-31 14:56:22.574304928 +0200 | |
+++ ../dev/mantisbt/library/adodb/drivers/adodb-postgres64.inc.php 2012-05-31 14:57:37.674308746 +0200 | |
@@ -584,7 +584,7 @@ | |
} | |
- function MetaIndexes ($table, $primary = FALSE) | |
+ function MetaIndexes ($table, $primary = FALSE, $owner=false) | |
{ | |
global $ADODB_FETCH_MODE; | |
diff -r -w -u mantis_adodb5.10/drivers/adodb-sapdb.inc.php ../dev/mantisbt/library/adodb/drivers/adodb-sapdb.inc.php | |
--- mantis_adodb5.10/drivers/adodb-sapdb.inc.php 2012-05-31 14:56:22.618304930 +0200 | |
+++ ../dev/mantisbt/library/adodb/drivers/adodb-sapdb.inc.php 2012-05-31 14:57:37.722308748 +0200 | |
@@ -53,7 +53,7 @@ | |
return $this->GetCol("SELECT columnname FROM COLUMNS WHERE tablename=$table AND mode='KEY' ORDER BY pos"); | |
} | |
- function MetaIndexes ($table, $primary = FALSE) | |
+ function MetaIndexes ($table, $primary = FALSE, $owner=false) | |
{ | |
$table = $this->Quote(strtoupper($table)); | |
@@ -92,7 +92,7 @@ | |
return $indexes; | |
} | |
- function MetaColumns ($table) | |
+ function MetaColumns ($table,$normalize=true) | |
{ | |
global $ADODB_FETCH_MODE; | |
$save = $ADODB_FETCH_MODE; | |
Only in ../dev/mantisbt/library/adodb/: index.html | |
diff -r -w -u mantis_adodb5.10/lang/adodb-ro.inc.php ../dev/mantisbt/library/adodb/lang/adodb-ro.inc.php | |
--- mantis_adodb5.10/lang/adodb-ro.inc.php 2012-05-31 14:56:22.494304924 +0200 | |
+++ ../dev/mantisbt/library/adodb/lang/adodb-ro.inc.php 2012-05-31 14:57:37.594308742 +0200 | |
@@ -33,3 +33,4 @@ | |
DB_ERROR_ACCESS_VIOLATION => 'permisiuni insuficiente' | |
); | |
?> | |
\ No newline at end of file | |
+ | |
diff -r -w -u mantis_adodb5.10/lang/adodb_th.inc.php ../dev/mantisbt/library/adodb/lang/adodb_th.inc.php | |
--- mantis_adodb5.10/lang/adodb_th.inc.php 2012-05-31 14:56:22.498304924 +0200 | |
+++ ../dev/mantisbt/library/adodb/lang/adodb_th.inc.php 2012-05-31 14:57:37.598308742 +0200 | |
@@ -31,3 +31,4 @@ | |
DB_ERROR_ACCESS_VIOLATION => 'permissions ไม่พอ' | |
); | |
?> | |
\ No newline at end of file | |
+ | |
Only in ../dev/mantisbt/library/adodb/: readme_mantis.txt | |
diff -r -w -u mantis_adodb5.10/readme.txt ../dev/mantisbt/library/adodb/readme.txt | |
--- mantis_adodb5.10/readme.txt 2012-05-31 14:56:22.506304925 +0200 | |
+++ ../dev/mantisbt/library/adodb/readme.txt 2012-05-31 14:57:37.606308743 +0200 | |
@@ -59,3 +59,4 @@ | |
Email to jlim@natsoft.com.my | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment