|
|
Choosing A Webhost: |
mantisbt/core/adodb/drivers adodb-sybase_ase.inc.php,NONE,1.1 adodb-postgre: msg#00061bug-tracking.mantis.cvs
Update of /cvsroot/mantisbt/mantisbt/core/adodb/drivers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21275 Modified Files: adodb-vfp.inc.php adodb-sybase.inc.php adodb-sqlitepo.inc.php adodb-sqlite.inc.php adodb-sqlanywhere.inc.php adodb-sapdb.inc.php adodb-proxy.inc.php adodb-postgres7.inc.php adodb-postgres64.inc.php adodb-postgres.inc.php adodb-pdo.inc.php adodb-oracle.inc.php adodb-odbtp_unicode.inc.php adodb-odbtp.inc.php adodb-odbc_oracle.inc.php adodb-odbc_mssql.inc.php adodb-odbc.inc.php adodb-oci8po.inc.php adodb-oci805.inc.php adodb-oci8.inc.php adodb-netezza.inc.php adodb-mysqlt.inc.php adodb-mysqli.inc.php adodb-mysql.inc.php adodb-mssqlpo.inc.php adodb-mssql.inc.php adodb-ldap.inc.php adodb-informix72.inc.php adodb-informix.inc.php adodb-ibase.inc.php adodb-firebird.inc.php adodb-fbsql.inc.php adodb-db2.inc.php adodb-csv.inc.php adodb-borland_ibase.inc.php adodb-ado_mssql.inc.php adodb-ado_access.inc.php adodb-ado5.inc.php adodb-ado.inc.php adodb-access.inc.php Added Files: adodb-sybase_ase.inc.php adodb-postgres8.inc.php adodb-pdo_pgsql.inc.php adodb-pdo_oci.inc.php adodb-pdo_mysql.inc.php adodb-pdo_mssql.inc.php adodb-odbc_db2.inc.php Log Message: Sync: V4.80 8 Mar 2006 of adodb Index: adodb-odbc_oracle.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-odbc_oracle.inc.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- adodb-odbc_oracle.inc.php 12 Feb 2005 20:01:26 -0000 1.6 +++ adodb-odbc_oracle.inc.php 22 Apr 2006 11:10:21 -0000 1.7 @@ -1,14 +1,14 @@ <?php -/* -V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, - the BSD license will take precedence. +/* +V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. Set tabs to 4 for best viewing. - + Latest version is available at http://adodb.sourceforge.net - - Oracle support via ODBC. Requires ODBC. Works on Windows. + + Oracle support via ODBC. Requires ODBC. Works on Windows. */ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -17,26 +17,26 @@ include(ADODB_DIR."/drivers/adodb-odbc.inc.php"); } - -class ADODB_odbc_oracle extends ADODB_odbc { + +class ADODB_odbc_oracle extends ADODB_odbc { var $databaseType = 'odbc_oracle'; var $replaceQuote = "''"; // string to use to replace quotes var $concat_operator='||'; - var $fmtDate = "'Y-m-d 00:00:00'"; + var $fmtDate = "'Y-m-d 00:00:00'"; var $fmtTimeStamp = "'Y-m-d h:i:sA'"; var $metaTablesSQL = 'select table_name from cat'; var $metaColumnsSQL = "select cname,coltype,width from col where tname='%s' order by colno"; var $sysDate = "TRUNC(SYSDATE)"; var $sysTimeStamp = 'SYSDATE'; - + //var $_bindInputArray = false; - + function ADODB_odbc_oracle() { $this->ADODB_odbc(); } - - function &MetaTables() + + function &MetaTables() { $false = false; $rs = $this->Execute($this->metaTablesSQL); @@ -49,12 +49,13 @@ $rs->Close(); return $arr2; } - - function &MetaColumns($table) + + function &MetaColumns($table) { - + global $ADODB_FETCH_MODE; + $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table))); - if ($rs === false) { + if ($rs === false) { $false = false; return $false; } @@ -64,26 +65,26 @@ $fld->name = $rs->fields[0]; $fld->type = $rs->fields[1]; $fld->max_length = $rs->fields[2]; - - - if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld; + + + if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld; else $retarr[strtoupper($fld->name)] = $fld; - + $rs->MoveNext(); } $rs->Close(); - return $retarr; + return $retarr; } // returns true or false function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; - + $php_errormsg = ''; $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); $this->_errorMsg = $php_errormsg; - + $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); return $this->_connectionID != false; @@ -95,20 +96,20 @@ $php_errormsg = ''; $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); $this->_errorMsg = $php_errormsg; - + $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); return $this->_connectionID != false; } -} - -class ADORecordSet_odbc_oracle extends ADORecordSet_odbc { - +} + +class ADORecordSet_odbc_oracle extends ADORecordSet_odbc { + var $databaseType = 'odbc_oracle'; - + function ADORecordSet_odbc_oracle($id,$mode=false) { return $this->ADORecordSet_odbc($id,$mode); } } -?> +?> \ No newline at end of file Index: adodb-odbtp_unicode.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-odbtp_unicode.inc.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- adodb-odbtp_unicode.inc.php 27 Jan 2005 14:43:43 -0000 1.2 +++ adodb-odbtp_unicode.inc.php 22 Apr 2006 11:10:21 -0000 1.3 @@ -1,6 +1,6 @@ <?php /* - V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. + V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Index: adodb-netezza.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-netezza.inc.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- adodb-netezza.inc.php 12 Feb 2005 20:01:26 -0000 1.3 +++ adodb-netezza.inc.php 22 Apr 2006 11:10:21 -0000 1.4 @@ -1,7 +1,7 @@ <?php /* - V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved. - + V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + First cut at the Netezza Driver by Josh Eldridge joshuae74#hotmail.com Based on the previous postgres drivers. http://www.netezza.com/ @@ -20,7 +20,7 @@ include_once(ADODB_DIR.'/drivers/adodb-postgres64.inc.php'); class ADODB_netezza extends ADODB_postgres64 { - var $databaseType = 'netezza'; + var $databaseType = 'netezza'; var $dataProvider = 'netezza'; var $hasInsertID = false; var $_resultid = false; @@ -34,11 +34,11 @@ var $blobEncodeType = 'C'; var $metaColumnsSQL = "SELECT attname, atttype FROM _v_relation_column_def WHERE name = '%s' AND attnum > 0 ORDER BY attnum"; var $metaColumnsSQL1 = "SELECT attname, atttype FROM _v_relation_column_def WHERE name = '%s' AND attnum > 0 ORDER BY attnum"; - // netezza doesn't have keys. it does have distributions, so maybe this is + // netezza doesn't have keys. it does have distributions, so maybe this is // something that can be pulled from the system tables var $metaKeySQL = ""; var $hasAffectedRows = true; - var $hasLimit = true; + var $hasLimit = true; var $true = 't'; // string that represents TRUE for a database var $false = 'f'; // string that represents FALSE for a database var $fmtDate = "'Y-m-d'"; // used by DBDate() as the default date format used by the database @@ -47,52 +47,52 @@ var $autoRollback = true; // apparently pgsql does not autorollback properly before 4.3.4 // http://bugs.php.net/bug.php?id=25404 - - function ADODB_netezza() + + function ADODB_netezza() { - + } - - function &MetaColumns($table,$upper=true) + + function &MetaColumns($table,$upper=true) { - + // Changed this function to support Netezza which has no concept of keys // could posisbly work on other things from the system table later. - + global $ADODB_FETCH_MODE; - + $table = strtolower($table); $save = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false); - + $rs =& $this->Execute(sprintf($this->metaColumnsSQL,$table,$table)); if (isset($savem)) $this->SetFetchMode($savem); $ADODB_FETCH_MODE = $save; - + if ($rs === false) return false; $retarr = array(); - while (!$rs->EOF) { + while (!$rs->EOF) { $fld = new ADOFieldObject(); $fld->name = $rs->fields[0]; - - // since we're returning type and length as one string, + + // since we're returning type and length as one string, // split them out here. - + if ($first = strstr($rs->fields[1], "(")) { $fld->max_length = trim($first, "()"); } else { $fld->max_length = -1; } - + if ($first = strpos($rs->fields[1], "(")) { $fld->type = substr($rs->fields[1], 0, $first); } else { $fld->type = $rs->fields[1]; } - + switch ($fld->type) { case "byteint": case "boolean": @@ -116,20 +116,20 @@ $fld->max_length = 12; break; } - - if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld; + + if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld; else $retarr[($upper) ? strtoupper($fld->name) : $fld->name] = $fld; - + $rs->MoveNext(); } $rs->Close(); - return $retarr; - + return $retarr; + } - + } - + /*-------------------------------------------------------------------------------------- Class Name: Recordset --------------------------------------------------------------------------------------*/ @@ -138,10 +138,10 @@ { var $databaseType = "netezza"; var $canSeek = true; - - function ADORecordSet_netezza($queryID,$mode=false) + + function ADORecordSet_netezza($queryID,$mode=false) { - if ($mode === false) { + if ($mode === false) { global $ADODB_FETCH_MODE; $mode = $ADODB_FETCH_MODE; } @@ -149,13 +149,15 @@ { case ADODB_FETCH_NUM: $this->fetchMode = PGSQL_NUM; break; case ADODB_FETCH_ASSOC:$this->fetchMode = PGSQL_ASSOC; break; - default: + case ADODB_FETCH_DEFAULT: - case ADODB_FETCH_BOTH:$this->fetchMode = PGSQL_BOTH; break; + case ADODB_FETCH_BOTH: + default: $this->fetchMode = PGSQL_BOTH; break; } + $this->adodbFetchMode = $mode; $this->ADORecordSet($queryID); } - + // _initrs modified to disable blob handling function _initrs() { Index: adodb-ado_access.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-ado_access.inc.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- adodb-ado_access.inc.php 12 Feb 2005 20:01:25 -0000 1.5 +++ adodb-ado_access.inc.php 22 Apr 2006 11:10:21 -0000 1.6 @@ -1,13 +1,13 @@ <?php -/* -V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. -Released under both BSD license and Lesser GPL library license. -Whenever there is any discrepancy between the two licenses, -the BSD license will take precedence. See License.txt. +/* +V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. +Released under both BSD license and Lesser GPL library license. +Whenever there is any discrepancy between the two licenses, +the BSD license will take precedence. See License.txt. Set tabs to 4 for best viewing. - + Latest version is available at http://adodb.sourceforge.net - + Microsoft Access ADO data driver. Requires ADO and ODBC. Works only on MS Windows. */ @@ -19,7 +19,7 @@ else include(ADODB_DIR."/drivers/adodb-ado.inc.php"); } -class ADODB_ado_access extends ADODB_ado { +class ADODB_ado_access extends ADODB_ado { var $databaseType = 'ado_access'; var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE var $fmtDate = "#Y-m-d#"; @@ -27,28 +27,28 @@ var $sysDate = "FORMAT(NOW,'yyyy-mm-dd')"; var $sysTimeStamp = 'NOW'; var $hasTransactions = false; - + function ADODB_ado_access() { $this->ADODB_ado(); } - + function BeginTrans() { return false;} - + function CommitTrans() { return false;} - + function RollbackTrans() { return false;} } - -class ADORecordSet_ado_access extends ADORecordSet_ado { - - var $databaseType = "ado_access"; - + +class ADORecordSet_ado_access extends ADORecordSet_ado { + + var $databaseType = "ado_access"; + function ADORecordSet_ado_access($id,$mode=false) { return $this->ADORecordSet_ado($id,$mode); } } -?> +?> \ No newline at end of file Index: adodb-postgres64.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-postgres64.inc.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- adodb-postgres64.inc.php 12 Feb 2005 20:01:26 -0000 1.6 +++ adodb-postgres64.inc.php 22 Apr 2006 11:10:21 -0000 1.7 @@ -1,29 +1,29 @@ <?php /* - V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, + V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Set tabs to 8. - [...1094 lines suppressed...] case 'INT4': case 'INT2': if (isset($fieldobj) && empty($fieldobj->primary_key) && empty($fieldobj->unique)) return 'I'; - + case 'OID': case 'SERIAL': return 'R'; - + default: return 'N'; } } } -?> +?> \ No newline at end of file Index: adodb-odbc_mssql.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-odbc_mssql.inc.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- adodb-odbc_mssql.inc.php 27 Feb 2005 19:00:51 -0000 1.6 +++ adodb-odbc_mssql.inc.php 22 Apr 2006 11:10:21 -0000 1.7 @@ -1,14 +1,14 @@ <?php -/* -V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, - the BSD license will take precedence. +/* +V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. Set tabs to 4 for best viewing. - + Latest version is available at http://adodb.sourceforge.net - - MSSQL support via ODBC. Requires ODBC. Works on Windows and Unix. + + MSSQL support via ODBC. Requires ODBC. Works on Windows and Unix. For Unix configuration, see http://phpbuilder.com/columns/alberto20000919.php3 */ @@ -19,11 +19,11 @@ include(ADODB_DIR."/drivers/adodb-odbc.inc.php"); } - -class ADODB_odbc_mssql extends ADODB_odbc { + +class ADODB_odbc_mssql extends ADODB_odbc { var $databaseType = 'odbc_mssql'; var $fmtDate = "'Y-m-d'"; - var $fmtTimeStamp = "'Y-m-d h:i:sA'"; + var $fmtTimeStamp = "'Y-m-d H:i:s'"; var $_bindInputArray = true; var $metaTablesSQL="select name,case when type='U' then 'T' else 'V' end from sysobjects where (type='U' or type='V') and (name not in ('sysallocations','syscolumns','syscomments','sysdepends','sysfilegroups','sysfiles','sysfiles1','sysforeignkeys','sysfulltextcatalogs','sysindexes','sysindexkeys','sysmembers','sysobjects','syspermissions','sysprotects','sysreferences','systypes','sysusers','sysalternates','sysconstraints','syssegments','REFERENTIAL_CONSTRAINTS','CHECK_CONSTRAINTS','CONSTRAINT_TABLE_USAGE','CONSTRAINT_COLUMN_USAGE','VIEWS','VIEW_TABLE_USAGE','VIEW_COLUMN_USAGE','SCHEMATA','TABLES','TABLE_CONSTRAINTS','TABLE_PRIVILEGES','COLUMNS','COLUMN_DOMAIN_USAGE','COLUMN_PRIVILEGES','DOMAINS','DOMAIN_CONSTRAINTS','KEY_COLUMN_USAGE'))"; var $metaColumnsSQL = "select c.name,t.name,c.length from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name='%s'"; @@ -37,13 +37,13 @@ var $ansiOuter = true; // for mssql7 or later var $identitySQL = 'select @@IDENTITY'; // 'select SCOPE_IDENTITY'; # for mssql 2000 var $hasInsertID = true; - var $connectStmt = 'SET CONCAT_NULL_YIELDS_NULL OFF'; # When SET CONCAT_NULL_YIELDS_NULL is ON, + var $connectStmt = 'SET CONCAT_NULL_YIELDS_NULL OFF'; # When SET CONCAT_NULL_YIELDS_NULL is ON, # concatenating a null value with a string yields a NULL result - + function ADODB_odbc_mssql() { $this->ADODB_odbc(); - //$this->curmode = SQL_CUR_USE_ODBC; + //$this->curmode = SQL_CUR_USE_ODBC; } // crashes php... @@ -60,31 +60,31 @@ return $arr; } - function IfNull( $field, $ifNull ) + function IfNull( $field, $ifNull ) { return " ISNULL($field, $ifNull) "; // if MS SQL Server } - + function _insertid() { // SCOPE_IDENTITY() - // Returns the last IDENTITY value inserted into an IDENTITY column in - // the same scope. A scope is a module -- a stored procedure, trigger, - // function, or batch. Thus, two statements are in the same scope if + // Returns the last IDENTITY value inserted into an IDENTITY column in + // 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. return $this->GetOne($this->identitySQL); } - - + + function MetaForeignKeys($table, $owner=false, $upper=false) { global $ADODB_FETCH_MODE; - + $save = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; $table = $this->qstr(strtoupper($table)); - - $sql = + + $sql = "select object_name(constid) as constraint_name, col_name(fkeyid, fkey) as column_name, object_name(rkeyid) as referenced_table_name, @@ -92,20 +92,20 @@ from sysforeignkeys where upper(object_name(fkeyid)) = $table order by constraint_name, referenced_table_name, keyno"; - + $constraints =& $this->GetArray($sql); - + $ADODB_FETCH_MODE = $save; - + $arr = false; foreach($constraints as $constr) { //print_r($constr); - $arr[$constr[0]][$constr[2]][] = $constr[1].'='.$constr[3]; + $arr[$constr[0]][$constr[2]][] = $constr[1].'='.$constr[3]; } if (!$arr) return false; - + $arr2 = false; - + foreach($arr as $k => $v) { foreach($v as $a => $b) { if ($upper) $a = strtoupper($a); @@ -114,8 +114,8 @@ } return $arr2; } - - function &MetaTables($ttype=false,$showSchema=false,$mask=false) + + function &MetaTables($ttype=false,$showSchema=false,$mask=false) { if ($mask) {$this->debug=1; $save = $this->metaTablesSQL; @@ -123,49 +123,51 @@ $this->metaTablesSQL .= " AND name like $mask"; } $ret =& ADOConnection::MetaTables($ttype,$showSchema); - + if ($mask) { $this->metaTablesSQL = $save; } return $ret; } - + function &MetaColumns($table) { - return ADOConnection::MetaColumns($table); + $arr = ADOConnection::MetaColumns($table); + return $arr; } - + function _query($sql,$inputarr) { if (is_string($sql)) $sql = str_replace('||','+',$sql); return ADODB_odbc::_query($sql,$inputarr); } - + // "Stein-Aksel Basma" <basma-BS8E2O+W6VoXWF+eFR7m5Q@xxxxxxxxxxxxxxxx> // tested with MSSQL 2000 function &MetaPrimaryKeys($table) { global $ADODB_FETCH_MODE; - + $schema = ''; $this->_findschema($table,$schema); //if (!$schema) $schema = $this->database; - if ($schema) $schema = "and k.table_catalog like '$schema%'"; - + if ($schema) $schema = "and k.table_catalog like '$schema%'"; + $sql = "select distinct k.column_name,ordinal_position from information_schema.key_column_usage k, - information_schema.table_constraints tc + information_schema.table_constraints tc where tc.constraint_name = k.constraint_name and tc.constraint_type = 'PRIMARY KEY' and k.table_name = '$table' $schema order by ordinal_position "; - + $savem = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $a = $this->GetCol($sql); $ADODB_FETCH_MODE = $savem; - + if ($a && sizeof($a)>0) return $a; - return false; + $false = false; + return $false; } - + function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0) { if ($nrows > 0 && $offset <= 0) { @@ -174,16 +176,16 @@ $rs =& $this->Execute($sql,$inputarr); } else $rs =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); - + return $rs; } - + // Format date column in sql string given an input format that understands Y M D function SQLDate($fmt, $col=false) - { + { if (!$col) $col = $this->sysTimeStamp; $s = ''; - + $len = strlen($fmt); for ($i=0; $i < $len; $i++) { if ($s) $s .= '+'; @@ -210,11 +212,11 @@ case 'h': $s .= "substring(convert(char(14),$col,0),13,2)"; break; - + case 'H': $s .= "replace(str(datepart(hh,$col),2),' ','0')"; break; - + case 'i': $s .= "replace(str(datepart(mi,$col),2),' ','0')"; break; @@ -225,7 +227,7 @@ case 'A': $s .= "substring(convert(char(19),$col,0),18,2)"; break; - + default: if ($ch == '\\') { $i++; @@ -238,15 +240,15 @@ return $s; } -} - -class ADORecordSet_odbc_mssql extends ADORecordSet_odbc { - +} + +class ADORecordSet_odbc_mssql extends ADORecordSet_odbc { + var $databaseType = 'odbc_mssql'; - + function ADORecordSet_odbc_mssql($id,$mode=false) { return $this->ADORecordSet_odbc($id,$mode); - } + } } -?> +?> \ No newline at end of file Index: adodb-sqlanywhere.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-sqlanywhere.inc.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- adodb-sqlanywhere.inc.php 12 Feb 2005 20:01:27 -0000 1.6 +++ adodb-sqlanywhere.inc.php 22 Apr 2006 11:10:21 -0000 1.7 @@ -1,10 +1,10 @@ <?php -/* -version V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights +/* +version V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, - the BSD license will take precedence. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. Set tabs to 4 for best viewing. Latest version is available at http://adodb.sourceforge.net @@ -30,7 +30,7 @@ . 'VALUES (\'test\', ' . $blobVarName . ')'); - instead of loading blob from a file, you can also load from + instead of loading blob from a file, you can also load from an unformatted (raw) blob variable: $dbcon->load_blobvar_from_var($blobVarName, $varName); @@ -53,9 +53,9 @@ define('ADODB_SYBASE_SQLANYWHERE',1); class ADODB_sqlanywhere extends ADODB_odbc { - var $databaseType = "sqlanywhere"; + var $databaseType = "sqlanywhere"; var $hasInsertID = true; - + function ADODB_sqlanywhere() { $this->ADODB_odbc(); @@ -152,9 +152,9 @@ } }; //class - class ADORecordSet_sqlanywhere extends ADORecordSet_odbc { + class ADORecordSet_sqlanywhere extends ADORecordSet_odbc { - var $databaseType = "sqlanywhere"; + var $databaseType = "sqlanywhere"; function ADORecordSet_sqlanywhere($id,$mode=false) { Index: adodb-informix72.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-informix72.inc.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- adodb-informix72.inc.php 12 Feb 2005 20:01:25 -0000 1.5 +++ adodb-informix72.inc.php 22 Apr 2006 11:10:21 -0000 1.6 @@ -1,6 +1,6 @@ <?php /* -V4.54 5 Nov 2004 (c) 2000-2004 John Lim. All rights reserved. +V4.80 8 Mar 2006 (c) 2000-2006 John Lim. All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. @@ -28,10 +28,10 @@ var $hasInsertID = true; var $hasAffectedRows = true; var $substr = 'substr'; - var $metaTablesSQL="select tabname from systables where tabtype!=' ' and owner!='informix'"; //Don't get informix tables and pseudo-tables + var $metaTablesSQL="select tabname,tabtype from systables where tabtype in ('T','V') and owner!='informix'"; //Don't get informix tables and pseudo-tables - var $metaColumnsSQL = + var $metaColumnsSQL = "select c.colname, c.coltype, c.collength, d.default,c.colno from syscolumns c, systables t,outer sysdefaults d where c.tabid=t.tabid and d.tabid=t.tabid and d.colno=c.colno @@ -53,7 +53,7 @@ var $sysDate = 'TODAY'; var $sysTimeStamp = 'CURRENT'; var $cursorType = IFX_SCROLL; // IFX_SCROLL or IFX_HOLD or 0 - + function ADODB_informix72() { // alternatively, use older method: @@ -61,18 +61,18 @@ // force ISO date format putenv('GL_DATE=%Y-%m-%d'); - + if (function_exists('ifx_byteasvarchar')) { - ifx_byteasvarchar(1); // Mode "0" will return a blob id, and mode "1" will return a varchar with text content. - ifx_textasvarchar(1); // Mode "0" will return a blob id, and mode "1" will return a varchar with text content. + ifx_byteasvarchar(1); // Mode "0" will return a blob id, and mode "1" will return a varchar with text content. + ifx_textasvarchar(1); // Mode "0" will return a blob id, and mode "1" will return a varchar with text content. ifx_blobinfile_mode(0); // Mode "0" means save Byte-Blobs in memory, and mode "1" means save Byte-Blobs in a file. } } - + function ServerInfo() { if (isset($this->version)) return $this->version; - + $arr['description'] = $this->GetOne("select DBINFO('version','full') from systables where tabid = 1"); $arr['version'] = $this->GetOne("select DBINFO('version','major') || DBINFO('version','minor') from systables where tabid = 1"); $this->version = $arr; @@ -104,8 +104,8 @@ return true; } - function CommitTrans($ok=true) - { + function CommitTrans($ok=true) + { if (!$ok) return $this->RollbackTrans(); if ($this->transOff) return true; if ($this->transCnt) $this->transCnt -= 1; @@ -123,16 +123,16 @@ return true; } - function RowLock($tables,$where) + function RowLock($tables,$where,$flds='1 as ignore') { if ($this->_autocommit) $this->BeginTrans(); - return $this->GetOne("select 1 as ignore from $tables where $where for update"); + return $this->GetOne("select $flds from $tables where $where for update"); } /* Returns: the last error message from previous database operation Note: This function is NOT available for Microsoft SQL Server. */ - function ErrorMsg() + function ErrorMsg() { if (!empty($this->_logsql)) return $this->_errorMsg; $this->_errorMsg = ifx_errormsg(); @@ -141,16 +141,17 @@ function ErrorNo() { - preg_match("/.*SQLCODE=([^\]]*)/",ifx_error(),$parse); //!EOS - if (is_array($parse) && isset($parse[1])) return (int)$parse[1]; + preg_match("/.*SQLCODE=([^\]]*)/",ifx_error(),$parse); + if (is_array($parse) && isset($parse[1])) return (int)$parse[1]; return 0; } - + function &MetaColumns($table) { global $ADODB_FETCH_MODE; - + + $false = false; if (!empty($this->metaColumnsSQL)) { $save = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; @@ -158,16 +159,27 @@ $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table)); if (isset($savem)) $this->SetFetchMode($savem); $ADODB_FETCH_MODE = $save; - if ($rs === false) return false; + if ($rs === false) return $false; $rspkey = $this->Execute(sprintf($this->metaPrimaryKeySQL,$table)); //Added to get primary key colno items $retarr = array(); while (!$rs->EOF) { //print_r($rs->fields); $fld = new ADOFieldObject(); $fld->name = $rs->fields[0]; +/* //!eos. + $rs->fields[1] is not the correct adodb type + $rs->fields[2] is not correct max_length, because can include not-null bit + $fld->type = $rs->fields[1]; $fld->primary_key=$rspkey->fields && array_search($rs->fields[4],$rspkey->fields); //Added to set primary key flag - $fld->max_length = $rs->fields[2]; + $fld->max_length = $rs->fields[2];*/ + $pr=ifx_props($rs->fields[1],$rs->fields[2]); //!eos + $fld->type = $pr[0] ;//!eos + $fld->primary_key=$rspkey->fields && array_search($rs->fields[4],$rspkey->fields); + $fld->max_length = $pr[1]; //!eos + $fld->precision = $pr[2] ;//!eos + $fld->not_null = $pr[3]=="N"; //!eos + if (trim($rs->fields[3]) != "AAAAAA 0") { $fld->has_default = 1; $fld->default_value = $rs->fields[3]; @@ -175,22 +187,55 @@ $fld->has_default = 0; } - $retarr[strtolower($fld->name)] = $fld; + $retarr[strtolower($fld->name)] = $fld; $rs->MoveNext(); } $rs->Close(); - return $retarr; + $rspKey->Close(); //!eos + return $retarr; } - return false; + return $false; } - + function &xMetaColumns($table) { return ADOConnection::MetaColumns($table,false); } + function MetaForeignKeys($table, $owner=false, $upper=false) //!Eos + { + $sql = " + select tr.tabname,updrule,delrule, + i.part1 o1,i2.part1 d1,i.part2 o2,i2.part2 d2,i.part3 o3,i2.part3 d3,i.part4 o4,i2.part4 d4, + i.part5 o5,i2.part5 d5,i.part6 o6,i2.part6 d6,i.part7 o7,i2.part7 d7,i.part8 o8,i2.part8 d8 + from systables t,sysconstraints s,sysindexes i, + sysreferences r,systables tr,sysconstraints s2,sysindexes i2 + where t.tabname='$table' + and s.tabid=t.tabid and s.constrtype='R' and r.constrid=s.constrid + and i.idxname=s.idxname and tr.tabid=r.ptabid + and s2.constrid=r.primary and i2.idxname=s2.idxname"; + + $rs = $this->Execute($sql); + if (!$rs || $rs->EOF) return false; + $arr =& $rs->GetArray(); + $a = array(); + foreach($arr as $v) { + $coldest=$this->metaColumnNames($v["tabname"]); + $colorig=$this->metaColumnNames($table); + $colnames=array(); + for($i=1;$i<=8 && $v["o$i"] ;$i++) { + $colnames[]=$coldest[$v["d$i"]-1]."=".$colorig[$v["o$i"]-1]; + } + if($upper) + $a[strtoupper($v["tabname"])] = $colnames; + else + $a[$v["tabname"]] = $colnames; + } + return $a; + } + function UpdateBlob($table, $column, $val, $where, $blobtype = 'BLOB') { $type = ($blobtype == 'TEXT') ? 1 : 0; @@ -202,15 +247,15 @@ { return function_exists('ifx_byteasvarchar') ? $blobid : @ifx_get_blob($blobid); } - + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { if (!function_exists('ifx_connect')) return null; - + $dbs = $argDatabasename . "@" . $argHostname; - if ($argHostname) putenv("INFORMIXSERVER=$argHostname"); - putenv("INFORMIXSERVER=".trim($argHostname)); + if ($argHostname) putenv("INFORMIXSERVER=$argHostname"); + putenv("INFORMIXSERVER=".trim($argHostname)); $this->_connectionID = ifx_connect($dbs,$argUsername,$argPassword); if ($this->_connectionID === false) return false; #if ($argDatabasename) return $this->SelectDB($argDatabasename); @@ -221,9 +266,9 @@ function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { if (!function_exists('ifx_connect')) return null; - + $dbs = $argDatabasename . "@" . $argHostname; - putenv("INFORMIXSERVER=".trim($argHostname)); + putenv("INFORMIXSERVER=".trim($argHostname)); $this->_connectionID = ifx_pconnect($dbs,$argUsername,$argPassword); if ($this->_connectionID === false) return false; #if ($argDatabasename) return $this->SelectDB($argDatabasename); @@ -242,7 +287,7 @@ function _query($sql,$inputarr) { global $ADODB_COUNTRECS; - + // String parameters have to be converted using ifx_create_char if ($inputarr) { foreach($inputarr as $v) { @@ -303,7 +348,7 @@ function ADORecordset_informix72($id,$mode=false) { - if ($mode === false) { + if ($mode === false) { global $ADODB_FETCH_MODE; $mode = $ADODB_FETCH_MODE; } @@ -331,7 +376,8 @@ $o->not_null = $arr[4]=="N"; } } - return $this->_fieldprops[$fieldOffset]; + $ret = $this->_fieldprops[$fieldOffset]; + return $ret; } function _initrs() @@ -401,4 +447,29 @@ } } -?> +/** !Eos +* Auxiliar function to Parse coltype,collength. Used by Metacolumns +* return: array ($mtype,$length,$precision,$nullable) (similar to ifx_fieldpropierties) +*/ +function ifx_props($coltype,$collength){ + $itype=fmod($coltype+1,256); + $nullable=floor(($coltype+1) /256) ?"N":"Y"; + $mtype=substr(" CIIFFNNDN TBXCC ",$itype,1); + switch ($itype){ + case 2: + $length=4; + case 6: + case 9: + case 14: + $length=floor($collength/256); + $precision=fmod($collength,256); + break; + default: + $precision=0; + $length=$collength; + } + return array($mtype,$length,$precision,$nullable); +} + + +?> \ No newline at end of file Index: adodb-fbsql.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-fbsql.inc.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- adodb-fbsql.inc.php 12 Feb 2005 20:01:25 -0000 1.5 +++ adodb-fbsql.inc.php 22 Apr 2006 11:10:21 -0000 1.6 @@ -1,12 +1,12 @@ <?php /* - @version V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, - the BSD license will take precedence. - Contribution by Frank M. Kromann <frank-ahlAPTOT/CJl57MIdRCFDg@xxxxxxxxxxxxxxxx>. + @version V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + Contribution by Frank M. Kromann <frank-ahlAPTOT/CJl57MIdRCFDg@xxxxxxxxxxxxxxxx>. Set tabs to 8. -*/ +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -17,26 +17,26 @@ class ADODB_fbsql extends ADOConnection { var $databaseType = 'fbsql'; var $hasInsertID = true; - var $hasAffectedRows = true; - var $metaTablesSQL = "SHOW TABLES"; + var $hasAffectedRows = true; + var $metaTablesSQL = "SHOW TABLES"; var $metaColumnsSQL = "SHOW COLUMNS FROM %s"; var $fmtTimeStamp = "'Y-m-d H:i:s'"; var $hasLimit = false; - - function ADODB_fbsql() - { + + function ADODB_fbsql() + { } - + function _insertid() { return fbsql_insert_id($this->_connectionID); } - + function _affectedrows() { return fbsql_affected_rows($this->_connectionID); } - + function &MetaDatabases() { $qid = fbsql_list_dbs($this->_connectionID); @@ -61,39 +61,39 @@ if (sizeof($arr) > 0) return "CONCAT($s)"; else return ''; } - + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { $this->_connectionID = fbsql_connect($argHostname,$argUsername,$argPassword); if ($this->_connectionID === false) return false; if ($argDatabasename) return $this->SelectDB($argDatabasename); - return true; + return true; } - + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { $this->_connectionID = fbsql_pconnect($argHostname,$argUsername,$argPassword); if ($this->_connectionID === false) return false; if ($argDatabasename) return $this->SelectDB($argDatabasename); - return true; + return true; } - - function &MetaColumns($table) + + function &MetaColumns($table) { if ($this->metaColumnsSQL) { - + $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table)); - + if ($rs === false) return false; - + $retarr = array(); while (!$rs->EOF){ $fld = new ADOFieldObject(); $fld->name = $rs->fields[0]; $fld->type = $rs->fields[1]; - + // split type into type(length): if (preg_match("/^(.+)\((\d+)\)$/", $fld->type, $query_array)) { $fld->type = $query_array[1]; @@ -105,85 +105,86 @@ $fld->primary_key = ($rs->fields[3] == 'PRI'); $fld->auto_increment = (strpos($rs->fields[5], 'auto_increment') !== false); $fld->binary = (strpos($fld->type,'blob') !== false); - - $retarr[strtoupper($fld->name)] = $fld; + + $retarr[strtoupper($fld->name)] = $fld; $rs->MoveNext(); } $rs->Close(); - return $retarr; + return $retarr; } return false; } - + // returns true or false - function SelectDB($dbName) + function SelectDB($dbName) { - $this->databaseName = $dbName; + $this->database = $dbName; if ($this->_connectionID) { - return @fbsql_select_db($dbName,$this->_connectionID); + return @fbsql_select_db($dbName,$this->_connectionID); } - else return false; + else return false; } - - + + // returns queryID or false function _query($sql,$inputarr) { return fbsql_query("$sql;",$this->_connectionID); } - /* Returns: the last error message from previous database operation */ - function ErrorMsg() + /* Returns: the last error message from previous database operation */ + function ErrorMsg() { $this->_errorMsg = @fbsql_error($this->_connectionID); return $this->_errorMsg; } - - /* Returns: the last error number from previous database operation */ - function ErrorNo() + + /* Returns: the last error number from previous database operation */ + function ErrorNo() { return @fbsql_errno($this->_connectionID); } - + // returns true or false function _close() { return @fbsql_close($this->_connectionID); } - + } - + /*-------------------------------------------------------------------------------------- Class Name: Recordset --------------------------------------------------------------------------------------*/ -class ADORecordSet_fbsql extends ADORecordSet{ - +class ADORecordSet_fbsql extends ADORecordSet{ + var $databaseType = "fbsql"; var $canSeek = true; - - function ADORecordSet_fbsql($queryID,$mode=false) + + function ADORecordSet_fbsql($queryID,$mode=false) { - if (!$mode) { + if (!$mode) { global $ADODB_FETCH_MODE; $mode = $ADODB_FETCH_MODE; } switch ($mode) { case ADODB_FETCH_NUM: $this->fetchMode = FBSQL_NUM; break; - default: - case ADODB_FETCH_BOTH: $this->fetchMode = FBSQL_BOTH; break; case ADODB_FETCH_ASSOC: $this->fetchMode = FBSQL_ASSOC; break; + case ADODB_FETCH_BOTH: + default: + $this->fetchMode = FBSQL_BOTH; break; } return $this->ADORecordSet($queryID); } - + function _initrs() { GLOBAL $ADODB_COUNTRECS; $this->_numOfRows = ($ADODB_COUNTRECS) ? @fbsql_num_rows($this->_queryID):-1; $this->_numOfFields = @fbsql_num_fields($this->_queryID); } - + function &FetchField($fieldOffset = -1) { @@ -197,25 +198,25 @@ $o = @fbsql_fetch_field($this->_queryID);// fbsql returns the max length less spaces -- so it is unrealiable //$o->max_length = -1; } - + return $o; } - + function _seek($row) { return @fbsql_data_seek($this->_queryID,$row); } - + function _fetch($ignore_fields=false) { $this->fields = @fbsql_fetch_array($this->_queryID,$this->fetchMode); return ($this->fields == true); } - + function _close() { - return @fbsql_free_result($this->_queryID); + return @fbsql_free_result($this->_queryID); } - + function MetaType($t,$len=-1,$fieldobj=false) { if (is_object($t)) { @@ -226,40 +227,40 @@ $len = -1; // fbsql max_length is not accurate switch (strtoupper($t)) { case 'CHARACTER': - case 'CHARACTER VARYING': - case 'BLOB': - case 'CLOB': - case 'BIT': - case 'BIT VARYING': + case 'CHARACTER VARYING': + case 'BLOB': + case 'CLOB': + case 'BIT': + case 'BIT VARYING': if ($len <= $this->blobSize) return 'C'; - + // so we have to check whether binary... case 'IMAGE': - case 'LONGBLOB': + case 'LONGBLOB': case 'BLOB': case 'MEDIUMBLOB': return !empty($fieldobj->binary) ? 'B' : 'X'; - + case 'DATE': return 'D'; - + case 'TIME': case 'TIME WITH TIME ZONE': - case 'TIMESTAMP': + case 'TIMESTAMP': case 'TIMESTAMP WITH TIME ZONE': return 'T'; - + case 'PRIMARY_KEY': return 'R'; case 'INTEGER': - case 'SMALLINT': + case 'SMALLINT': case 'BOOLEAN': - + if (!empty($fieldobj->primary_key)) return 'R'; else return 'I'; - + default: return 'N'; } } } //class } // defined -?> +?> \ No newline at end of file Index: adodb-vfp.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-vfp.inc.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- adodb-vfp.inc.php 12 Feb 2005 20:01:27 -0000 1.5 +++ adodb-vfp.inc.php 22 Apr 2006 11:10:21 -0000 1.6 @@ -1,13 +1,13 @@ <?php -/* -V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, - the BSD license will take precedence. +/* +V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. Set tabs to 4 for best viewing. - + Latest version is available at http://adodb.sourceforge.net - + Microsoft Visual FoxPro data driver. Requires ODBC. Works only on MS Windows. */ @@ -20,7 +20,7 @@ if (!defined('ADODB_VFP')){ define('ADODB_VFP',1); class ADODB_vfp extends ADODB_odbc { - var $databaseType = "vfp"; + var $databaseType = "vfp"; var $fmtDate = "{^Y-m-d}"; var $fmtTimeStamp = "{^Y-m-d, h:i:sA}"; var $replaceQuote = "'+chr(39)+'" ; @@ -33,19 +33,19 @@ var $ansiOuter = true; var $hasTransactions = false; var $curmode = false ; // See sqlext.h, SQL_CUR_DEFAULT == SQL_CUR_USE_DRIVER == 2L - + function ADODB_vfp() { $this->ADODB_odbc(); } - + function Time() { return time(); } - + function BeginTrans() { return false;} - + // quote string to be sent back to database function qstr($s,$nofixquotes=false) { @@ -53,24 +53,25 @@ return "'".$s."'"; } - + // TOP requires ORDER BY for VFP function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0) { $this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is',$sql) ? 'top' : false; - return ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); + $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); + return $ret; } - + }; + +class ADORecordSet_vfp extends ADORecordSet_odbc { + + var $databaseType = "vfp"; -class ADORecordSet_vfp extends ADORecordSet_odbc { - - var $databaseType = "vfp"; - - + function ADORecordSet_vfp($id,$mode=false) { return $this->ADORecordSet_odbc($id,$mode); @@ -88,19 +89,19 @@ if ($len <= $this->blobSize) return 'C'; case 'M': return 'X'; - + case 'D': return 'D'; - + case 'T': return 'T'; - + case 'L': return 'L'; - + case 'I': return 'I'; - + default: return 'N'; } } } } //define -?> +?> \ No newline at end of file Index: adodb-sapdb.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-sapdb.inc.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- adodb-sapdb.inc.php 12 Feb 2005 20:01:26 -0000 1.3 +++ adodb-sapdb.inc.php 22 Apr 2006 11:10:21 -0000 1.4 @@ -1,13 +1,13 @@ <?php -/* -V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, - the BSD license will take precedence. +/* +V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. Set tabs to 4 for best viewing. - + Latest version is available at http://adodb.sourceforge.net - + SAPDB data driver. Requires ODBC. */ @@ -22,7 +22,7 @@ define('ADODB_SAPDB',1); class ADODB_SAPDB extends ADODB_odbc { - var $databaseType = "sapdb"; + var $databaseType = "sapdb"; var $concat_operator = '||'; var $sysDate = 'DATE'; var $sysTimeStamp = 'TIMESTAMP'; @@ -30,13 +30,13 @@ var $fmtTimeStamp = "'Y-m-d H:i:s'"; /// used by DBTimeStamp as the default timestamp fmt. var $hasInsertId = true; var $_bindInputArray = true; - + function ADODB_SAPDB() { //if (strncmp(PHP_OS,'WIN',3) === 0) $this->curmode = SQL_CUR_USE_ODBC; $this->ADODB_odbc(); } - + function ServerInfo() { $info = ADODB_odbc::ServerInfo(); @@ -52,7 +52,7 @@ return $this->GetCol("SELECT columnname FROM COLUMNS WHERE tablename=$table AND mode='KEY' ORDER BY pos"); } - + function &MetaIndexes ($table, $primary = FALSE) { $table = $this->Quote(strtoupper($table)); @@ -67,7 +67,7 @@ if ($this->fetchMode !== FALSE) { $savem = $this->SetFetchMode(FALSE); } - + $rs = $this->Execute($sql); if (isset($savem)) { $this->SetFetchMode($savem); @@ -91,7 +91,7 @@ } return $indexes; } - + function &MetaColumns ($table) { global $ADODB_FETCH_MODE; @@ -101,7 +101,7 @@ $savem = $this->SetFetchMode(FALSE); } $table = $this->Quote(strtoupper($table)); - + $retarr = array(); foreach($this->GetAll("SELECT COLUMNNAME,DATATYPE,LEN,DEC,NULLABLE,MODE,\"DEFAULT\",CASE WHEN \"DEFAULT\" IS NULL THEN 0 ELSE 1 END AS HAS_DEFAULT FROM COLUMNS WHERE tablename=$table ORDER BY pos") as $column) { @@ -130,7 +130,7 @@ } } } - $retarr[$fld->name] = $fld; + $retarr[$fld->name] = $fld; } if (isset($savem)) { $this->SetFetchMode($savem); @@ -139,14 +139,14 @@ return $retarr; } - + function MetaColumnNames($table) { $table = $this->Quote(strtoupper($table)); return $this->GetCol("SELECT columnname FROM COLUMNS WHERE tablename=$table ORDER BY pos"); } - + // unlike it seems, this depends on the db-session and works in a multiuser environment function _insertid($table,$column) { @@ -155,25 +155,25 @@ /* SelectLimit implementation problems: - + The following will return random 10 rows as order by performed after "WHERE rowno<10" which is not ideal... - + select * from table where rowno < 10 order by 1 - + This means that we have to use the adoconnection base class SelectLimit when there is an "order by". - + See http://listserv.sap.com/pipermail/sapdb.general/2002-January/010405.html */ - + }; + - -class ADORecordSet_sapdb extends ADORecordSet_odbc { - - var $databaseType = "sapdb"; - +class ADORecordSet_sapdb extends ADORecordSet_odbc { + + var $databaseType = "sapdb"; + function ADORecordSet_sapdb($id,$mode=false) { $this->ADORecordSet_odbc($id,$mode); @@ -181,4 +181,4 @@ } } //define -?> +?> \ No newline at end of file Index: adodb-odbc.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-odbc.inc.php,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- adodb-odbc.inc.php 12 Feb 2005 20:01:26 -0000 1.7 +++ adodb-odbc.inc.php 22 Apr 2006 11:10:21 -0000 1.8 @@ -1,26 +1,26 @@ <?php -/* -V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, - the BSD license will take precedence. +/* +V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. Set tabs to 4 for best viewing. - + Latest version is available at http://adodb.sourceforge.net - + Requires ODBC. Works on Windows and Unix. */ // security - hide paths if (!defined('ADODB_DIR')) die(); define("_ADODB_ODBC_LAYER", 2 ); - + /*-------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------*/ class ADODB_odbc extends ADOConnection { - var $databaseType = "odbc"; + var $databaseType = "odbc"; var $fmtDate = "'Y-m-d'"; var $fmtTimeStamp = "'Y-m-d, h:i:sA'"; var $replaceQuote = "''"; // string to use to replace quotes @@ -30,7 +30,7 @@ var $useFetchArray = false; // setting this to true will make array elements in FETCH_ASSOC mode case-sensitive // breaking backward-compat //var $longreadlen = 8000; // default number of chars to return for a Blob/Long field - var $_bindInputArray = false; + var $_bindInputArray = false; var $curmode = SQL_CUR_USE_DRIVER; // See sqlext.h, SQL_CUR_DEFAULT == SQL_CUR_USE_DRIVER == 2L var $_genSeqSQL = "create table %s (id integer)"; var $_autocommit = true; @@ -38,20 +38,20 @@ var $_has_stupid_odbc_fetch_api_change = true; var $_lastAffectedRows = 0; var $uCaseTables = true; // for meta* functions, uppercase table names - - function ADODB_odbc() - { + + function ADODB_odbc() + { $this->_haserrorfunctions = ADODB_PHPVER >= 0x4050; $this->_has_stupid_odbc_fetch_api_change = ADODB_PHPVER >= 0x4200; } - + // returns true or false function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; - + if (!function_exists('odbc_connect')) return null; - + if ($this->debug && $argDatabasename && $this->databaseType != 'vfp') { ADOConnection::outp("For odbc Connect(), $argDatabasename is not used. Place dsn in 1st parameter."); } @@ -60,17 +60,17 @@ else $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,$this->curmode); $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; if (isset($this->connectStmt)) $this->Execute($this->connectStmt); - + return $this->_connectionID != false; } - + // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; - + if (!function_exists('odbc_connect')) return null; - + if (isset($php_errormsg)) $php_errormsg = ''; $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; if ($this->debug && $argDatabasename) { @@ -79,27 +79,27 @@ // print "dsn=$argDSN u=$argUsername p=$argPassword<br>"; flush(); if ($this->curmode === false) $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword); else $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,$this->curmode); - + $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; if ($this->_connectionID && $this->autoRollback) @odbc_rollback($this->_connectionID); if (isset($this->connectStmt)) $this->Execute($this->connectStmt); - + return $this->_connectionID != false; } - + function ServerInfo() { - + if (!empty($this->host) && ADODB_PHPVER >= 0x4300) { $dsn = strtoupper($this->host); $first = true; $found = false; - + if (!function_exists('odbc_data_source')) return false; - + while(true) { - + $rez = @odbc_data_source($this->_connectionID, $first ? SQL_FETCH_FIRST : SQL_FETCH_NEXT); $first = false; @@ -108,7 +108,7 @@ $found = true; break; } - } + } if (!$found) return ADOConnection::ServerInfo(); if (!isset($rez['version'])) $rez['version'] = ''; return $rez; @@ -117,7 +117,7 @@ } } - + function CreateSequence($seqname='adodbseq',$start=1) { if (empty($this->_genSeqSQL)) return false; @@ -126,22 +126,22 @@ $start -= 1; return $this->Execute("insert into $seqname values($start)"); } - + var $_dropSeqSQL = 'drop table %s'; function DropSequence($seqname) { if (empty($this->_dropSeqSQL)) return false; return $this->Execute(sprintf($this->_dropSeqSQL,$seqname)); } - + /* This algorithm is not very efficient, but works even if table locking is not available. - + Will return false if unable to generate an ID after $MAXLOOPS attempts. */ function GenID($seq='adodbseq',$start=1) - { + { // if you have to modify the parameter below, your database is overloaded, // or you need to implement generation of id's yourself! $MAXLOOPS = 100; @@ -149,14 +149,14 @@ while (--$MAXLOOPS>=0) { $num = $this->GetOne("select id from $seq"); if ($num === false) { - $this->Execute(sprintf($this->_genSeqSQL ,$seq)); + $this->Execute(sprintf($this->_genSeqSQL ,$seq)); $start -= 1; $num = '0'; $ok = $this->Execute("insert into $seq values($start)"); if (!$ok) return false; - } + } $this->Execute("update $seq set id=id+1 where id=$num"); - + if ($this->affected_rows() > 0) { $num += 1; $this->genID = $num; @@ -178,40 +178,40 @@ return @odbc_errormsg($this->_connectionID); } else return ADOConnection::ErrorMsg(); } - + function ErrorNo() { - + if ($this->_haserrorfunctions) { if ($this->_errorCode !== false) { // bug in 4.0.6, error number can be corrupted string (should be 6 digits) return (strlen($this->_errorCode)<=2) ? 0 : $this->_errorCode; } - if (empty($this->_connectionID)) $e = @odbc_error(); + if (empty($this->_connectionID)) $e = @odbc_error(); else $e = @odbc_error($this->_connectionID); - + // bug in 4.0.6, error number can be corrupted string (should be 6 digits) // so we check and patch if (strlen($e)<=2) return 0; return $e; } else return ADOConnection::ErrorNo(); } - - + + function BeginTrans() - { + { if (!$this->hasTransactions) return false; - if ($this->transOff) return true; + if ($this->transOff) return true; $this->transCnt += 1; $this->_autocommit = false; return odbc_autocommit($this->_connectionID,false); } - - function CommitTrans($ok=true) - { - if ($this->transOff) return true; + + function CommitTrans($ok=true) + { + if ($this->transOff) return true; if (!$ok) return $this->RollbackTrans(); if ($this->transCnt) $this->transCnt -= 1; $this->_autocommit = true; @@ -219,21 +219,21 @@ odbc_autocommit($this->_connectionID,true); return $ret; } - + function RollbackTrans() { - if ($this->transOff) return true; + if ($this->transOff) return true; if ($this->transCnt) $this->transCnt -= 1; $this->_autocommit = true; $ret = odbc_rollback($this->_connectionID); odbc_autocommit($this->_connectionID,true); return $ret; } - + function MetaPrimaryKeys($table) { global $ADODB_FETCH_MODE; - + if ($this->uCaseTables) $table = strtoupper($table); $schema = ''; $this->_findschema($table,$schema); @@ -241,17 +241,17 @@ $savem = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; $qid = @odbc_primarykeys($this->_connectionID,'',$schema,$table); - + if (!$qid) { $ADODB_FETCH_MODE = $savem; return false; } $rs = new ADORecordSet_odbc($qid); $ADODB_FETCH_MODE = $savem; - + if (!$rs) return false; $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change; - + $arr =& $rs->GetArray(); $rs->Close(); //print_r($arr); @@ -261,39 +261,39 @@ } return $arr2; } - - - + + + function &MetaTables($ttype=false) { global $ADODB_FETCH_MODE; - + $savem = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; $qid = odbc_tables($this->_connectionID); - + $rs = new ADORecordSet_odbc($qid); - + $ADODB_FETCH_MODE = $savem; if (!$rs) { $false = false; return $false; } $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change; - + $arr =& $rs->GetArray(); //print_r($arr); - + $rs->Close(); $arr2 = array(); - + if ($ttype) { $isview = strncmp($ttype,'V',1) === 0; } for ($i=0; $i < sizeof($arr); $i++) { if (!$arr[$i][2]) continue; $type = $arr[$i][3]; - if ($ttype) { + if ($ttype) { if ($isview) { if (strncmp($type,'V',1) === 0) $arr2[] = $arr[$i][2]; } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $arr[$i][2]; @@ -301,7 +301,7 @@ } return $arr2; } - + /* See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcdatetime_data_type_changes.asp / SQL data type codes / @@ -333,7 +333,7 @@ function ODBCTypes($t) { switch ((integer)$t) { - case 1: + case 1: case 12: case 0: case -95: @@ -344,52 +344,52 @@ return 'X'; case -4: //image return 'B'; - - case 9: + + case 9: case 91: return 'D'; - + case 10: case 11: case 92: case 93: return 'T'; - + case 4: case 5: case -6: return 'I'; - + case -11: // uniqidentifier return 'R'; case -7: //bit return 'L'; - + default: return 'N'; } } - + function &MetaColumns($table) { global $ADODB_FETCH_MODE; - + $false = false; if ($this->uCaseTables) $table = strtoupper($table); $schema = ''; $this->_findschema($table,$schema); - + $savem = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; - + /*if (false) { // after testing, confirmed that the following does not work becoz of a bug $qid2 = odbc_tables($this->_connectionID); - $rs = new ADORecordSet_odbc($qid2); + $rs = new ADORecordSet_odbc($qid2); $ADODB_FETCH_MODE = $savem; if (!$rs) return false; $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change; $rs->_fetch(); - + while (!$rs->EOF) { if ($table == strtoupper($rs->fields[2])) { $q = $rs->fields[0]; @@ -399,38 +399,38 @@ $rs->MoveNext(); } $rs->Close(); - + $qid = odbc_columns($this->_connectionID,$q,$o,strtoupper($table),'%'); } */ - + switch ($this->databaseType) { case 'access': case 'vfp': $qid = odbc_columns($this->_connectionID);#,'%','',strtoupper($table),'%'); break; - - + + case 'db2': $colname = "%"; $qid = odbc_columns($this->_connectionID, "", $schema, $table, $colname); break; - + default: $qid = @odbc_columns($this->_connectionID,'%','%',strtoupper($table),'%'); if (empty($qid)) $qid = odbc_columns($this->_connectionID); break; } if (empty($qid)) return $false; - + $rs =& new ADORecordSet_odbc($qid); $ADODB_FETCH_MODE = $savem; - + if (!$rs) return $false; $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change; $rs->_fetch(); - + $retarr = array(); - + /* $rs->fields indices 0 TABLE_QUALIFIER @@ -452,30 +452,31 @@ $fld = new ADOFieldObject(); $fld->name = $rs->fields[3]; $fld->type = $this->ODBCTypes($rs->fields[4]); - + // ref: http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraccgen/html/msdn_odk.asp // access uses precision to store length for char/varchar if ($fld->type == 'C' or $fld->type == 'X') { - if ($this->databaseType == 'access') + if ($this->databaseType == 'access') $fld->max_length = $rs->fields[6]; else if ($rs->fields[4] <= -95) // UNICODE $fld->max_length = $rs->fields[7]/2; else $fld->max_length = $rs->fields[7]; - } else + } else $fld->max_length = $rs->fields[7]; $fld->not_null = !empty($rs->fields[10]); $fld->scale = $rs->fields[8]; - $retarr[strtoupper($fld->name)] = $fld; + $retarr[strtoupper($fld->name)] = $fld; } else if (sizeof($retarr)>0) break; $rs->MoveNext(); } $rs->Close(); //-- crashes 4.03pl1 -- why? - - return empty($retarr) ? $false : $retarr; + + if (empty($retarr)) $retarr = false; + return $retarr; } - + function Prepare($sql) { if (! $this->_bindInputArray) return $sql; // no binding @@ -488,24 +489,24 @@ } /* returns queryID or false */ - function _query($sql,$inputarr=false) + function _query($sql,$inputarr=false) { GLOBAL $php_errormsg; if (isset($php_errormsg)) $php_errormsg = ''; $this->_error = ''; - + if ($inputarr) { if (is_array($sql)) { $stmtid = $sql[1]; } else { $stmtid = odbc_prepare($this->_connectionID,$sql); - + if ($stmtid == false) { $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; return false; } } - + if (! odbc_execute($stmtid,$inputarr)) { //@odbc_free_result($stmtid); if ($this->_haserrorfunctions) { @@ -514,7 +515,7 @@ } return false; } - + } else if (is_array($sql)) { $stmtid = $sql[1]; if (!odbc_execute($stmtid)) { @@ -527,7 +528,7 @@ } } else $stmtid = odbc_exec($this->_connectionID,$sql); - + $this->_lastAffectedRows = 0; if ($stmtid) { if (@odbc_num_fields($stmtid) == 0) { @@ -538,7 +539,7 @@ odbc_binmode($stmtid,$this->binmode); odbc_longreadlen($stmtid,$this->maxblobsize); } - + if ($this->_haserrorfunctions) { $this->_errorMsg = ''; $this->_errorCode = 0; @@ -557,9 +558,9 @@ /* Insert a null into the blob field of the table first. Then use UpdateBlob to store the blob. - + Usage: - + $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)'); $conn->UpdateBlob('blobtable','blobcol',$blob,'id=1'); */ @@ -567,7 +568,7 @@ { return $this->Execute("UPDATE $table SET $column=? WHERE $where",array($val)) != false; } - + // returns true or false function _close() { @@ -580,31 +581,31 @@ { return $this->_lastAffectedRows; } - + } - + /*-------------------------------------------------------------------------------------- Class Name: Recordset --------------------------------------------------------------------------------------*/ -class ADORecordSet_odbc extends ADORecordSet { - +class ADORecordSet_odbc extends ADORecordSet { + var $bind = false; - var $databaseType = "odbc"; + var $databaseType = "odbc"; var $dataProvider = "odbc"; var $useFetchArray; var $_has_stupid_odbc_fetch_api_change; - + function ADORecordSet_odbc($id,$mode=false) { - if ($mode === false) { + if ($mode === false) { global $ADODB_FETCH_MODE; $mode = $ADODB_FETCH_MODE; } $this->fetchMode = $mode; - + $this->_queryID = $id; - + // the following is required for mysql odbc driver in 4.3.1 -- why? $this->EOF = false; $this->_currentRow = -1; @@ -613,11 +614,11 @@ // returns the field object - function &FetchField($fieldOffset = -1) + function &FetchField($fieldOffset = -1) { - + $off=$fieldOffset+1; // offsets begin at 1 - + $o= new ADOFieldObject(); $o->name = @odbc_field_name($this->_queryID,$off); $o->type = @odbc_field_type($this->_queryID,$off); @@ -626,7 +627,7 @@ else if (ADODB_ASSOC_CASE == 1) $o->name = strtoupper($o->name); return $o; } - + /* Use associative array to get fields array */ function Fields($colname) { @@ -641,8 +642,8 @@ return $this->fields[$this->bind[strtoupper($colname)]]; } - - + + function _initrs() { global $ADODB_COUNTRECS; @@ -652,15 +653,15 @@ if ($this->_numOfRows == 0) $this->_numOfRows = -1; //$this->useFetchArray = $this->connection->useFetchArray; $this->_has_stupid_odbc_fetch_api_change = ADODB_PHPVER >= 0x4200; - } - + } + function _seek($row) { return false; } - + // speed up SelectLimit() by switching to ADODB_FETCH_NUM as ADODB_FETCH_ASSOC is emulated - function &GetArrayLimit($nrows,$offset=-1) + function &GetArrayLimit($nrows,$offset=-1) { if ($offset <= 0) { $rs =& $this->GetArray($nrows); @@ -670,27 +671,27 @@ $this->fetchMode = ADODB_FETCH_NUM; $this->Move($offset); $this->fetchMode = $savem; - + if ($this->fetchMode & ADODB_FETCH_ASSOC) { $this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE); } - + $results = array(); $cnt = 0; while (!$this->EOF && $nrows != $cnt) { $results[$cnt++] = $this->fields; $this->MoveNext(); } - + return $results; } - - - function MoveNext() + + + function MoveNext() { - if ($this->_numOfRows != 0 && !$this->EOF) { + if ($this->_numOfRows != 0 && !$this->EOF) { $this->_currentRow++; - + if ($this->_has_stupid_odbc_fetch_api_change) $rez = @odbc_fetch_into($this->_queryID,$this->fields); else { @@ -707,13 +708,13 @@ $this->fields = false; $this->EOF = true; return false; - } - + } + function _fetch() { if ($this->_has_stupid_odbc_fetch_api_change) - $rez = @odbc_fetch_into($this->_queryID,$this->fields,$row); + $rez = @odbc_fetch_into($this->_queryID,$this->fields); else { $row = 0; $rez = @odbc_fetch_into($this->_queryID,$row,$this->fields); @@ -727,12 +728,11 @@ $this->fields = false; return false; } - - function _close() + + function _close() { - return @odbc_free_result($this->_queryID); + return @odbc_free_result($this->_queryID); } } - -?> +?> \ No newline at end of file Index: adodb-odbtp.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-odbtp.inc.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- adodb-odbtp.inc.php 12 Feb 2005 20:01:26 -0000 1.3 +++ adodb-odbtp.inc.php 22 Apr 2006 11:10:21 -0000 1.4 @@ -1,6 +1,6 @@ <?php /* - V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. + V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. @@ -164,7 +164,7 @@ $this->odbc_driver = @odbtp_get_attr(ODB_ATTR_DRIVER, $this->_connectionID); $dbms = strtolower(@odbtp_get_attr(ODB_ATTR_DBMSNAME, $this->_connectionID)); $this->odbc_name = $dbms; - + // Account for inconsistent DBMS names if( $this->odbc_driver == ODB_DRIVER_ORACLE ) $dbms = 'oracle'; @@ -264,10 +264,11 @@ if (!@odbtp_select_db($dbName, $this->_connectionID)) { return false; } - $this->databaseName = $dbName; + $this->database = $dbName; + $this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions return true; } - + function &MetaTables($ttype='',$showSchema=false,$mask=false) { global $ADODB_FETCH_MODE; @@ -275,9 +276,9 @@ $savem = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; if ($this->fetchMode !== false) $savefm = $this->SetFetchMode(false); - + $arr =& $this->GetArray("||SQLTables||||$ttype"); - + if (isset($savefm)) $this->SetFetchMode($savefm); $ADODB_FETCH_MODE = $savem; @@ -289,7 +290,7 @@ } return $arr2; } - + function &MetaColumns($table,$upper=true) { global $ADODB_FETCH_MODE; @@ -301,9 +302,9 @@ $savem = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; if ($this->fetchMode !== false) $savefm = $this->SetFetchMode(false); - + $rs = $this->Execute( "||SQLColumns||$schema|$table" ); - + if (isset($savefm)) $this->SetFetchMode($savefm); $ADODB_FETCH_MODE = $savem; @@ -311,6 +312,7 @@ $false = false; return $false; } + $retarr = array(); while (!$rs->EOF) { //print_r($rs->fields); if (strtoupper($rs->fields[2]) == $table) { @@ -325,7 +327,7 @@ $fld->default_value = $rs->fields[12]; } $retarr[strtoupper($fld->name)] = $fld; - } else if (sizeof($retarr)>0) + } else if (!empty($retarr)) break; $rs->MoveNext(); } @@ -369,7 +371,7 @@ $false = false; return $false; } - + $arr2 = array(); foreach($arr as $k => $v) { @@ -423,7 +425,8 @@ if( $this->odbc_driver == ODB_DRIVER_FOXPRO ) { if (!preg_match('/ORDER[ \t\r\n]+BY/is',$sql)) $sql .= ' ORDER BY 1'; } - return ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); + $ret =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); + return $ret; } function Prepare($sql) @@ -516,6 +519,8 @@ function _query($sql,$inputarr=false) { + global $php_errormsg; + if ($inputarr) { if (is_array($sql)) { $stmtid = $sql[1]; Index: adodb-csv.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-csv.inc.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- adodb-csv.inc.php 12 Feb 2005 20:01:25 -0000 1.5 +++ adodb-csv.inc.php 22 Apr 2006 11:10:21 -0000 1.6 @@ -1,15 +1,19 @@ <?php /* -V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, +V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Set tabs to 4. - + Currently unsupported: MetaDatabases, MetaTables and MetaColumns, and also inputarr in Execute. Native types have been converted to MetaTypes. Transactions not supported yet. -*/ + + Limitation of url length. For IIS, see MaxClientRequestBuffer registry value. + + http://support.microsoft.com/default.aspx?scid=kb;en-us;260694 +*/ // security - hide paths if (!defined('ADODB_DIR')) die(); @@ -18,12 +22,12 @@ define("_ADODB_CSV_LAYER", 1 ); include_once(ADODB_DIR.'/adodb-csvlib.inc.php'); - + class ADODB_csv extends ADOConnection { var $databaseType = 'csv'; var $databaseProvider = 'csv'; var $hasInsertID = true; - var $hasAffectedRows = true; + var $hasAffectedRows = true; var $fmtTimeStamp = "'Y-m-d H:i:s'"; var $_affectedrows=0; var $_insertid=0; @@ -31,35 +35,35 @@ var $replaceQuote = "''"; // string to use to replace quotes var $hasTransactions = false; var $_errorNo = false; - - function ADODB_csv() - { + + function ADODB_csv() + { } - + function _insertid() { return $this->_insertid; } - + function _affectedrows() { return $this->_affectedrows; } - + function &MetaDatabases() { return false; } - + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { if (strtolower(substr($argHostname,0,7)) !== 'http://') return false; $this->_url = $argHostname; - return true; + return true; } - + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { @@ -67,24 +71,24 @@ $this->_url = $argHostname; return true; } - - function &MetaColumns($table) + + function &MetaColumns($table) { return false; } - - + + // parameters use PostgreSQL convention, not MySQL function &SelectLimit($sql,$nrows=-1,$offset=-1) { global $ADODB_FETCH_MODE; - + $url = $this->_url.'?sql='.urlencode($sql)."&nrows=$nrows&fetch=". (($this->fetchMode !== false)?$this->fetchMode : $ADODB_FETCH_MODE). "&offset=$offset"; $err = false; $rs = csv2rs($url,$err,false); - + if ($this->debug) print "$url<br><i>$err</i><br>"; $at = strpos($err,'::::'); @@ -95,25 +99,25 @@ $this->_errorMsg = substr($err,$at+4,1024); $this->_errorNo = -9999; } - if ($this->_errorNo) + if ($this->_errorNo) if ($fn = $this->raiseErrorFn) { $fn($this->databaseType,'EXECUTE',$this->ErrorNo(),$this->ErrorMsg(),$sql,''); } - - if (is_object($rs)) { - - $rs->databaseType='csv'; + + if (is_object($rs)) { + + $rs->databaseType='csv'; $rs->fetchMode = ($this->fetchMode !== false) ? $this->fetchMode : $ADODB_FETCH_MODE; $rs->connection = &$this; } return $rs; } - + // returns queryID or false function &_Execute($sql,$inputarr=false) { global $ADODB_FETCH_MODE; - + if (!$this->_bindInputArray && $inputarr) { $sqlarr = explode('?',$sql); $sql = ''; @@ -128,37 +132,37 @@ else $sql .= $v; $i += 1; - + } $sql .= $sqlarr[$i]; - if ($i+1 != sizeof($sqlarr)) + if ($i+1 != sizeof($sqlarr)) print "Input Array does not match ?: ".htmlspecialchars($sql); $inputarr = false; } - + $url = $this->_url.'?sql='.urlencode($sql)."&fetch=". (($this->fetchMode !== false)?$this->fetchMode : $ADODB_FETCH_MODE); $err = false; - - + + $rs = csv2rs($url,$err,false); if ($this->debug) print urldecode($url)."<br><i>$err</i><br>"; $at = strpos($err,'::::'); - if ($at === false) { + if ($at === false) { $this->_errorMsg = $err; $this->_errorNo = (integer)$err; } else { $this->_errorMsg = substr($err,$at+4,1024); $this->_errorNo = -9999; } - - if ($this->_errorNo) + + if ($this->_errorNo) if ($fn = $this->raiseErrorFn) { $fn($this->databaseType,'EXECUTE',$this->ErrorNo(),$this->ErrorMsg(),$sql,$inputarr); } if (is_object($rs)) { $rs->fetchMode = ($this->fetchMode !== false) ? $this->fetchMode : $ADODB_FETCH_MODE; - + $this->_affectedrows = $rs->affectedrows; $this->_insertid = $rs->insertid; $rs->databaseType='csv'; @@ -167,18 +171,18 @@ return $rs; } - /* Returns: the last error message from previous database operation */ - function ErrorMsg() + /* Returns: the last error message from previous database operation */ + function ErrorMsg() { return $this->_errorMsg; } - - /* Returns: the last error number from previous database operation */ - function ErrorNo() + + /* Returns: the last error number from previous database operation */ + function ErrorNo() { return $this->_errorNo; } - + // returns true or false function _close() { @@ -191,7 +195,7 @@ { $this->ADORecordset($id,$mode); } - + function _close() { return true; @@ -199,5 +203,5 @@ } } // define - -?> + +?> \ No newline at end of file Index: adodb-mysqli.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-mysqli.inc.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- adodb-mysqli.inc.php 12 Feb 2005 20:01:26 -0000 1.3 +++ adodb-mysqli.inc.php 22 Apr 2006 11:10:21 -0000 1.4 @@ -1,23 +1,27 @@ <?php /* -V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, +V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Set tabs to 8. - [...1107 lines suppressed...] case 'DEC': - case 'FIXED':*/ + case 'FIXED': default: - if (!is_numeric($t)) echo "<p>--- Error in type matching $t -----</p>"; + //if (!is_numeric($t)) echo "<p>--- Error in type matching $t -----</p>"; return 'N'; } } // function - + } // rs class - + } -?> +?> \ No newline at end of file Index: adodb-postgres7.inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/adodb/drivers/adodb-postgres7.inc.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- adodb-postgres7.inc.php 12 Feb 2005 20:01:26 -0000 1.5 +++ adodb-postgres7.inc.php 22 Apr 2006 11:10:21 -0000 1.6 @@ -1,11 +1,11 @@ <?php /* - V4.54 5 Nov 2004 (c) 2000-2004 John Lim (jlim-l15XFKl8ZeYZ+IcD6AW/HA@xxxxxxxxxxxxxxxx). All rights reserved. - Released under both BSD license and Lesser GPL library license. - Whenever there is any discrepancy between the two licenses, + V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Set tabs to 4. - + Postgres7 support. 28 Feb 2001: Currently indicate that we support LIMIT 01 Dec 2001: dannym added support for default values @@ -17,31 +17,32 @@ include_once(ADODB_DIR."/drivers/adodb-postgres64.inc.php"); class ADODB_postgres7 extends ADODB_postgres64 { - var $databaseType = 'postgres7'; + var $databaseType = 'postgres7'; var $hasLimit = true; // set to true for pgsql 6.5+ only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10 var $ansiOuter = true; var $charSet = true; //set to true for Postgres 7 and above - PG client supports encodings - - function ADODB_postgres7() + + function ADODB_postgres7() { $this->ADODB_postgres64(); if (ADODB_ASSOC_CASE !== 2) { $this->rsPrefix .= 'assoc_'; } + $this->_bindInputArray = PHP_VERSION >= 5.1; } - - // the following should be compat with postgresql 7.2, + + // the following should be compat with postgresql 7.2, // which makes obsolete the LIMIT limit,offset syntax - function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) + function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) { - $offsetStr = ($offset >= 0) ? " OFFSET $offset" : ''; - $limitStr = ($nrows >= 0) ? " LIMIT $nrows" : ''; + $offsetStr = ($offset >= 0) ? " OFFSET ".((integer)$offset) : ''; + $limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : ''; if ($secs2cache) $rs =& $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr); else $rs =& $this->Execute($sql."$limitStr$offsetStr",$inputarr); - + return $rs; } /* @@ -56,76 +57,72 @@ */ // from Edward Jaramilla, improved version - works on pg 7.4 -function MetaForeignKeys($table, $owner=false, $upper=false) -{ - $sql = 'SELECT t.tgargs as args - FROM - pg_trigger t,pg_class c,pg_proc p - WHERE - t.tgenabled AND - t.tgrelid = c.oid AND - t.tgfoid = p.oid AND - p.proname = \'RI_FKey_check_ins\' AND - c.relname = \''.strtolower($table).'\' - ORDER BY - t.tgrelid'; - - $rs = $this->Execute($sql); - - if ($rs && !$rs->EOF) { - $arr =& $rs->GetArray(); - $a = array(); - foreach($arr as $v) - { - $data = explode(chr(0), $v['args']); - if ($upper) { - $a[strtoupper($data[2])][] = strtoupper($data[4].'='.$data[5]); - } else { - $a[$data[2]][] = $data[4].'='.$data[5]; - } - } |