adodb 최신버전으로 변경
<? 를 <?php 로 변경
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/*
|
||||
V5.09 25 June 2009 (c) 2000-2009 John Lim. All rights reserved.
|
||||
@version v5.20.9 21-Dec-2016
|
||||
@copyright (c) 2000-2013 John Lim. All rights reserved.
|
||||
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
|
||||
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.
|
||||
@@ -31,7 +33,7 @@ class ADODB_informix72 extends ADOConnection {
|
||||
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,26 +55,26 @@ class ADODB_informix72 extends ADOConnection {
|
||||
var $sysDate = 'TODAY';
|
||||
var $sysTimeStamp = 'CURRENT';
|
||||
var $cursorType = IFX_SCROLL; // IFX_SCROLL or IFX_HOLD or 0
|
||||
|
||||
function ADODB_informix72()
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// 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_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 +106,8 @@ class ADODB_informix72 extends ADOConnection {
|
||||
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 +125,16 @@ class ADODB_informix72 extends ADOConnection {
|
||||
return true;
|
||||
}
|
||||
|
||||
function RowLock($tables,$where,$flds='1 as ignore')
|
||||
function RowLock($tables,$where,$col='1 as adodbignore')
|
||||
{
|
||||
if ($this->_autocommit) $this->BeginTrans();
|
||||
return $this->GetOne("select $flds from $tables where $where for update");
|
||||
return $this->GetOne("select $col 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();
|
||||
@@ -142,15 +144,60 @@ class ADODB_informix72 extends ADOConnection {
|
||||
function ErrorNo()
|
||||
{
|
||||
preg_match("/.*SQLCODE=([^\]]*)/",ifx_error(),$parse);
|
||||
if (is_array($parse) && isset($parse[1])) return (int)$parse[1];
|
||||
if (is_array($parse) && isset($parse[1])) return (int)$parse[1];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function MetaProcedures($NamePattern = false, $catalog = null, $schemaPattern = null)
|
||||
{
|
||||
// save old fetch mode
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
$false = false;
|
||||
$save = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||
if ($this->fetchMode !== FALSE) {
|
||||
$savem = $this->SetFetchMode(FALSE);
|
||||
|
||||
}
|
||||
$procedures = array ();
|
||||
|
||||
// get index details
|
||||
|
||||
$likepattern = '';
|
||||
if ($NamePattern) {
|
||||
$likepattern = " WHERE procname LIKE '".$NamePattern."'";
|
||||
}
|
||||
|
||||
$rs = $this->Execute('SELECT procname, isproc FROM sysprocedures'.$likepattern);
|
||||
|
||||
if (is_object($rs)) {
|
||||
// parse index data into array
|
||||
|
||||
while ($row = $rs->FetchRow()) {
|
||||
$procedures[$row[0]] = array(
|
||||
'type' => ($row[1] == 'f' ? 'FUNCTION' : 'PROCEDURE'),
|
||||
'catalog' => '',
|
||||
'schema' => '',
|
||||
'remarks' => ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// restore fetchmode
|
||||
if (isset($savem)) {
|
||||
$this->SetFetchMode($savem);
|
||||
}
|
||||
$ADODB_FETCH_MODE = $save;
|
||||
|
||||
return $procedures;
|
||||
}
|
||||
|
||||
function MetaColumns($table, $normalize=true)
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
|
||||
$false = false;
|
||||
if (!empty($this->metaColumnsSQL)) {
|
||||
$save = $ADODB_FETCH_MODE;
|
||||
@@ -187,18 +234,18 @@ class ADODB_informix72 extends ADOConnection {
|
||||
$fld->has_default = 0;
|
||||
}
|
||||
|
||||
$retarr[strtolower($fld->name)] = $fld;
|
||||
$retarr[strtolower($fld->name)] = $fld;
|
||||
$rs->MoveNext();
|
||||
}
|
||||
|
||||
$rs->Close();
|
||||
$rspkey->Close(); //!eos
|
||||
return $retarr;
|
||||
return $retarr;
|
||||
}
|
||||
|
||||
return $false;
|
||||
}
|
||||
|
||||
|
||||
function xMetaColumns($table)
|
||||
{
|
||||
return ADOConnection::MetaColumns($table,false);
|
||||
@@ -247,15 +294,15 @@ class ADODB_informix72 extends ADOConnection {
|
||||
{
|
||||
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);
|
||||
@@ -266,9 +313,9 @@ class ADODB_informix72 extends ADOConnection {
|
||||
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);
|
||||
@@ -287,7 +334,7 @@ class ADODB_informix72 extends ADOConnection {
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
global $ADODB_COUNTRECS;
|
||||
|
||||
|
||||
// String parameters have to be converted using ifx_create_char
|
||||
if ($inputarr) {
|
||||
foreach($inputarr as $v) {
|
||||
@@ -331,7 +378,10 @@ class ADODB_informix72 extends ADOConnection {
|
||||
function _close()
|
||||
{
|
||||
$this->lastQuery = false;
|
||||
return ifx_close($this->_connectionID);
|
||||
if($this->_connectionID) {
|
||||
return ifx_close($this->_connectionID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,14 +396,14 @@ class ADORecordset_informix72 extends ADORecordSet {
|
||||
var $canSeek = true;
|
||||
var $_fieldprops = false;
|
||||
|
||||
function ADORecordset_informix72($id,$mode=false)
|
||||
function __construct($id,$mode=false)
|
||||
{
|
||||
if ($mode === false) {
|
||||
if ($mode === false) {
|
||||
global $ADODB_FETCH_MODE;
|
||||
$mode = $ADODB_FETCH_MODE;
|
||||
}
|
||||
$this->fetchMode = $mode;
|
||||
return $this->ADORecordSet($id);
|
||||
return parent::__construct($id);
|
||||
}
|
||||
|
||||
|
||||
@@ -369,7 +419,7 @@ class ADORecordset_informix72 extends ADORecordSet {
|
||||
foreach($fp as $k => $v) {
|
||||
$o = new ADOFieldObject;
|
||||
$o->name = $k;
|
||||
$arr = split(';',$v); //"SQLTYPE;length;precision;scale;ISNULLABLE"
|
||||
$arr = explode(';',$v); //"SQLTYPE;length;precision;scale;ISNULLABLE"
|
||||
$o->type = $arr[0];
|
||||
$o->max_length = $arr[1];
|
||||
$this->_fieldprops[] = $o;
|
||||
@@ -443,7 +493,10 @@ class ADORecordset_informix72 extends ADORecordSet {
|
||||
is running. All associated result memory for the specified result identifier will automatically be freed. */
|
||||
function _close()
|
||||
{
|
||||
return ifx_free_result($this->_queryID);
|
||||
if($this->_queryID) {
|
||||
return ifx_free_result($this->_queryID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -470,6 +523,3 @@ function ifx_props($coltype,$collength){
|
||||
}
|
||||
return array($mtype,$length,$precision,$nullable);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user