【php开源代码栏目提醒】:以下是网学会员为您推荐的php开源代码-adodb-informix72.inc.php,希望本篇文章对您学习有所帮助。
<?php
/*
V4.21 20 Mar 2004 (c) 2000-2004 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.
Set tabs to 4 for best viewing.
Latest version is available at http://php.
weblogs.com/
Informix port by Mitchell T. Young (mitch@youngfamily.org)
Further mods by "Samuel CARRIERE" <samuel_carriere@hotmail.com>
*/
if (!defined('IFX_SCROLL')) define('IFX_SCROLL',1);
class ADODB_informix72 extends ADOConnection {
var $databaseType = "informix72";
var $dataProvider = "informix";
var $replaceQuote = "''"; // string to use to replace quotes
var $fmtDate = "'Y-m-d'";
var $fmtTimeStamp = "'Y-m-d H:i:s'";
var $hasInsertID = true;
var $hasAffectedRows = true;
var $upperCase = 'upper';
var $substr = 'substr';
var $metaTablesSQL="select tabname from systables";
var $metaColumnsSQL =
"select c.colname, c.coltype, c.collength, d.default
from syscolumns c, systables t,sysdefaults d
where c.tabid=t.tabid and d.tabid=t.tabid and d.colno=c.colno and tabname='%s'";
// var $metaColumnsSQL = "select colname, coltype, collength from syscolumns c, systables t where c.tabid=t.tabid and tabname='%s'";
var $concat_operator = '||';
var $lastQuery = false;
var $has_insertid = true;
var $_autocommit = true;
var $_bindInputArray = true; // set to true if ADOConnection.Execute() permits binding of array parameters.
var $sysDate = 'TODAY';
var $sysTimeStamp = 'CURRENT';
var $cursorType = IFX_SCROLL; // IFX_SCROLL or IFX_HOLD or 0
function ADODB_informix72()
{
// alternatively, use older method:
//putenv("DBDATE=Y4MD-");
// 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_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;
return $arr;
}
function _insertid()
{
$sqlca =ifx_getsqlca($this->lastQuery);
return @$sqlca["sqlerrd1"];
}
function _affectedrows()
{
if ($this->lastQuery) {
return @ifx_affected_rows ($this->lastQuery);
}
return 0;
}
function BeginTrans()
{
if ($this->transOff) return true;
$this->transCnt += 1;
$this->Execute('BEGIN');
$this->_autocommit = false;
return true;
}
function CommitTrans($ok=true)
{
if (!$ok) return $this->RollbackTrans();
if ($this->transOff) return true;
if ($this->transCnt) $this->transCnt -= 1;
$this->Execute('COMMIT');
$this->_autocommit = true;
return true;
}
function RollbackTrans()
{
if ($this->transOff) return true;
if ($this->transCnt) $this->transCnt -= 1;
$this->Execute('ROLLBACK');
$this->_autocommit = true;
return true;
}
function RowLock($tables,$where)
{
if ($this->_autocommit) $this->BeginTrans();
return $this->GetOne("select 1 as ignore 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()
{
if (!empty($this->_logsql)) return $this->_errorMsg;
$this->_errorMsg = ifx_errormsg();
return $this->_errorMsg;
}
function ErrorNo()
{
preg_match("/.*SQLCODE=([^\]]*)/",ifx_error(),$parse); //!EOS
if (is_array($parse) && isset($parse[1])) return (int)$parse[1];
return 0;
}
function &MetaColumns($table)
{
global $ADODB_FETCH_MODE;
if (!empty($this->metaColumnsSQL)) {
$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));
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
if ($rs === false) return false;
$retarr = array();
w