From e9044ac913b511f9f1b2aad12d18a79f40131b8b Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 19 May 2006 03:05:18 +0000 Subject: Update TAdodb and removed a few drivers. --- framework/3rdParty/adodb/drivers/adodb-db2.inc.php | 687 --------------------- .../3rdParty/adodb/drivers/adodb-firebird.inc.php | 77 --- .../3rdParty/adodb/drivers/adodb-odbc_db2.inc.php | 362 ----------- .../3rdParty/adodb/drivers/adodb-postgres.inc.php | 14 - .../3rdParty/adodb/drivers/adodb-postgres8.inc.php | 12 - .../3rdParty/adodb/drivers/adodb-sapdb.inc.php | 184 ------ .../adodb/drivers/adodb-sqlanywhere.inc.php | 169 ----- .../3rdParty/adodb/drivers/adodb-sqlitepo.inc.php | 62 -- .../3rdParty/adodb/drivers/adodb-sybase.inc.php | 418 ------------- .../adodb/drivers/adodb-sybase_ase.inc.php | 115 ---- 10 files changed, 2100 deletions(-) delete mode 100644 framework/3rdParty/adodb/drivers/adodb-db2.inc.php delete mode 100644 framework/3rdParty/adodb/drivers/adodb-firebird.inc.php delete mode 100644 framework/3rdParty/adodb/drivers/adodb-odbc_db2.inc.php delete mode 100644 framework/3rdParty/adodb/drivers/adodb-postgres.inc.php delete mode 100644 framework/3rdParty/adodb/drivers/adodb-postgres8.inc.php delete mode 100644 framework/3rdParty/adodb/drivers/adodb-sapdb.inc.php delete mode 100644 framework/3rdParty/adodb/drivers/adodb-sqlanywhere.inc.php delete mode 100644 framework/3rdParty/adodb/drivers/adodb-sqlitepo.inc.php delete mode 100644 framework/3rdParty/adodb/drivers/adodb-sybase.inc.php delete mode 100644 framework/3rdParty/adodb/drivers/adodb-sybase_ase.inc.php (limited to 'framework/3rdParty/adodb') diff --git a/framework/3rdParty/adodb/drivers/adodb-db2.inc.php b/framework/3rdParty/adodb/drivers/adodb-db2.inc.php deleted file mode 100644 index a0f67e0a..00000000 --- a/framework/3rdParty/adodb/drivers/adodb-db2.inc.php +++ /dev/null @@ -1,687 +0,0 @@ -_haserrorfunctions = ADODB_PHPVER >= 0x4050; - } - - // returns true or false - function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) - { - global $php_errormsg; - - if (!function_exists('db2_connect')) { - ADOConnection::outp("Warning: The old ODBC based DB2 driver has been renamed 'odbc_db2'. This ADOdb driver calls PHP's native db2 extension."); - return null; - } - // This needs to be set before the connect(). - // Replaces the odbc_binmode() call that was in Execute() - ini_set('ibm_db2.binmode', $this->binmode); - - if ($argDatabasename) { - $this->_connectionID = db2_connect($argDatabasename,$argUsername,$argPassword); - } else { - $this->_connectionID = db2_connect($argDSN,$argUsername,$argPassword); - } - if (isset($php_errormsg)) $php_errormsg = ''; - - // For db2_connect(), there is an optional 4th arg. If present, it must be - // an array of valid options. So far, we don't use them. - - $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('db2_connect')) return null; - - // This needs to be set before the connect(). - // Replaces the odbc_binmode() call that was in Execute() - ini_set('ibm_db2.binmode', $this->binmode); - - if (isset($php_errormsg)) $php_errormsg = ''; - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; - - if ($argDatabasename) { - $this->_connectionID = db2_pconnect($argDatabasename,$argUsername,$argPassword); - } else { - $this->_connectionID = db2_pconnect($argDSN,$argUsername,$argPassword); - } - if (isset($php_errormsg)) $php_errormsg = ''; - - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; - if ($this->_connectionID && $this->autoRollback) @db2_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('db2_data_source')) return false; - - while(true) { - - $rez = @db2_data_source($this->_connectionID, - $first ? SQL_FETCH_FIRST : SQL_FETCH_NEXT); - $first = false; - if (!is_array($rez)) break; - if (strtoupper($rez['server']) == $dsn) { - $found = true; - break; - } - } - if (!$found) return ADOConnection::ServerInfo(); - if (!isset($rez['version'])) $rez['version'] = ''; - return $rez; - } else { - return ADOConnection::ServerInfo(); - } - } - - - function CreateSequence($seqname='adodbseq',$start=1) - { - if (empty($this->_genSeqSQL)) return false; - $ok = $this->Execute(sprintf($this->_genSeqSQL,$seqname)); - if (!$ok) return false; - $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; - while (--$MAXLOOPS>=0) { - $num = $this->GetOne("select id from $seq"); - if ($num === false) { - $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; - return $num; - } - } - if ($fn = $this->raiseErrorFn) { - $fn($this->databaseType,'GENID',-32000,"Unable to generate unique id after $MAXLOOPS attempts",$seq,$num); - } - return false; - } - - - function ErrorMsg() - { - if ($this->_haserrorfunctions) { - if ($this->_errorMsg !== false) return $this->_errorMsg; - if (empty($this->_connectionID)) return @db2_errormsg(); - return @db2_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 = @db2_error(); - else $e = @db2_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; - $this->transCnt += 1; - $this->_autocommit = false; - return db2_autocommit($this->_connectionID,false); - } - - function CommitTrans($ok=true) - { - if ($this->transOff) return true; - if (!$ok) return $this->RollbackTrans(); - if ($this->transCnt) $this->transCnt -= 1; - $this->_autocommit = true; - $ret = db2_commit($this->_connectionID); - db2_autocommit($this->_connectionID,true); - return $ret; - } - - function RollbackTrans() - { - if ($this->transOff) return true; - if ($this->transCnt) $this->transCnt -= 1; - $this->_autocommit = true; - $ret = db2_rollback($this->_connectionID); - db2_autocommit($this->_connectionID,true); - return $ret; - } - - function MetaPrimaryKeys($table) - { - global $ADODB_FETCH_MODE; - - if ($this->uCaseTables) $table = strtoupper($table); - $schema = ''; - $this->_findschema($table,$schema); - - $savem = $ADODB_FETCH_MODE; - $ADODB_FETCH_MODE = ADODB_FETCH_NUM; - $qid = @db2_primarykeys($this->_connectionID,'',$schema,$table); - - if (!$qid) { - $ADODB_FETCH_MODE = $savem; - return false; - } - $rs = new ADORecordSet_db2($qid); - $ADODB_FETCH_MODE = $savem; - - if (!$rs) return false; - - $arr =& $rs->GetArray(); - $rs->Close(); - $arr2 = array(); - for ($i=0; $i < sizeof($arr); $i++) { - if ($arr[$i][3]) $arr2[] = $arr[$i][3]; - } - return $arr2; - } - - - - function &MetaTables($ttype=false) - { - global $ADODB_FETCH_MODE; - - $savem = $ADODB_FETCH_MODE; - $ADODB_FETCH_MODE = ADODB_FETCH_NUM; - $qid = db2_tables($this->_connectionID); - - $rs = new ADORecordSet_db2($qid); - - $ADODB_FETCH_MODE = $savem; - if (!$rs) { - $false = false; - return $false; - } - - $arr =& $rs->GetArray(); - - $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 ($isview) { - if (strncmp($type,'V',1) === 0) $arr2[] = $arr[$i][2]; - } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $arr[$i][2]; - } else if (strncmp($type,'SYS',3) !== 0) $arr2[] = $arr[$i][2]; - } - return $arr2; - } - -/* -See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2datetime_data_type_changes.asp -/ SQL data type codes / -#define SQL_UNKNOWN_TYPE 0 -#define SQL_CHAR 1 -#define SQL_NUMERIC 2 -#define SQL_DECIMAL 3 -#define SQL_INTEGER 4 -#define SQL_SMALLINT 5 -#define SQL_FLOAT 6 -#define SQL_REAL 7 -#define SQL_DOUBLE 8 -#if (DB2VER >= 0x0300) -#define SQL_DATETIME 9 -#endif -#define SQL_VARCHAR 12 - - -/ One-parameter shortcuts for date/time data types / -#if (DB2VER >= 0x0300) -#define SQL_TYPE_DATE 91 -#define SQL_TYPE_TIME 92 -#define SQL_TYPE_TIMESTAMP 93 - -#define SQL_UNICODE (-95) -#define SQL_UNICODE_VARCHAR (-96) -#define SQL_UNICODE_LONGVARCHAR (-97) -*/ - function DB2Types($t) - { - switch ((integer)$t) { - case 1: - case 12: - case 0: - case -95: - case -96: - return 'C'; - case -97: - case -1: //text - return 'X'; - case -4: //image - return 'B'; - - 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; - - $colname = "%"; - $qid = db2_columns($this->_connectionID, "", $schema, $table, $colname); - if (empty($qid)) return $false; - - $rs =& new ADORecordSet_db2($qid); - $ADODB_FETCH_MODE = $savem; - - if (!$rs) return $false; - $rs->_fetch(); - - $retarr = array(); - - /* - $rs->fields indices - 0 TABLE_QUALIFIER - 1 TABLE_SCHEM - 2 TABLE_NAME - 3 COLUMN_NAME - 4 DATA_TYPE - 5 TYPE_NAME - 6 PRECISION - 7 LENGTH - 8 SCALE - 9 RADIX - 10 NULLABLE - 11 REMARKS - */ - while (!$rs->EOF) { - if (strtoupper(trim($rs->fields[2])) == $table && (!$schema || strtoupper($rs->fields[1]) == $schema)) { - $fld = new ADOFieldObject(); - $fld->name = $rs->fields[3]; - $fld->type = $this->DB2Types($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 ($rs->fields[4] <= -95) // UNICODE - $fld->max_length = $rs->fields[7]/2; - else - $fld->max_length = $rs->fields[7]; - } else - $fld->max_length = $rs->fields[7]; - $fld->not_null = !empty($rs->fields[10]); - $fld->scale = $rs->fields[8]; - $retarr[strtoupper($fld->name)] = $fld; - } else if (sizeof($retarr)>0) - break; - $rs->MoveNext(); - } - $rs->Close(); //-- crashes 4.03pl1 -- why? - - if (empty($retarr)) $retarr = false; - return $retarr; - } - - function Prepare($sql) - { - if (! $this->_bindInputArray) return $sql; // no binding - $stmt = db2_prepare($this->_connectionID,$sql); - if (!$stmt) { - // we don't know whether db2 driver is parsing prepared stmts, so just return sql - return $sql; - } - return array($sql,$stmt,false); - } - - /* returns queryID or 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 = db2_prepare($this->_connectionID,$sql); - - if ($stmtid == false) { - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; - return false; - } - } - - if (! db2_execute($stmtid,$inputarr)) { - if ($this->_haserrorfunctions) { - $this->_errorMsg = db2_errormsg(); - $this->_errorCode = db2_error(); - } - return false; - } - - } else if (is_array($sql)) { - $stmtid = $sql[1]; - if (!db2_execute($stmtid)) { - if ($this->_haserrorfunctions) { - $this->_errorMsg = db2_errormsg(); - $this->_errorCode = db2_error(); - } - return false; - } - } else - $stmtid = db2_exec($this->_connectionID,$sql); - - $this->_lastAffectedRows = 0; - if ($stmtid) { - if (@db2_num_fields($stmtid) == 0) { - $this->_lastAffectedRows = db2_num_rows($stmtid); - $stmtid = true; - } else { - $this->_lastAffectedRows = 0; - } - - if ($this->_haserrorfunctions) { - $this->_errorMsg = ''; - $this->_errorCode = 0; - } else - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; - } else { - if ($this->_haserrorfunctions) { - $this->_errorMsg = db2_stmt_errormsg(); - $this->_errorCode = db2_stmt_error(); - } else - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; - } - return $stmtid; - } - - /* - 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'); - */ - function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB') - { - return $this->Execute("UPDATE $table SET $column=? WHERE $where",array($val)) != false; - } - - // returns true or false - function _close() - { - $ret = @db2_close($this->_connectionID); - $this->_connectionID = false; - return $ret; - } - - function _affectedrows() - { - return $this->_lastAffectedRows; - } - -} - -/*-------------------------------------------------------------------------------------- - Class Name: Recordset ---------------------------------------------------------------------------------------*/ - -class ADORecordSet_db2 extends ADORecordSet { - - var $bind = false; - var $databaseType = "db2"; - var $dataProvider = "db2"; - var $useFetchArray; - - function ADORecordSet_db2($id,$mode=false) - { - if ($mode === false) { - global $ADODB_FETCH_MODE; - $mode = $ADODB_FETCH_MODE; - } - $this->fetchMode = $mode; - - $this->_queryID = $id; - } - - - // returns the field object - function &FetchField($fieldOffset = -1) - { - - $off=$fieldOffset+1; // offsets begin at 1 - - $o= new ADOFieldObject(); - $o->name = @db2_field_name($this->_queryID,$off); - $o->type = @db2_field_type($this->_queryID,$off); - $o->max_length = db2_field_width($this->_queryID,$off); - if (ADODB_ASSOC_CASE == 0) $o->name = strtolower($o->name); - else if (ADODB_ASSOC_CASE == 1) $o->name = strtoupper($o->name); - return $o; - } - - /* Use associative array to get fields array */ - function Fields($colname) - { - if ($this->fetchMode & ADODB_FETCH_ASSOC) return $this->fields[$colname]; - if (!$this->bind) { - $this->bind = array(); - for ($i=0; $i < $this->_numOfFields; $i++) { - $o = $this->FetchField($i); - $this->bind[strtoupper($o->name)] = $i; - } - } - - return $this->fields[$this->bind[strtoupper($colname)]]; - } - - - function _initrs() - { - global $ADODB_COUNTRECS; - $this->_numOfRows = ($ADODB_COUNTRECS) ? @db2_num_rows($this->_queryID) : -1; - $this->_numOfFields = @db2_num_fields($this->_queryID); - // some silly drivers such as db2 as/400 and intersystems cache return _numOfRows = 0 - if ($this->_numOfRows == 0) $this->_numOfRows = -1; - } - - 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) - { - if ($offset <= 0) { - $rs =& $this->GetArray($nrows); - return $rs; - } - $savem = $this->fetchMode; - $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() - { - if ($this->_numOfRows != 0 && !$this->EOF) { - $this->_currentRow++; - - $this->fields = @db2_fetch_array($this->_queryID); - if ($this->fields) { - if ($this->fetchMode & ADODB_FETCH_ASSOC) { - $this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE); - } - return true; - } - } - $this->fields = false; - $this->EOF = true; - return false; - } - - function _fetch() - { - - $this->fields = db2_fetch_array($this->_queryID); - if ($this->fields) { - if ($this->fetchMode & ADODB_FETCH_ASSOC) { - $this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE); - } - return true; - } - $this->fields = false; - return false; - } - - function _close() - { - return @db2_free_result($this->_queryID); - } - -} -?> \ No newline at end of file diff --git a/framework/3rdParty/adodb/drivers/adodb-firebird.inc.php b/framework/3rdParty/adodb/drivers/adodb-firebird.inc.php deleted file mode 100644 index 286ca179..00000000 --- a/framework/3rdParty/adodb/drivers/adodb-firebird.inc.php +++ /dev/null @@ -1,77 +0,0 @@ -ADODB_ibase(); - } - - function ServerInfo() - { - $arr['dialect'] = $this->dialect; - switch($arr['dialect']) { - case '': - case '1': $s = 'Firebird Dialect 1'; break; - case '2': $s = 'Firebird Dialect 2'; break; - default: - case '3': $s = 'Firebird Dialect 3'; break; - } - $arr['version'] = ADOConnection::_findvers($s); - $arr['description'] = $s; - return $arr; - } - - // Note that Interbase 6.5 uses this ROWS instead - don't you love forking wars! - // SELECT col1, col2 FROM table ROWS 5 -- get 5 rows - // SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2 - function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $secs=0) - { - $nrows = (integer) $nrows; - $offset = (integer) $offset; - $str = 'SELECT '; - if ($nrows >= 0) $str .= "FIRST $nrows "; - $str .=($offset>=0) ? "SKIP $offset " : ''; - - $sql = preg_replace('/^[ \t]*select/i',$str,$sql); - if ($secs) - $rs =& $this->CacheExecute($secs,$sql,$inputarr); - else - $rs =& $this->Execute($sql,$inputarr); - - return $rs; - } - - -}; - - -class ADORecordSet_firebird extends ADORecordSet_ibase { - - var $databaseType = "firebird"; - - function ADORecordSet_firebird($id,$mode=false) - { - $this->ADORecordSet_ibase($id,$mode); - } -} -?> \ No newline at end of file diff --git a/framework/3rdParty/adodb/drivers/adodb-odbc_db2.inc.php b/framework/3rdParty/adodb/drivers/adodb-odbc_db2.inc.php deleted file mode 100644 index 4e9fee2a..00000000 --- a/framework/3rdParty/adodb/drivers/adodb-odbc_db2.inc.php +++ /dev/null @@ -1,362 +0,0 @@ -curMode = SQL_CUR_USE_ODBC; -$db->Connect($dsn, $userid, $pwd); - - - -USING CLI INTERFACE -=================== - -I have had reports that the $host and $database params have to be reversed in -Connect() when using the CLI interface. From Halmai Csongor csongor.halmai#nexum.hu: - -> The symptom is that if I change the database engine from postgres or any other to DB2 then the following -> connection command becomes wrong despite being described this version to be correct in the docs. -> -> $connection_object->Connect( $DATABASE_HOST, $DATABASE_AUTH_USER_NAME, $DATABASE_AUTH_PASSWORD, $DATABASE_NAME ) -> -> In case of DB2 I had to swap the first and last arguments in order to connect properly. - - -*/ - -// security - hide paths -if (!defined('ADODB_DIR')) die(); - -if (!defined('_ADODB_ODBC_LAYER')) { - include(ADODB_DIR."/drivers/adodb-odbc.inc.php"); -} -if (!defined('ADODB_DB2')){ -define('ADODB_DB2',1); - -class ADODB_DB2 extends ADODB_odbc { - var $databaseType = "db2"; - var $concat_operator = '||'; - var $sysDate = 'CURRENT_DATE'; - var $sysTimeStamp = 'CURRENT TIMESTAMP'; - // The complete string representation of a timestamp has the form - // yyyy-mm-dd-hh.mm.ss.nnnnnn. - var $fmtTimeStamp = "'Y-m-d-H.i.s'"; - var $ansiOuter = true; - var $identitySQL = 'values IDENTITY_VAL_LOCAL()'; - var $_bindInputArray = true; - var $hasInsertID = true; - - function ADODB_DB2() - { - if (strncmp(PHP_OS,'WIN',3) === 0) $this->curmode = SQL_CUR_USE_ODBC; - $this->ADODB_odbc(); - } - - function IfNull( $field, $ifNull ) - { - return " COALESCE($field, $ifNull) "; // if DB2 UDB - } - - function ServerInfo() - { - //odbc_setoption($this->_connectionID,1,101 /*SQL_ATTR_ACCESS_MODE*/, 1 /*SQL_MODE_READ_ONLY*/); - $vers = $this->GetOne('select versionnumber from sysibm.sysversions'); - //odbc_setoption($this->_connectionID,1,101, 0 /*SQL_MODE_READ_WRITE*/); - return array('description'=>'DB2 ODBC driver', 'version'=>$vers); - } - - function _insertid() - { - return $this->GetOne($this->identitySQL); - } - - function RowLock($tables,$where,$flds='1 as ignore') - { - if ($this->_autocommit) $this->BeginTrans(); - return $this->GetOne("select $flds from $tables where $where for update"); - } - - function &MetaTables($ttype=false,$showSchema=false, $qtable="%", $qschema="%") - { - global $ADODB_FETCH_MODE; - - $savem = $ADODB_FETCH_MODE; - $ADODB_FETCH_MODE = ADODB_FETCH_NUM; - $qid = odbc_tables($this->_connectionID, "", $qschema, $qtable, ""); - - $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; - if (strncmp($arr[$i][1],'SYS',3) === 0) continue; - - $type = $arr[$i][3]; - - if ($showSchema) $arr[$i][2] = $arr[$i][1].'.'.$arr[$i][2]; - - if ($ttype) { - if ($isview) { - if (strncmp($type,'V',1) === 0) $arr2[] = $arr[$i][2]; - } else if (strncmp($type,'T',1) === 0) $arr2[] = $arr[$i][2]; - } else if (strncmp($type,'S',1) !== 0) $arr2[] = $arr[$i][2]; - } - return $arr2; - } - - function &MetaIndexes ($table, $primary = FALSE, $owner=false) - { - // save old fetch mode - global $ADODB_FETCH_MODE; - $save = $ADODB_FETCH_MODE; - $ADODB_FETCH_MODE = ADODB_FETCH_NUM; - if ($this->fetchMode !== FALSE) { - $savem = $this->SetFetchMode(FALSE); - } - $false = false; - // get index details - $table = strtoupper($table); - $SQL="SELECT NAME, UNIQUERULE, COLNAMES FROM SYSIBM.SYSINDEXES WHERE TBNAME='$table'"; - if ($primary) - $SQL.= " AND UNIQUERULE='P'"; - $rs = $this->Execute($SQL); - if (!is_object($rs)) { - if (isset($savem)) - $this->SetFetchMode($savem); - $ADODB_FETCH_MODE = $save; - return $false; - } - $indexes = array (); - // parse index data into array - while ($row = $rs->FetchRow()) { - $indexes[$row[0]] = array( - 'unique' => ($row[1] == 'U' || $row[1] == 'P'), - 'columns' => array() - ); - $cols = ltrim($row[2],'+'); - $indexes[$row[0]]['columns'] = explode('+', $cols); - } - if (isset($savem)) { - $this->SetFetchMode($savem); - $ADODB_FETCH_MODE = $save; - } - return $indexes; - } - - // Format date column in sql string given an input format that understands Y M D - function SQLDate($fmt, $col=false) - { - // use right() and replace() ? - if (!$col) $col = $this->sysDate; - $s = ''; - - $len = strlen($fmt); - for ($i=0; $i < $len; $i++) { - if ($s) $s .= '||'; - $ch = $fmt[$i]; - switch($ch) { - case 'Y': - case 'y': - $s .= "char(year($col))"; - break; - case 'M': - $s .= "substr(monthname($col),1,3)"; - break; - case 'm': - $s .= "right(digits(month($col)),2)"; - break; - case 'D': - case 'd': - $s .= "right(digits(day($col)),2)"; - break; - case 'H': - case 'h': - if ($col != $this->sysDate) $s .= "right(digits(hour($col)),2)"; - else $s .= "''"; - break; - case 'i': - case 'I': - if ($col != $this->sysDate) - $s .= "right(digits(minute($col)),2)"; - else $s .= "''"; - break; - case 'S': - case 's': - if ($col != $this->sysDate) - $s .= "right(digits(second($col)),2)"; - else $s .= "''"; - break; - default: - if ($ch == '\\') { - $i++; - $ch = substr($fmt,$i,1); - } - $s .= $this->qstr($ch); - } - } - return $s; - } - - - function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputArr=false) - { - $nrows = (integer) $nrows; - if ($offset <= 0) { - // could also use " OPTIMIZE FOR $nrows ROWS " - if ($nrows >= 0) $sql .= " FETCH FIRST $nrows ROWS ONLY "; - $rs =& $this->Execute($sql,$inputArr); - } else { - if ($offset > 0 && $nrows < 0); - else { - $nrows += $offset; - $sql .= " FETCH FIRST $nrows ROWS ONLY "; - } - $rs =& ADOConnection::SelectLimit($sql,-1,$offset,$inputArr); - } - - return $rs; - } - -}; - - -class ADORecordSet_db2 extends ADORecordSet_odbc { - - var $databaseType = "db2"; - - function ADORecordSet_db2($id,$mode=false) - { - $this->ADORecordSet_odbc($id,$mode); - } - - function MetaType($t,$len=-1,$fieldobj=false) - { - if (is_object($t)) { - $fieldobj = $t; - $t = $fieldobj->type; - $len = $fieldobj->max_length; - } - - switch (strtoupper($t)) { - case 'VARCHAR': - case 'CHAR': - case 'CHARACTER': - case 'C': - if ($len <= $this->blobSize) return 'C'; - - case 'LONGCHAR': - case 'TEXT': - case 'CLOB': - case 'DBCLOB': // double-byte - case 'X': - return 'X'; - - case 'BLOB': - case 'GRAPHIC': - case 'VARGRAPHIC': - return 'B'; - - case 'DATE': - case 'D': - return 'D'; - - case 'TIME': - case 'TIMESTAMP': - case 'T': - return 'T'; - - //case 'BOOLEAN': - //case 'BIT': - // return 'L'; - - //case 'COUNTER': - // return 'R'; - - case 'INT': - case 'INTEGER': - case 'BIGINT': - case 'SMALLINT': - case 'I': - return 'I'; - - default: return 'N'; - } - } -} - -} //define -?> \ No newline at end of file diff --git a/framework/3rdParty/adodb/drivers/adodb-postgres.inc.php b/framework/3rdParty/adodb/drivers/adodb-postgres.inc.php deleted file mode 100644 index 63a057d4..00000000 --- a/framework/3rdParty/adodb/drivers/adodb-postgres.inc.php +++ /dev/null @@ -1,14 +0,0 @@ - \ No newline at end of file diff --git a/framework/3rdParty/adodb/drivers/adodb-postgres8.inc.php b/framework/3rdParty/adodb/drivers/adodb-postgres8.inc.php deleted file mode 100644 index 80d6e186..00000000 --- a/framework/3rdParty/adodb/drivers/adodb-postgres8.inc.php +++ /dev/null @@ -1,12 +0,0 @@ - \ No newline at end of file diff --git a/framework/3rdParty/adodb/drivers/adodb-sapdb.inc.php b/framework/3rdParty/adodb/drivers/adodb-sapdb.inc.php deleted file mode 100644 index df9fb45e..00000000 --- a/framework/3rdParty/adodb/drivers/adodb-sapdb.inc.php +++ /dev/null @@ -1,184 +0,0 @@ -curmode = SQL_CUR_USE_ODBC; - $this->ADODB_odbc(); - } - - function ServerInfo() - { - $info = ADODB_odbc::ServerInfo(); - if (!$info['version'] && preg_match('/([0-9.]+)/',$info['description'],$matches)) { - $info['version'] = $matches[1]; - } - return $info; - } - - function MetaPrimaryKeys($table) - { - $table = $this->Quote(strtoupper($table)); - - 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)); - - $sql = "SELECT INDEXNAME,TYPE,COLUMNNAME FROM INDEXCOLUMNS ". - " WHERE TABLENAME=$table". - " ORDER BY INDEXNAME,COLUMNNO"; - - global $ADODB_FETCH_MODE; - $save = $ADODB_FETCH_MODE; - $ADODB_FETCH_MODE = ADODB_FETCH_NUM; - if ($this->fetchMode !== FALSE) { - $savem = $this->SetFetchMode(FALSE); - } - - $rs = $this->Execute($sql); - if (isset($savem)) { - $this->SetFetchMode($savem); - } - $ADODB_FETCH_MODE = $save; - - if (!is_object($rs)) { - return FALSE; - } - - $indexes = array(); - while ($row = $rs->FetchRow()) { - $indexes[$row[0]]['unique'] = $row[1] == 'UNIQUE'; - $indexes[$row[0]]['columns'][] = $row[2]; - } - if ($primary) { - $indexes['SYSPRIMARYKEYINDEX'] = array( - 'unique' => True, // by definition - 'columns' => $this->GetCol("SELECT columnname FROM COLUMNS WHERE tablename=$table AND mode='KEY' ORDER BY pos"), - ); - } - return $indexes; - } - - function &MetaColumns ($table) - { - global $ADODB_FETCH_MODE; - $save = $ADODB_FETCH_MODE; - $ADODB_FETCH_MODE = ADODB_FETCH_NUM; - if ($this->fetchMode !== FALSE) { - $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) - { - $fld = new ADOFieldObject(); - $fld->name = $column[0]; - $fld->type = $column[1]; - $fld->max_length = $fld->type == 'LONG' ? 2147483647 : $column[2]; - $fld->scale = $column[3]; - $fld->not_null = $column[4] == 'NO'; - $fld->primary_key = $column[5] == 'KEY'; - if ($fld->has_default = $column[7]) { - if ($fld->primary_key && $column[6] == 'DEFAULT SERIAL (1)') { - $fld->auto_increment = true; - $fld->has_default = false; - } else { - $fld->default_value = $column[6]; - switch($fld->type) { - case 'VARCHAR': - case 'CHARACTER': - case 'LONG': - $fld->default_value = $column[6]; - break; - default: - $fld->default_value = trim($column[6]); - break; - } - } - } - $retarr[$fld->name] = $fld; - } - if (isset($savem)) { - $this->SetFetchMode($savem); - } - $ADODB_FETCH_MODE = $save; - - 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) - { - return empty($table) ? False : $this->GetOne("SELECT $table.CURRVAL FROM DUAL"); - } - - /* - 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"; - - function ADORecordSet_sapdb($id,$mode=false) - { - $this->ADORecordSet_odbc($id,$mode); - } -} - -} //define -?> \ No newline at end of file diff --git a/framework/3rdParty/adodb/drivers/adodb-sqlanywhere.inc.php b/framework/3rdParty/adodb/drivers/adodb-sqlanywhere.inc.php deleted file mode 100644 index cd023cc9..00000000 --- a/framework/3rdParty/adodb/drivers/adodb-sqlanywhere.inc.php +++ /dev/null @@ -1,169 +0,0 @@ -create_blobvar($blobVarName); - - b) load blob var from file. $filename must be complete path - - $dbcon->load_blobvar_from_file($blobVarName, $filename); - - c) Use the $blobVarName in SQL insert or update statement in the values - clause: - - $recordSet = $dbconn->Execute('INSERT INTO tabname (idcol, blobcol) ' - . - 'VALUES (\'test\', ' . $blobVarName . ')'); - - instead of loading blob from a file, you can also load from - an unformatted (raw) blob variable: - $dbcon->load_blobvar_from_var($blobVarName, $varName); - - d) drop blob variable on db server to free up resources: - $dbconn->drop_blobvar($blobVarName); - - Sybase_SQLAnywhere data driver. Requires ODBC. - -*/ - -// security - hide paths -if (!defined('ADODB_DIR')) die(); - -if (!defined('_ADODB_ODBC_LAYER')) { - include(ADODB_DIR."/drivers/adodb-odbc.inc.php"); -} - -if (!defined('ADODB_SYBASE_SQLANYWHERE')){ - - define('ADODB_SYBASE_SQLANYWHERE',1); - - class ADODB_sqlanywhere extends ADODB_odbc { - var $databaseType = "sqlanywhere"; - var $hasInsertID = true; - - function ADODB_sqlanywhere() - { - $this->ADODB_odbc(); - } - - function _insertid() { - return $this->GetOne('select @@identity'); - } - - function create_blobvar($blobVarName) { - $this->Execute("create variable $blobVarName long binary"); - return; - } - - function drop_blobvar($blobVarName) { - $this->Execute("drop variable $blobVarName"); - return; - } - - function load_blobvar_from_file($blobVarName, $filename) { - $chunk_size = 1000; - - $fd = fopen ($filename, "rb"); - - $integer_chunks = (integer)filesize($filename) / $chunk_size; - $modulus = filesize($filename) % $chunk_size; - if ($modulus != 0){ - $integer_chunks += 1; - } - - for($loop=1;$loop<=$integer_chunks;$loop++){ - $contents = fread ($fd, $chunk_size); - $contents = bin2hex($contents); - - $hexstring = ''; - - for($loop2=0;$loop2qstr($hexstring); - - $this->Execute("set $blobVarName = $blobVarName || " . $hexstring); - } - - fclose ($fd); - return; - } - - function load_blobvar_from_var($blobVarName, &$varName) { - $chunk_size = 1000; - - $integer_chunks = (integer)strlen($varName) / $chunk_size; - $modulus = strlen($varName) % $chunk_size; - if ($modulus != 0){ - $integer_chunks += 1; - } - - for($loop=1;$loop<=$integer_chunks;$loop++){ - $contents = substr ($varName, (($loop - 1) * $chunk_size), $chunk_size); - $contents = bin2hex($contents); - - $hexstring = ''; - - for($loop2=0;$loop2qstr($hexstring); - - $this->Execute("set $blobVarName = $blobVarName || " . $hexstring); - } - - return; - } - - /* - 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'); - */ - function UpdateBlob($table,$column,&$val,$where,$blobtype='BLOB') - { - $blobVarName = 'hold_blob'; - $this->create_blobvar($blobVarName); - $this->load_blobvar_from_var($blobVarName, $val); - $this->Execute("UPDATE $table SET $column=$blobVarName WHERE $where"); - $this->drop_blobvar($blobVarName); - return true; - } - }; //class - - class ADORecordSet_sqlanywhere extends ADORecordSet_odbc { - - var $databaseType = "sqlanywhere"; - - function ADORecordSet_sqlanywhere($id,$mode=false) - { - $this->ADORecordSet_odbc($id,$mode); - } - - - }; //class - - -} //define -?> diff --git a/framework/3rdParty/adodb/drivers/adodb-sqlitepo.inc.php b/framework/3rdParty/adodb/drivers/adodb-sqlitepo.inc.php deleted file mode 100644 index b8489e97..00000000 --- a/framework/3rdParty/adodb/drivers/adodb-sqlitepo.inc.php +++ /dev/null @@ -1,62 +0,0 @@ -ADODB_sqlite(); - } -} - -/*-------------------------------------------------------------------------------------- - Class Name: Recordset ---------------------------------------------------------------------------------------*/ - -class ADORecordset_sqlitepo extends ADORecordset_sqlite { - - var $databaseType = 'sqlitepo'; - - function ADORecordset_sqlitepo($queryID,$mode=false) - { - $this->ADORecordset_sqlite($queryID,$mode); - } - - // Modified to strip table names from returned fields - function _fetch($ignore_fields=false) - { - $this->fields = array(); - $fields = @sqlite_fetch_array($this->_queryID,$this->fetchMode); - if(is_array($fields)) - foreach($fields as $n => $v) - { - if(($p = strpos($n, ".")) !== false) - $n = substr($n, $p+1); - $this->fields[$n] = $v; - } - - return !empty($this->fields); - } -} -?> \ No newline at end of file diff --git a/framework/3rdParty/adodb/drivers/adodb-sybase.inc.php b/framework/3rdParty/adodb/drivers/adodb-sybase.inc.php deleted file mode 100644 index 26492608..00000000 --- a/framework/3rdParty/adodb/drivers/adodb-sybase.inc.php +++ /dev/null @@ -1,418 +0,0 @@ -GetOne('select @@identity'); - } - // might require begintrans -- committrans - function _affectedrows() - { - return $this->GetOne('select @@rowcount'); - } - - - function BeginTrans() - { - - if ($this->transOff) return true; - $this->transCnt += 1; - - $this->Execute('BEGIN TRAN'); - return true; - } - - function CommitTrans($ok=true) - { - if ($this->transOff) return true; - - if (!$ok) return $this->RollbackTrans(); - - $this->transCnt -= 1; - $this->Execute('COMMIT TRAN'); - return true; - } - - function RollbackTrans() - { - if ($this->transOff) return true; - $this->transCnt -= 1; - $this->Execute('ROLLBACK TRAN'); - return true; - } - - // http://www.isug.com/Sybase_FAQ/ASE/section6.1.html#6.1.4 - function RowLock($tables,$where,$flds='top 1 null as ignore') - { - if (!$this->_hastrans) $this->BeginTrans(); - $tables = str_replace(',',' HOLDLOCK,',$tables); - return $this->GetOne("select $flds from $tables HOLDLOCK where $where"); - - } - - function SelectDB($dbName) - { - $this->database = $dbName; - $this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions - if ($this->_connectionID) { - return @sybase_select_db($dbName); - } - else return false; - } - - /* Returns: the last error message from previous database operation - Note: This function is NOT available for Microsoft SQL Server. */ - - - function ErrorMsg() - { - if ($this->_logsql) return $this->_errorMsg; - if (function_exists('sybase_get_last_message')) - $this->_errorMsg = sybase_get_last_message(); - else - $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : 'SYBASE error messages not supported on this platform'; - return $this->_errorMsg; - } - - // returns true or false - function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) - { - if (!function_exists('sybase_connect')) return null; - - $this->_connectionID = sybase_connect($argHostname,$argUsername,$argPassword); - if ($this->_connectionID === false) return false; - if ($argDatabasename) return $this->SelectDB($argDatabasename); - return true; - } - // returns true or false - function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) - { - if (!function_exists('sybase_connect')) return null; - - $this->_connectionID = sybase_pconnect($argHostname,$argUsername,$argPassword); - if ($this->_connectionID === false) return false; - if ($argDatabasename) return $this->SelectDB($argDatabasename); - return true; - } - - // returns query ID if successful, otherwise false - function _query($sql,$inputarr) - { - global $ADODB_COUNTRECS; - - if ($ADODB_COUNTRECS == false && ADODB_PHPVER >= 0x4300) - return sybase_unbuffered_query($sql,$this->_connectionID); - else - return sybase_query($sql,$this->_connectionID); - } - - // See http://www.isug.com/Sybase_FAQ/ASE/section6.2.html#6.2.12 - function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) - { - if ($secs2cache > 0) {// we do not cache rowcount, so we have to load entire recordset - $rs =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); - return $rs; - } - - $nrows = (integer) $nrows; - $offset = (integer) $offset; - - $cnt = ($nrows >= 0) ? $nrows : 999999999; - if ($offset > 0 && $cnt) $cnt += $offset; - - $this->Execute("set rowcount $cnt"); - $rs =& ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,0); - $this->Execute("set rowcount 0"); - - return $rs; - } - - // returns true or false - function _close() - { - return @sybase_close($this->_connectionID); - } - - function UnixDate($v) - { - return ADORecordSet_array_sybase::UnixDate($v); - } - - function UnixTimeStamp($v) - { - return ADORecordSet_array_sybase::UnixTimeStamp($v); - } - - - - # Added 2003-10-05 by Chris Phillipson - # Used ASA SQL Reference Manual -- http://sybooks.sybase.com/onlinebooks/group-aw/awg0800e/dbrfen8/@ebt-link;pt=16756?target=%25N%15_12018_START_RESTART_N%25 - # to convert similar Microsoft SQL*Server (mssql) API into Sybase compatible version - // 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 .= '+'; - $ch = $fmt[$i]; - switch($ch) { - case 'Y': - case 'y': - $s .= "datename(yy,$col)"; - break; - case 'M': - $s .= "convert(char(3),$col,0)"; - break; - case 'm': - $s .= "replace(str(month($col),2),' ','0')"; - break; - case 'Q': - case 'q': - $s .= "datename(qq,$col)"; - break; - case 'D': - case 'd': - $s .= "replace(str(datepart(dd,$col),2),' ','0')"; - break; - 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; - case 's': - $s .= "replace(str(datepart(ss,$col),2),' ','0')"; - break; - case 'a': - case 'A': - $s .= "substring(convert(char(19),$col,0),18,2)"; - break; - - default: - if ($ch == '\\') { - $i++; - $ch = substr($fmt,$i,1); - } - $s .= $this->qstr($ch); - break; - } - } - return $s; - } - - # Added 2003-10-07 by Chris Phillipson - # Used ASA SQL Reference Manual -- http://sybooks.sybase.com/onlinebooks/group-aw/awg0800e/dbrfen8/@ebt-link;pt=5981;uf=0?target=0;window=new;showtoc=true;book=dbrfen8 - # to convert similar Microsoft SQL*Server (mssql) API into Sybase compatible version - function MetaPrimaryKeys($table) - { - $sql = "SELECT c.column_name " . - "FROM syscolumn c, systable t " . - "WHERE t.table_name='$table' AND c.table_id=t.table_id " . - "AND t.table_type='BASE' " . - "AND c.pkey = 'Y' " . - "ORDER BY c.column_id"; - - $a = $this->GetCol($sql); - if ($a && sizeof($a)>0) return $a; - return false; - } -} - -/*-------------------------------------------------------------------------------------- - Class Name: Recordset ---------------------------------------------------------------------------------------*/ -global $ADODB_sybase_mths; -$ADODB_sybase_mths = array( - 'JAN'=>1,'FEB'=>2,'MAR'=>3,'APR'=>4,'MAY'=>5,'JUN'=>6, - 'JUL'=>7,'AUG'=>8,'SEP'=>9,'OCT'=>10,'NOV'=>11,'DEC'=>12); - -class ADORecordset_sybase extends ADORecordSet { - - var $databaseType = "sybase"; - var $canSeek = true; - // _mths works only in non-localised system - var $_mths = array('JAN'=>1,'FEB'=>2,'MAR'=>3,'APR'=>4,'MAY'=>5,'JUN'=>6,'JUL'=>7,'AUG'=>8,'SEP'=>9,'OCT'=>10,'NOV'=>11,'DEC'=>12); - - function ADORecordset_sybase($id,$mode=false) - { - if ($mode === false) { - global $ADODB_FETCH_MODE; - $mode = $ADODB_FETCH_MODE; - } - if (!$mode) $this->fetchMode = ADODB_FETCH_ASSOC; - else $this->fetchMode = $mode; - $this->ADORecordSet($id,$mode); - } - - /* Returns: an object containing field information. - Get column information in the Recordset object. fetchField() can be used in order to obtain information about - fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by - fetchField() is retrieved. */ - function &FetchField($fieldOffset = -1) - { - if ($fieldOffset != -1) { - $o = @sybase_fetch_field($this->_queryID, $fieldOffset); - } - else if ($fieldOffset == -1) { /* The $fieldOffset argument is not provided thus its -1 */ - $o = @sybase_fetch_field($this->_queryID); - } - // older versions of PHP did not support type, only numeric - if ($o && !isset($o->type)) $o->type = ($o->numeric) ? 'float' : 'varchar'; - return $o; - } - - function _initrs() - { - global $ADODB_COUNTRECS; - $this->_numOfRows = ($ADODB_COUNTRECS)? @sybase_num_rows($this->_queryID):-1; - $this->_numOfFields = @sybase_num_fields($this->_queryID); - } - - function _seek($row) - { - return @sybase_data_seek($this->_queryID, $row); - } - - function _fetch($ignore_fields=false) - { - if ($this->fetchMode == ADODB_FETCH_NUM) { - $this->fields = @sybase_fetch_row($this->_queryID); - } else if ($this->fetchMode == ADODB_FETCH_ASSOC) { - $this->fields = @sybase_fetch_row($this->_queryID); - if (is_array($this->fields)) { - $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE); - return true; - } - return false; - } else { - $this->fields = @sybase_fetch_array($this->_queryID); - } - if ( is_array($this->fields)) { - return true; - } - - return false; - } - - /* close() only needs to be called if you are worried about using too much memory while your script - is running. All associated result memory for the specified result identifier will automatically be freed. */ - function _close() { - return @sybase_free_result($this->_queryID); - } - - // sybase/mssql uses a default date like Dec 30 2000 12:00AM - function UnixDate($v) - { - return ADORecordSet_array_sybase::UnixDate($v); - } - - function UnixTimeStamp($v) - { - return ADORecordSet_array_sybase::UnixTimeStamp($v); - } -} - -class ADORecordSet_array_sybase extends ADORecordSet_array { - function ADORecordSet_array_sybase($id=-1) - { - $this->ADORecordSet_array($id); - } - - // sybase/mssql uses a default date like Dec 30 2000 12:00AM - function UnixDate($v) - { - global $ADODB_sybase_mths; - - //Dec 30 2000 12:00AM - if (!ereg( "([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})" - ,$v, $rr)) return parent::UnixDate($v); - - if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0; - - $themth = substr(strtoupper($rr[1]),0,3); - $themth = $ADODB_sybase_mths[$themth]; - if ($themth <= 0) return false; - // h-m-s-MM-DD-YY - return mktime(0,0,0,$themth,$rr[2],$rr[3]); - } - - function UnixTimeStamp($v) - { - global $ADODB_sybase_mths; - //11.02.2001 Toni Tunkkari toni.tunkkari@finebyte.com - //Changed [0-9] to [0-9 ] in day conversion - if (!ereg( "([A-Za-z]{3})[-/\. ]([0-9 ]{1,2})[-/\. ]([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})" - ,$v, $rr)) return parent::UnixTimeStamp($v); - if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0; - - $themth = substr(strtoupper($rr[1]),0,3); - $themth = $ADODB_sybase_mths[$themth]; - if ($themth <= 0) return false; - - switch (strtoupper($rr[6])) { - case 'P': - if ($rr[4]<12) $rr[4] += 12; - break; - case 'A': - if ($rr[4]==12) $rr[4] = 0; - break; - default: - break; - } - // h-m-s-MM-DD-YY - return mktime($rr[4],$rr[5],0,$themth,$rr[2],$rr[3]); - } -} -?> diff --git a/framework/3rdParty/adodb/drivers/adodb-sybase_ase.inc.php b/framework/3rdParty/adodb/drivers/adodb-sybase_ase.inc.php deleted file mode 100644 index c0c783f8..00000000 --- a/framework/3rdParty/adodb/drivers/adodb-sybase_ase.inc.php +++ /dev/null @@ -1,115 +0,0 @@ -metaTablesSQL) { - // complicated state saving by the need for backward compat - - if ($ttype == 'VIEWS'){ - $sql = str_replace('U', 'V', $this->metaTablesSQL); - }elseif (false === $ttype){ - $sql = str_replace('U',"U' OR type='V", $this->metaTablesSQL); - }else{ // TABLES OR ANY OTHER - $sql = $this->metaTablesSQL; - } - $rs = $this->Execute($sql); - - if ($rs === false || !method_exists($rs, 'GetArray')){ - return $false; - } - $arr =& $rs->GetArray(); - - $arr2 = array(); - foreach($arr as $key=>$value){ - $arr2[] = trim($value['name']); - } - return $arr2; - } - return $false; - } - - function MetaDatabases() - { - $arr = array(); - if ($this->metaDatabasesSQL!='') { - $rs = $this->Execute($this->metaDatabasesSQL); - if ($rs && !$rs->EOF){ - while (!$rs->EOF){ - $arr[] = $rs->Fields('name'); - $rs->MoveNext(); - } - return $arr; - } - } - return false; - } - - // fix a bug which prevent the metaColumns query to be executed for Sybase ASE - function &MetaColumns($table,$upper=false) - { - $false = false; - if (!empty($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('field_name'); - $fld->type = $rs->Fields('type'); - $fld->max_length = $rs->Fields('width'); - $retarr[strtoupper($fld->name)] = $fld; - $rs->MoveNext(); - } - $rs->Close(); - return $retarr; - } - return $false; - } - - function getProcedureList($schema) - { - return false; - } - - function ErrorMsg() - { - if (!function_exists('sybase_connect')){ - return 'Your PHP doesn\'t contain the Sybase connection module!'; - } - return parent::ErrorMsg(); - } -} - -class adorecordset_sybase_ase extends ADORecordset_sybase { -var $databaseType = "sybase_ase"; -function ADORecordset_sybase_ase($id,$mode=false) - { - $this->ADORecordSet_sybase($id,$mode); - } - -} -?> \ No newline at end of file -- cgit v1.2.3