forked from devsam/core
adodb 최신버전으로 변경
<? 를 <?php 로 변경
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/*
|
||||
V5.09 25 June 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
@version v5.20.9 21-Dec-2016
|
||||
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). 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. See License.txt.
|
||||
@@ -33,7 +35,7 @@ class ADODB_odbtp extends ADOConnection{
|
||||
var $_canPrepareSP = false;
|
||||
var $_dontPoolDBC = true;
|
||||
|
||||
function ADODB_odbtp()
|
||||
function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -61,23 +63,23 @@ class ADODB_odbtp extends ADOConnection{
|
||||
{
|
||||
if (empty($d) && $d !== 0) return 'null';
|
||||
if ($isfld) return "convert(date, $d, 120)";
|
||||
|
||||
|
||||
if (is_string($d)) $d = ADORecordSet::UnixDate($d);
|
||||
$d = adodb_date($this->fmtDate,$d);
|
||||
return "convert(date, $d, 120)";
|
||||
return "convert(date, $d, 120)";
|
||||
}
|
||||
|
||||
|
||||
function DBTimeStamp($d,$isfld=false)
|
||||
{
|
||||
if (empty($d) && $d !== 0) return 'null';
|
||||
if ($isfld) return "convert(datetime, $d, 120)";
|
||||
|
||||
|
||||
if (is_string($d)) $d = ADORecordSet::UnixDate($d);
|
||||
$d = adodb_date($this->fmtDate,$d);
|
||||
return "convert(datetime, $d, 120)";
|
||||
return "convert(datetime, $d, 120)";
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
function _insertid()
|
||||
{
|
||||
// SCOPE_IDENTITY()
|
||||
@@ -120,7 +122,7 @@ class ADODB_odbtp extends ADOConnection{
|
||||
return $this->Execute("insert into adodb_seq values('$seqname',$start)");
|
||||
}
|
||||
|
||||
function DropSequence($seqname)
|
||||
function DropSequence($seqname = 'adodbseq')
|
||||
{
|
||||
if (empty($this->_dropSeqSQL)) return false;
|
||||
return $this->Execute(sprintf($this->_dropSeqSQL,$seqname));
|
||||
@@ -172,14 +174,17 @@ class ADODB_odbtp extends ADOConnection{
|
||||
//if uid & pwd can be separate
|
||||
function _connect($HostOrInterface, $UserOrDSN='', $argPassword='', $argDatabase='')
|
||||
{
|
||||
$this->_connectionID = odbtp_connect($HostOrInterface,$UserOrDSN,$argPassword,$argDatabase);
|
||||
if ($argPassword && stripos($UserOrDSN,'DRIVER=') !== false) {
|
||||
$this->_connectionID = odbtp_connect($HostOrInterface,$UserOrDSN.';PWD='.$argPassword);
|
||||
} else
|
||||
$this->_connectionID = odbtp_connect($HostOrInterface,$UserOrDSN,$argPassword,$argDatabase);
|
||||
if ($this->_connectionID === false) {
|
||||
$this->_errorMsg = $this->ErrorMsg() ;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
odbtp_convert_datetime($this->_connectionID,true);
|
||||
|
||||
|
||||
if ($this->_dontPoolDBC) {
|
||||
if (function_exists('odbtp_dont_pool_dbc'))
|
||||
@odbtp_dont_pool_dbc($this->_connectionID);
|
||||
@@ -190,7 +195,7 @@ class ADODB_odbtp extends ADOConnection{
|
||||
$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';
|
||||
@@ -295,7 +300,7 @@ class ADODB_odbtp extends ADOConnection{
|
||||
$this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function MetaTables($ttype='',$showSchema=false,$mask=false)
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
@@ -303,9 +308,9 @@ class ADODB_odbtp extends ADOConnection{
|
||||
$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;
|
||||
|
||||
@@ -317,7 +322,7 @@ class ADODB_odbtp extends ADOConnection{
|
||||
}
|
||||
return $arr2;
|
||||
}
|
||||
|
||||
|
||||
function MetaColumns($table,$upper=true)
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
@@ -329,9 +334,9 @@ class ADODB_odbtp extends ADOConnection{
|
||||
$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;
|
||||
|
||||
@@ -399,7 +404,7 @@ class ADODB_odbtp extends ADOConnection{
|
||||
$false = false;
|
||||
return $false;
|
||||
}
|
||||
|
||||
|
||||
$arr2 = array();
|
||||
|
||||
foreach($arr as $k => $v) {
|
||||
@@ -460,10 +465,10 @@ class ADODB_odbtp extends ADOConnection{
|
||||
function Prepare($sql)
|
||||
{
|
||||
if (! $this->_bindInputArray) return $sql; // no binding
|
||||
|
||||
|
||||
$this->_errorMsg = false;
|
||||
$this->_errorCode = false;
|
||||
|
||||
|
||||
$stmt = @odbtp_prepare($sql,$this->_connectionID);
|
||||
if (!$stmt) {
|
||||
// print "Prepare Error for ($sql) ".$this->ErrorMsg()."<br>";
|
||||
@@ -472,13 +477,13 @@ class ADODB_odbtp extends ADOConnection{
|
||||
return array($sql,$stmt,false);
|
||||
}
|
||||
|
||||
function PrepareSP($sql)
|
||||
function PrepareSP($sql, $param = true)
|
||||
{
|
||||
if (!$this->_canPrepareSP) return $sql; // Can't prepare procedures
|
||||
|
||||
$this->_errorMsg = false;
|
||||
$this->_errorCode = false;
|
||||
|
||||
|
||||
$stmt = @odbtp_prepare_proc($sql,$this->_connectionID);
|
||||
if (!$stmt) return false;
|
||||
return array($sql,$stmt);
|
||||
@@ -550,16 +555,16 @@ class ADODB_odbtp extends ADOConnection{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
function MetaIndexes_mssql($table,$primary=false)
|
||||
|
||||
function MetaIndexes_mssql($table,$primary=false, $owner = false)
|
||||
{
|
||||
$table = strtolower($this->qstr($table));
|
||||
|
||||
$sql = "SELECT i.name AS ind_name, C.name AS col_name, USER_NAME(O.uid) AS Owner, c.colid, k.Keyno,
|
||||
$sql = "SELECT i.name AS ind_name, C.name AS col_name, USER_NAME(O.uid) AS Owner, c.colid, k.Keyno,
|
||||
CASE WHEN I.indid BETWEEN 1 AND 254 AND (I.status & 2048 = 2048 OR I.Status = 16402 AND O.XType = 'V') THEN 1 ELSE 0 END AS IsPK,
|
||||
CASE WHEN I.status & 2 = 2 THEN 1 ELSE 0 END AS IsUnique
|
||||
FROM dbo.sysobjects o INNER JOIN dbo.sysindexes I ON o.id = i.id
|
||||
INNER JOIN dbo.sysindexkeys K ON I.id = K.id AND I.Indid = K.Indid
|
||||
FROM dbo.sysobjects o INNER JOIN dbo.sysindexes I ON o.id = i.id
|
||||
INNER JOIN dbo.sysindexkeys K ON I.id = K.id AND I.Indid = K.Indid
|
||||
INNER JOIN dbo.syscolumns c ON K.id = C.id AND K.colid = C.Colid
|
||||
WHERE LEFT(i.name, 8) <> '_WA_Sys_' AND o.status >= 0 AND lower(O.Name) = $table
|
||||
ORDER BY O.name, I.Name, K.keyno";
|
||||
@@ -570,7 +575,7 @@ class ADODB_odbtp extends ADOConnection{
|
||||
if ($this->fetchMode !== FALSE) {
|
||||
$savem = $this->SetFetchMode(FALSE);
|
||||
}
|
||||
|
||||
|
||||
$rs = $this->Execute($sql);
|
||||
if (isset($savem)) {
|
||||
$this->SetFetchMode($savem);
|
||||
@@ -584,13 +589,13 @@ class ADODB_odbtp extends ADOConnection{
|
||||
$indexes = array();
|
||||
while ($row = $rs->FetchRow()) {
|
||||
if ($primary && !$row[5]) continue;
|
||||
|
||||
|
||||
$indexes[$row[0]]['unique'] = $row[6];
|
||||
$indexes[$row[0]]['columns'][] = $row[1];
|
||||
}
|
||||
return $indexes;
|
||||
}
|
||||
|
||||
|
||||
function IfNull( $field, $ifNull )
|
||||
{
|
||||
switch( $this->odbc_driver ) {
|
||||
@@ -605,10 +610,10 @@ class ADODB_odbtp extends ADOConnection{
|
||||
function _query($sql,$inputarr=false)
|
||||
{
|
||||
global $php_errormsg;
|
||||
|
||||
|
||||
$this->_errorMsg = false;
|
||||
$this->_errorCode = false;
|
||||
|
||||
|
||||
if ($inputarr) {
|
||||
if (is_array($sql)) {
|
||||
$stmtid = $sql[1];
|
||||
@@ -625,7 +630,7 @@ class ADODB_odbtp extends ADOConnection{
|
||||
@odbtp_input( $stmtid, $param );
|
||||
@odbtp_set( $stmtid, $param, $inputarr[$param-1] );
|
||||
}*/
|
||||
|
||||
|
||||
$param = 1;
|
||||
foreach($inputarr as $v) {
|
||||
@odbtp_input( $stmtid, $param );
|
||||
@@ -633,7 +638,7 @@ class ADODB_odbtp extends ADOConnection{
|
||||
$param += 1;
|
||||
if ($param > $num_params) break;
|
||||
}
|
||||
|
||||
|
||||
if (!@odbtp_execute($stmtid) ) {
|
||||
return false;
|
||||
}
|
||||
@@ -665,14 +670,14 @@ class ADORecordSet_odbtp extends ADORecordSet {
|
||||
var $databaseType = 'odbtp';
|
||||
var $canSeek = true;
|
||||
|
||||
function ADORecordSet_odbtp($queryID,$mode=false)
|
||||
function __construct($queryID,$mode=false)
|
||||
{
|
||||
if ($mode === false) {
|
||||
global $ADODB_FETCH_MODE;
|
||||
$mode = $ADODB_FETCH_MODE;
|
||||
}
|
||||
$this->fetchMode = $mode;
|
||||
$this->ADORecordSet($queryID);
|
||||
parent::__construct($queryID);
|
||||
}
|
||||
|
||||
function _initrs()
|
||||
@@ -788,9 +793,9 @@ class ADORecordSet_odbtp_mssql extends ADORecordSet_odbtp {
|
||||
|
||||
var $databaseType = 'odbtp_mssql';
|
||||
|
||||
function ADORecordSet_odbtp_mssql($id,$mode=false)
|
||||
function __construct($id,$mode=false)
|
||||
{
|
||||
return $this->ADORecordSet_odbtp($id,$mode);
|
||||
return parent::__construct($id,$mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,9 +803,9 @@ class ADORecordSet_odbtp_access extends ADORecordSet_odbtp {
|
||||
|
||||
var $databaseType = 'odbtp_access';
|
||||
|
||||
function ADORecordSet_odbtp_access($id,$mode=false)
|
||||
function __construct($id,$mode=false)
|
||||
{
|
||||
return $this->ADORecordSet_odbtp($id,$mode);
|
||||
return parent::__construct($id,$mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -808,9 +813,9 @@ class ADORecordSet_odbtp_vfp extends ADORecordSet_odbtp {
|
||||
|
||||
var $databaseType = 'odbtp_vfp';
|
||||
|
||||
function ADORecordSet_odbtp_vfp($id,$mode=false)
|
||||
function __construct($id,$mode=false)
|
||||
{
|
||||
return $this->ADORecordSet_odbtp($id,$mode);
|
||||
return parent::__construct($id,$mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -818,9 +823,9 @@ class ADORecordSet_odbtp_oci8 extends ADORecordSet_odbtp {
|
||||
|
||||
var $databaseType = 'odbtp_oci8';
|
||||
|
||||
function ADORecordSet_odbtp_oci8($id,$mode=false)
|
||||
function __construct($id,$mode=false)
|
||||
{
|
||||
return $this->ADORecordSet_odbtp($id,$mode);
|
||||
return parent::__construct($id,$mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -828,9 +833,8 @@ class ADORecordSet_odbtp_sybase extends ADORecordSet_odbtp {
|
||||
|
||||
var $databaseType = 'odbtp_sybase';
|
||||
|
||||
function ADORecordSet_odbtp_sybase($id,$mode=false)
|
||||
function __construct($id,$mode=false)
|
||||
{
|
||||
return $this->ADORecordSet_odbtp($id,$mode);
|
||||
return parent::__construct($id,$mode);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user