forked from extern/egroupware
imported ADOdb version 4.22:
it seems to fix some php5 probs the old version had
This commit is contained in:
parent
f51badf1ef
commit
0dd4cc1925
@ -3,7 +3,7 @@ global $ADODB_INCLUDED_CSV;
|
|||||||
$ADODB_INCLUDED_CSV = 1;
|
$ADODB_INCLUDED_CSV = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
@ -42,31 +42,30 @@ $ADODB_INCLUDED_CSV = 1;
|
|||||||
|
|
||||||
$text = "====-1,0,$sql\n";
|
$text = "====-1,0,$sql\n";
|
||||||
return $text;
|
return $text;
|
||||||
} else {
|
|
||||||
$tt = ($rs->timeCreated) ? $rs->timeCreated : time();
|
|
||||||
$line = "====0,$tt,$sql\n";
|
|
||||||
}
|
}
|
||||||
// column definitions
|
$tt = ($rs->timeCreated) ? $rs->timeCreated : time();
|
||||||
for($i=0; $i < $max; $i++) {
|
|
||||||
$o = $rs->FetchField($i);
|
|
||||||
$line .= urlencode($o->name).':'.$rs->MetaType($o->type,$o->max_length,$o).":$o->max_length,";
|
|
||||||
}
|
|
||||||
$text = substr($line,0,strlen($line)-1)."\n";
|
|
||||||
|
|
||||||
|
## changed format from ====0 to ====1
|
||||||
|
$line = "====1,$tt,$sql\n";
|
||||||
|
|
||||||
// get data
|
|
||||||
if ($rs->databaseType == 'array') {
|
if ($rs->databaseType == 'array') {
|
||||||
$text .= serialize($rs->_array);
|
$rows =& $rs->_array;
|
||||||
} else {
|
} else {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
while (!$rs->EOF) {
|
while (!$rs->EOF) {
|
||||||
$rows[] = $rs->fields;
|
$rows[] = $rs->fields;
|
||||||
$rs->MoveNext();
|
$rs->MoveNext();
|
||||||
}
|
}
|
||||||
$text .= serialize($rows);
|
|
||||||
}
|
}
|
||||||
$rs->MoveFirst();
|
|
||||||
return $text;
|
for($i=0; $i < $max; $i++) {
|
||||||
|
$o =& $rs->FetchField($i);
|
||||||
|
$flds[] = $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rs =& new ADORecordSet_array();
|
||||||
|
$rs->InitArrayFields($rows,$flds);
|
||||||
|
return $line.serialize($rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,9 +92,9 @@ $ADODB_INCLUDED_CSV = 1;
|
|||||||
$arr = array();
|
$arr = array();
|
||||||
$ttl = 0;
|
$ttl = 0;
|
||||||
|
|
||||||
if ($meta = fgetcsv ($fp, 32000, ",")) {
|
if ($meta = fgetcsv($fp, 32000, ",")) {
|
||||||
// check if error message
|
// check if error message
|
||||||
if (substr($meta[0],0,4) === '****') {
|
if (strncmp($meta[0],'****',4) === 0) {
|
||||||
$err = trim(substr($meta[0],4,1024));
|
$err = trim(substr($meta[0],4,1024));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
return false;
|
return false;
|
||||||
@ -104,7 +103,7 @@ $ADODB_INCLUDED_CSV = 1;
|
|||||||
// $meta[0] is -1 means return an empty recordset
|
// $meta[0] is -1 means return an empty recordset
|
||||||
// $meta[1] contains a time
|
// $meta[1] contains a time
|
||||||
|
|
||||||
if (substr($meta[0],0,4) === '====') {
|
if (strncmp($meta[0], '====',4) === 0) {
|
||||||
|
|
||||||
if ($meta[0] == "====-1") {
|
if ($meta[0] == "====-1") {
|
||||||
if (sizeof($meta) < 5) {
|
if (sizeof($meta) < 5) {
|
||||||
@ -120,7 +119,7 @@ $ADODB_INCLUDED_CSV = 1;
|
|||||||
}
|
}
|
||||||
$rs->fields = array();
|
$rs->fields = array();
|
||||||
$rs->timeCreated = $meta[1];
|
$rs->timeCreated = $meta[1];
|
||||||
$rs = new ADORecordSet($val=true);
|
$rs =& new ADORecordSet($val=true);
|
||||||
$rs->EOF = true;
|
$rs->EOF = true;
|
||||||
$rs->_numOfFields=0;
|
$rs->_numOfFields=0;
|
||||||
$rs->sql = urldecode($meta[2]);
|
$rs->sql = urldecode($meta[2]);
|
||||||
@ -130,16 +129,25 @@ $ADODB_INCLUDED_CSV = 1;
|
|||||||
}
|
}
|
||||||
# Under high volume loads, we want only 1 thread/process to _write_file
|
# Under high volume loads, we want only 1 thread/process to _write_file
|
||||||
# so that we don't have 50 processes queueing to write the same data.
|
# so that we don't have 50 processes queueing to write the same data.
|
||||||
# Would require probabilistic blocking write
|
# We use probabilistic timeout, ahead of time.
|
||||||
#
|
#
|
||||||
# -2 sec before timeout, give processes 1/16 chance of writing to file with blocking io
|
# -4 sec before timeout, give processes 1/32 chance of timing out
|
||||||
# -1 sec after timeout give processes 1/4 chance of writing with blocking
|
# -2 sec before timeout, give processes 1/16 chance of timing out
|
||||||
# +0 sec after timeout, give processes 100% chance writing with blocking
|
# -1 sec after timeout give processes 1/4 chance of timing out
|
||||||
|
# +0 sec after timeout, give processes 100% chance of timing out
|
||||||
if (sizeof($meta) > 1) {
|
if (sizeof($meta) > 1) {
|
||||||
if($timeout >0){
|
if($timeout >0){
|
||||||
$tdiff = $meta[1]+$timeout - time();
|
$tdiff = (integer)( $meta[1]+$timeout - time());
|
||||||
if ($tdiff <= 2) {
|
if ($tdiff <= 2) {
|
||||||
switch($tdiff) {
|
switch($tdiff) {
|
||||||
|
case 4:
|
||||||
|
case 3:
|
||||||
|
if ((rand() & 31) == 0) {
|
||||||
|
fclose($fp);
|
||||||
|
$err = "Timeout 3";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if ((rand() & 15) == 0) {
|
if ((rand() & 15) == 0) {
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
@ -164,8 +172,26 @@ $ADODB_INCLUDED_CSV = 1;
|
|||||||
}// (timeout>0)
|
}// (timeout>0)
|
||||||
$ttl = $meta[1];
|
$ttl = $meta[1];
|
||||||
}
|
}
|
||||||
|
//================================================
|
||||||
|
// new cache format - use serialize extensively...
|
||||||
|
if ($meta[0] === '====1') {
|
||||||
|
// slurp in the data
|
||||||
|
$MAXSIZE = 128000;
|
||||||
|
|
||||||
|
$text = fread($fp,$MAXSIZE);
|
||||||
|
if (strlen($text) === $MAXSIZE) {
|
||||||
|
while ($txt = fread($fp,$MAXSIZE)) {
|
||||||
|
$text .= $txt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
@$rs = unserialize($text);
|
||||||
|
if (is_object($rs)) $rs->timeCreated = $ttl;
|
||||||
|
return $rs;
|
||||||
|
}
|
||||||
|
|
||||||
$meta = false;
|
$meta = false;
|
||||||
$meta = fgetcsv($fp, 16000, ",");
|
$meta = fgetcsv($fp, 32000, ",");
|
||||||
if (!$meta) {
|
if (!$meta) {
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
$err = "Unexpected EOF 1";
|
$err = "Unexpected EOF 1";
|
||||||
@ -182,7 +208,7 @@ $ADODB_INCLUDED_CSV = 1;
|
|||||||
$flds = false;
|
$flds = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$fld = new ADOFieldObject();
|
$fld =& new ADOFieldObject();
|
||||||
$fld->name = urldecode($o2[0]);
|
$fld->name = urldecode($o2[0]);
|
||||||
$fld->type = $o2[1];
|
$fld->type = $o2[1];
|
||||||
$fld->max_length = $o2[2];
|
$fld->max_length = $o2[2];
|
||||||
@ -203,14 +229,14 @@ $ADODB_INCLUDED_CSV = 1;
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
$arr = @unserialize($text);
|
@$arr = unserialize($text);
|
||||||
//var_dump($arr);
|
//var_dump($arr);
|
||||||
if (!is_array($arr)) {
|
if (!is_array($arr)) {
|
||||||
$err = "Recordset had unexpected EOF (in serialized recordset)";
|
$err = "Recordset had unexpected EOF (in serialized recordset)";
|
||||||
if (get_magic_quotes_runtime()) $err .= ". Magic Quotes Runtime should be disabled!";
|
if (get_magic_quotes_runtime()) $err .= ". Magic Quotes Runtime should be disabled!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$rs = new ADORecordSet_array();
|
$rs =& new ADORecordSet_array();
|
||||||
$rs->timeCreated = $ttl;
|
$rs->timeCreated = $ttl;
|
||||||
$rs->InitArrayFields($arr,$flds);
|
$rs->InitArrayFields($arr,$flds);
|
||||||
return $rs;
|
return $rs;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
@ -645,10 +645,13 @@ class ADODB_DataDict {
|
|||||||
*/
|
*/
|
||||||
function ChangeTableSQL($tablename, $flds, $tableoptions = false)
|
function ChangeTableSQL($tablename, $flds, $tableoptions = false)
|
||||||
{
|
{
|
||||||
if ( !is_array($cols = &$this->MetaColumns($tablename)) ) {
|
// check table exists
|
||||||
|
$cols = &$this->MetaColumns($tablename);
|
||||||
|
if ( empty($cols)) {
|
||||||
return $this->CreateTableSQL($tablename, $flds, $tableoptions);
|
return $this->CreateTableSQL($tablename, $flds, $tableoptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// already exists, alter table instead
|
||||||
list($lines,$pkey) = $this->_GenFields($flds);
|
list($lines,$pkey) = $this->_GenFields($flds);
|
||||||
$alter = 'ALTER TABLE ' . $this->TableName($tablename);
|
$alter = 'ALTER TABLE ' . $this->TableName($tablename);
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
* Whenever there is any discrepancy between the two licenses,
|
* Whenever there is any discrepancy between the two licenses,
|
||||||
* the BSD license will take precedence.
|
* the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
* Whenever there is any discrepancy between the two licenses,
|
* Whenever there is any discrepancy between the two licenses,
|
||||||
* the BSD license will take precedence.
|
* the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
* Whenever there is any discrepancy between the two licenses,
|
* Whenever there is any discrepancy between the two licenses,
|
||||||
* the BSD license will take precedence.
|
* the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
@ -14,9 +14,12 @@
|
|||||||
foreach($rs as $k => $v) {
|
foreach($rs as $k => $v) {
|
||||||
echo $k; print_r($v); echo "<br>";
|
echo $k; print_r($v); echo "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Iterator code based on http://cvs.php.net/cvs.php/php-src/ext/spl/examples/cachingiterator.inc?login=2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ADODB_Iterator implements Iterator {
|
class ADODB_Iterator implements Iterator {
|
||||||
|
|
||||||
private $rs;
|
private $rs;
|
||||||
|
|
||||||
@ -28,22 +31,38 @@ class ADODB_Iterator implements Iterator {
|
|||||||
{
|
{
|
||||||
$this->rs->MoveFirst();
|
$this->rs->MoveFirst();
|
||||||
}
|
}
|
||||||
function hasMore()
|
|
||||||
|
function valid()
|
||||||
{
|
{
|
||||||
return !$this->rs->EOF;
|
return !$this->rs->EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
function key()
|
function key()
|
||||||
{
|
{
|
||||||
return $this->rs->_currentRow;
|
return $this->rs->_currentRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
function current()
|
function current()
|
||||||
{
|
{
|
||||||
return $this->rs->fields;
|
return $this->rs->fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
function next()
|
function next()
|
||||||
{
|
{
|
||||||
$this->rs->MoveNext();
|
$this->rs->MoveNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __call($func, $params)
|
||||||
|
{
|
||||||
|
return call_user_func_array(array($this->rs, $func), $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
function __toString()
|
||||||
|
{
|
||||||
|
return 'ADODB Iterator';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ global $ADODB_INCLUDED_LIB;
|
|||||||
$ADODB_INCLUDED_LIB = 1;
|
$ADODB_INCLUDED_LIB = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
@version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim\@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
@ -20,9 +20,9 @@ function _array_change_key_case($an_array)
|
|||||||
{
|
{
|
||||||
if (is_array($an_array)) {
|
if (is_array($an_array)) {
|
||||||
foreach($an_array as $key=>$value)
|
foreach($an_array as $key=>$value)
|
||||||
$new_array[strtoupper($key)] = $value;
|
$new_array[strtoupper($key)] = $value;
|
||||||
|
|
||||||
return $new_array;
|
return $new_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $an_array;
|
return $an_array;
|
||||||
@ -123,12 +123,12 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f
|
|||||||
|
|
||||||
$value = '';
|
$value = '';
|
||||||
while(!$zthis->EOF) {
|
while(!$zthis->EOF) {
|
||||||
$zval = trim(reset($zthis->fields));
|
$zval = rtrim(reset($zthis->fields));
|
||||||
if (sizeof($zthis->fields) > 1) {
|
if (sizeof($zthis->fields) > 1) {
|
||||||
if (isset($zthis->fields[1]))
|
if (isset($zthis->fields[1]))
|
||||||
$zval2 = trim($zthis->fields[1]);
|
$zval2 = rtrim($zthis->fields[1]);
|
||||||
else
|
else
|
||||||
$zval2 = trim(next($zthis->fields));
|
$zval2 = rtrim(next($zthis->fields));
|
||||||
}
|
}
|
||||||
$selected = ($compareFields0) ? $zval : $zval2;
|
$selected = ($compareFields0) ? $zval : $zval2;
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
|
|||||||
$rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$sql);
|
$rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$sql);
|
||||||
$rstest = &$zthis->Execute($rewritesql,$inputarr);
|
$rstest = &$zthis->Execute($rewritesql,$inputarr);
|
||||||
if ($rstest) {
|
if ($rstest) {
|
||||||
$qryRecs = $rstest->RecordCount();
|
$qryRecs = $rstest->RecordCount();
|
||||||
if ($qryRecs == -1) {
|
if ($qryRecs == -1) {
|
||||||
global $ADODB_EXTENSION;
|
global $ADODB_EXTENSION;
|
||||||
// some databases will return -1 on MoveLast() - change to MoveNext()
|
// some databases will return -1 on MoveLast() - change to MoveNext()
|
||||||
@ -358,11 +358,10 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
|
|||||||
$arrFields = _array_change_key_case($arrFields);
|
$arrFields = _array_change_key_case($arrFields);
|
||||||
|
|
||||||
$hasnumeric = isset($rs->fields[0]);
|
$hasnumeric = isset($rs->fields[0]);
|
||||||
$updateSQL = '';
|
$setFields = '';
|
||||||
|
|
||||||
// Loop through all of the fields in the recordset
|
// Loop through all of the fields in the recordset
|
||||||
for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) {
|
for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) {
|
||||||
|
|
||||||
// Get the field from the recordset
|
// Get the field from the recordset
|
||||||
$field = $rs->FetchField($i);
|
$field = $rs->FetchField($i);
|
||||||
|
|
||||||
@ -382,52 +381,36 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
|
|||||||
else if (isset($rs->fields[strtolower($upperfname)])) $val = $rs->fields[strtolower($upperfname)];
|
else if (isset($rs->fields[strtolower($upperfname)])) $val = $rs->fields[strtolower($upperfname)];
|
||||||
else $val = '';
|
else $val = '';
|
||||||
|
|
||||||
|
|
||||||
if ($forceUpdate || strcmp($val, $arrFields[$upperfname])) {
|
if ($forceUpdate || strcmp($val, $arrFields[$upperfname])) {
|
||||||
// Set the counter for the number of fields that will be updated.
|
// Set the counter for the number of fields that will be updated.
|
||||||
$fieldUpdatedCount++;
|
$fieldUpdatedCount++;
|
||||||
|
|
||||||
// Based on the datatype of the field
|
// Based on the datatype of the field
|
||||||
// Format the value properly for the database
|
// Format the value properly for the database
|
||||||
$mt = $rs->MetaType($field->type);
|
$type = $rs->MetaType($field->type);
|
||||||
|
|
||||||
// "mike" <mike@partner2partner.com> patch and "Ryan Bailey" <rebel@windriders.com>
|
|
||||||
//PostgreSQL uses a 't' or 'f' and therefore needs to be processed as a string ('C') type field.
|
|
||||||
if ((strncmp($zthis->databaseType,"postgres",8) === 0) && ($mt == "L")) $mt = "C";
|
|
||||||
// is_null requires php 4.0.4
|
// is_null requires php 4.0.4
|
||||||
if ((defined('ADODB_FORCE_NULLS') && is_null($arrFields[$upperfname])) || $arrFields[$upperfname] === 'null')
|
if ((defined('ADODB_FORCE_NULLS') && is_null($arrFields[$upperfname])) ||
|
||||||
$updateSQL .= $field->name . " = null, ";
|
$arrFields[$upperfname] === 'null') {
|
||||||
else
|
$setFields .= $field->name . " = null, ";
|
||||||
switch($mt) {
|
} else {
|
||||||
case 'null':
|
if ($type == 'null') {
|
||||||
case "C":
|
$type = 'C';
|
||||||
case "X":
|
}
|
||||||
case 'B':
|
//we do this so each driver can customize the sql for
|
||||||
$updateSQL .= $field->name . " = " . $zthis->qstr($arrFields[$upperfname],$magicq) . ", ";
|
//DB specific column types.
|
||||||
break;
|
//Oracle needs BLOB types to be handled with a returning clause
|
||||||
case "D":
|
//postgres has special needs as well
|
||||||
$updateSQL .= $field->name . " = " . $zthis->DBDate($arrFields[$upperfname]) . ", ";
|
$setFields .= _adodb_column_sql($zthis, 'U', $type, $upperfname,
|
||||||
break;
|
$arrFields, $magicq);
|
||||||
case "T":
|
}
|
||||||
$updateSQL .= $field->name . " = " . $zthis->DBTimeStamp($arrFields[$upperfname]) . ", ";
|
}
|
||||||
break;
|
}
|
||||||
default:
|
}
|
||||||
$val = $arrFields[$upperfname];
|
|
||||||
/*if (!is_numeric($val)) {
|
|
||||||
if (strncmp($val,'=',1) == 0) $val = substr($val,1);
|
|
||||||
else $val = (float) $val;
|
|
||||||
}*/
|
|
||||||
if (empty($val)) $val = '0';
|
|
||||||
|
|
||||||
$updateSQL .= $field->name . " = " . $val . ", ";
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// If there were any modified fields then build the rest of the update query.
|
// If there were any modified fields then build the rest of the update query.
|
||||||
if ($fieldUpdatedCount > 0 || $forceUpdate) {
|
if ($fieldUpdatedCount > 0 || $forceUpdate) {
|
||||||
|
|
||||||
// Get the table name from the existing query.
|
// Get the table name from the existing query.
|
||||||
preg_match("/FROM\s+".ADODB_TABLE_REGEX."/is", $rs->sql, $tableName);
|
preg_match("/FROM\s+".ADODB_TABLE_REGEX."/is", $rs->sql, $tableName);
|
||||||
|
|
||||||
@ -445,18 +428,15 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq
|
|||||||
if ($discard)
|
if ($discard)
|
||||||
$whereClause[1] = substr($whereClause[1], 0, strlen($whereClause[1]) - strlen($discard[1]));
|
$whereClause[1] = substr($whereClause[1], 0, strlen($whereClause[1]) - strlen($discard[1]));
|
||||||
|
|
||||||
// updateSQL will contain the full update query when all
|
$sql = 'UPDATE '.$tableName[1].' SET '.substr($setFields, 0, -2);
|
||||||
// processing has completed.
|
if (strlen($whereClause[1]) > 0)
|
||||||
$updateSQL = "UPDATE " . $tableName[1] . " SET ".substr($updateSQL, 0, -2);
|
$sql .= ' WHERE '.$whereClause[1];
|
||||||
|
|
||||||
// If the recordset has a where clause then use that same where clause
|
return $sql;
|
||||||
// for the update.
|
|
||||||
if ($whereClause[1]) $updateSQL .= " WHERE " . $whereClause[1];
|
|
||||||
|
|
||||||
return $updateSQL;
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function adodb_key_exists($key, &$arr)
|
function adodb_key_exists($key, &$arr)
|
||||||
@ -472,26 +452,47 @@ function adodb_key_exists($key, &$arr)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There is a special case of this function for the oci8 driver.
|
||||||
|
* The proper way to handle an insert w/ a blob in oracle requires
|
||||||
|
* a returning clause with bind variables and a descriptor blob.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false)
|
function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false)
|
||||||
{
|
{
|
||||||
|
$tableName = '';
|
||||||
$values = '';
|
$values = '';
|
||||||
$fields = '';
|
$fields = '';
|
||||||
|
$recordSet = null;
|
||||||
$arrFields = _array_change_key_case($arrFields);
|
$arrFields = _array_change_key_case($arrFields);
|
||||||
|
$fieldInsertedCount = 0;
|
||||||
|
|
||||||
if (!$rs) {
|
if (is_string($rs)) {
|
||||||
|
//ok we have a table name
|
||||||
|
//try and get the column info ourself.
|
||||||
|
$tableName = $rs;
|
||||||
|
|
||||||
|
//we need an object for the recordSet
|
||||||
|
//because we have to call MetaType.
|
||||||
|
//php can't do a $rsclass::MetaType()
|
||||||
|
$rsclass = $zthis->rsPrefix.$zthis->databaseType;
|
||||||
|
$recordSet =& new $rsclass(-1,$zthis->fetchMode);
|
||||||
|
$recordSet->connection = &$zthis;
|
||||||
|
|
||||||
|
$columns = $zthis->MetaColumns( $tableName );
|
||||||
|
} else if (is_subclass_of($rs, 'adorecordset')) {
|
||||||
|
for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++)
|
||||||
|
$columns[] = $rs->FetchField($i);
|
||||||
|
$recordSet =& $rs;
|
||||||
|
|
||||||
|
} else {
|
||||||
printf(ADODB_BAD_RS,'GetInsertSQL');
|
printf(ADODB_BAD_RS,'GetInsertSQL');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fieldInsertedCount = 0;
|
|
||||||
|
|
||||||
// Loop through all of the fields in the recordset
|
// Loop through all of the fields in the recordset
|
||||||
for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) {
|
foreach( $columns as $field ) {
|
||||||
|
|
||||||
// Get the field from the recordset
|
|
||||||
$field = $rs->FetchField($i);
|
|
||||||
// If the recordset field is one
|
|
||||||
// of the fields passed in then process.
|
|
||||||
$upperfname = strtoupper($field->name);
|
$upperfname = strtoupper($field->name);
|
||||||
if (adodb_key_exists($upperfname,$arrFields)) {
|
if (adodb_key_exists($upperfname,$arrFields)) {
|
||||||
|
|
||||||
@ -501,47 +502,31 @@ function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false)
|
|||||||
// Get the name of the fields to insert
|
// Get the name of the fields to insert
|
||||||
$fields .= $field->name . ", ";
|
$fields .= $field->name . ", ";
|
||||||
|
|
||||||
$mt = $rs->MetaType($field->type);
|
$type = $recordSet->MetaType($field->type);
|
||||||
|
|
||||||
// "mike" <mike@partner2partner.com> patch and "Ryan Bailey" <rebel@windriders.com>
|
if ((defined('ADODB_FORCE_NULLS') && is_null($arrFields[$upperfname])) ||
|
||||||
//PostgreSQL uses a 't' or 'f' and therefore needs to be processed as a string ('C') type field.
|
$arrFields[$upperfname] === 'null') {
|
||||||
if ((strncmp($zthis->databaseType,"postgres",8) === 0) && ($mt == "L")) $mt = "C";
|
$values .= "null, ";
|
||||||
|
} else {
|
||||||
|
//we do this so each driver can customize the sql for
|
||||||
|
//DB specific column types.
|
||||||
|
//Oracle needs BLOB types to be handled with a returning clause
|
||||||
|
//postgres has special needs as well
|
||||||
|
$values .= _adodb_column_sql($zthis, 'I', $type, $upperfname,
|
||||||
|
$arrFields, $magicq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Based on the datatype of the field
|
|
||||||
// Format the value properly for the database
|
|
||||||
if ((defined('ADODB_FORCE_NULLS') && is_null($arrFields[$upperfname])) || $arrFields[$upperfname] === 'null')
|
|
||||||
$values .= "null, ";
|
|
||||||
else
|
|
||||||
switch($mt) {
|
|
||||||
case "C":
|
|
||||||
case "X":
|
|
||||||
case 'B':
|
|
||||||
$values .= $zthis->qstr($arrFields[$upperfname],$magicq) . ", ";
|
|
||||||
break;
|
|
||||||
case "D":
|
|
||||||
$values .= $zthis->DBDate($arrFields[$upperfname]) . ", ";
|
|
||||||
break;
|
|
||||||
case "T":
|
|
||||||
$values .= $zthis->DBTimeStamp($arrFields[$upperfname]) . ", ";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$val = $arrFields[$upperfname];
|
|
||||||
/*if (!is_numeric($val)) {
|
|
||||||
if (strncmp($val,'=',1) == 0) $val = substr($val,1);
|
|
||||||
else $val = (float) $val;
|
|
||||||
}*/
|
|
||||||
if (empty($val)) $val = '0';
|
|
||||||
$values .= $val . ", ";
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// If there were any inserted fields then build the rest of the insert query.
|
// If there were any inserted fields then build the rest of the insert query.
|
||||||
if ($fieldInsertedCount <= 0) return false;
|
if ($fieldInsertedCount <= 0) return false;
|
||||||
|
|
||||||
// Get the table name from the existing query.
|
// Get the table name from the existing query.
|
||||||
preg_match("/FROM\s+".ADODB_TABLE_REGEX."/is", $rs->sql, $tableName);
|
if (!$tableName) {
|
||||||
|
preg_match("/FROM\s+".ADODB_TABLE_REGEX."/is", $rs->sql, $tableName);
|
||||||
|
$tableName = $tableName[1];
|
||||||
|
}
|
||||||
|
|
||||||
// Strip off the comma and space on the end of both the fields
|
// Strip off the comma and space on the end of both the fields
|
||||||
// and their values.
|
// and their values.
|
||||||
@ -549,10 +534,142 @@ function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false)
|
|||||||
$values = substr($values, 0, -2);
|
$values = substr($values, 0, -2);
|
||||||
|
|
||||||
// Append the fields and their values to the insert query.
|
// Append the fields and their values to the insert query.
|
||||||
$insertSQL = "INSERT INTO " . $tableName[1] . " ( $fields ) VALUES ( $values )";
|
return 'INSERT INTO '.$tableName.' ( '.$fields.' ) VALUES ( '.$values.' )';
|
||||||
|
|
||||||
return $insertSQL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This private method is used to help construct
|
||||||
|
* the update/sql which is generated by GetInsertSQL and GetUpdateSQL.
|
||||||
|
* It handles the string construction of 1 column -> sql string based on
|
||||||
|
* the column type. We want to do 'safe' handling of BLOBs
|
||||||
|
*
|
||||||
|
* @param string the type of sql we are trying to create
|
||||||
|
* 'I' or 'U'.
|
||||||
|
* @param string column data type from the db::MetaType() method
|
||||||
|
* @param string the column name
|
||||||
|
* @param array the column value
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function _adodb_column_sql_oci8(&$zthis,$action, $type, $fname, $arrFields, $magicq)
|
||||||
|
{
|
||||||
|
$sql = '';
|
||||||
|
|
||||||
|
// Based on the datatype of the field
|
||||||
|
// Format the value properly for the database
|
||||||
|
switch($type) {
|
||||||
|
case 'B':
|
||||||
|
//in order to handle Blobs correctly, we need
|
||||||
|
//to do some magic for Oracle
|
||||||
|
|
||||||
|
//we need to create a new descriptor to handle
|
||||||
|
//this properly
|
||||||
|
if (!empty($zthis->hasReturningInto)) {
|
||||||
|
if ($action == 'I') {
|
||||||
|
$sql = 'empty_blob(), ';
|
||||||
|
} else {
|
||||||
|
$sql = $fname. '=empty_blob(), ';
|
||||||
|
}
|
||||||
|
//add the variable to the returning clause array
|
||||||
|
//so the user can build this later in
|
||||||
|
//case they want to add more to it
|
||||||
|
$zthis->_returningArray[$fname] = ':xx'.$fname.'xx';
|
||||||
|
} else {
|
||||||
|
//this is to maintain compatibility
|
||||||
|
//with older adodb versions.
|
||||||
|
$sql = _adodb_column_sql($zthis, $action, $type, $fname, $arrFields, $magicq,false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "X":
|
||||||
|
//we need to do some more magic here for long variables
|
||||||
|
//to handle these correctly in oracle.
|
||||||
|
|
||||||
|
//create a safe bind var name
|
||||||
|
//to avoid conflicts w/ dupes.
|
||||||
|
if (!empty($zthis->hasReturningInto)) {
|
||||||
|
if ($action == 'I') {
|
||||||
|
$sql = ':xx'.$fname.'xx, ';
|
||||||
|
} else {
|
||||||
|
$sql = $fname.'=:xx'.$fname.'xx, ';
|
||||||
|
}
|
||||||
|
//add the variable to the returning clause array
|
||||||
|
//so the user can build this later in
|
||||||
|
//case they want to add more to it
|
||||||
|
$zthis->_returningArray[$fname] = ':xx'.$fname.'xx';
|
||||||
|
} else {
|
||||||
|
//this is to maintain compatibility
|
||||||
|
//with older adodb versions.
|
||||||
|
$sql = _adodb_column_sql($zthis, $action, $type, $fname, $arrFields, $magicq,false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$sql = _adodb_column_sql($zthis, $action, $type, $fname, $arrFields, $magicq,false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _adodb_column_sql(&$zthis, $action, $type, $fname, $arrFields, $magicq, $recurse=true)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($recurse) {
|
||||||
|
switch($zthis->dataProvider) {
|
||||||
|
case 'postgres':
|
||||||
|
if ($type == 'L') $type = 'C';
|
||||||
|
break;
|
||||||
|
case 'oci8':
|
||||||
|
return _adodb_column_sql_oci8($zthis, $action, $type, $fname, $arrFields, $magicq);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = '';
|
||||||
|
|
||||||
|
switch($type) {
|
||||||
|
case "C":
|
||||||
|
case "X":
|
||||||
|
case 'B':
|
||||||
|
if ($action == 'I') {
|
||||||
|
$sql = $zthis->qstr($arrFields[$fname],$magicq) . ", ";
|
||||||
|
} else {
|
||||||
|
$sql .= $fname . "=" . $zthis->qstr($arrFields[$fname],$magicq) . ", ";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "D":
|
||||||
|
if ($action == 'I') {
|
||||||
|
$sql = $zthis->DBDate($arrFields[$fname]) . ", ";
|
||||||
|
} else {
|
||||||
|
$sql .= $fname . "=" . $zthis->DBDate($arrFields[$fname]) . ", ";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "T":
|
||||||
|
if ($action == 'I') {
|
||||||
|
$sql = $zthis->DBTimeStamp($arrFields[$fname]) . ", ";
|
||||||
|
} else {
|
||||||
|
$sql .= $fname . "=" . $zthis->DBTimeStamp($arrFields[$fname]) . ", ";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$val = $arrFields[$fname];
|
||||||
|
if (empty($val)) $val = '0';
|
||||||
|
|
||||||
|
|
||||||
|
if ($action == 'I') {
|
||||||
|
$sql .= $val . ", ";
|
||||||
|
} else {
|
||||||
|
$sql .= $fname . "=" . $val . ", ";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
?>
|
?>
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
* Whenever there is any discrepancy between the two licenses,
|
* Whenever there is any discrepancy between the two licenses,
|
||||||
* the BSD license will take precedence.
|
* the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
@ -90,7 +90,7 @@ global $HTTP_SERVER_VARS;
|
|||||||
if (is_array($sql)) $sql = $sql[0];
|
if (is_array($sql)) $sql = $sql[0];
|
||||||
$arr = array('b'=>trim(substr($sql,0,230)),
|
$arr = array('b'=>trim(substr($sql,0,230)),
|
||||||
'c'=>substr($sql,0,3900), 'd'=>$params,'e'=>$tracer,'f'=>round($time,6));
|
'c'=>substr($sql,0,3900), 'd'=>$params,'e'=>$tracer,'f'=>round($time,6));
|
||||||
|
//var_dump($arr);
|
||||||
$saved = $conn->debug;
|
$saved = $conn->debug;
|
||||||
$conn->debug = 0;
|
$conn->debug = 0;
|
||||||
|
|
||||||
@ -597,7 +597,7 @@ Committed_AS: 348732 kB
|
|||||||
if (!isset($_SESSION['ADODB_PERF_SQL'])) $nsql = $_SESSION['ADODB_PERF_SQL'] = 10;
|
if (!isset($_SESSION['ADODB_PERF_SQL'])) $nsql = $_SESSION['ADODB_PERF_SQL'] = 10;
|
||||||
else $nsql = $_SESSION['ADODB_PERF_SQL'];
|
else $nsql = $_SESSION['ADODB_PERF_SQL'];
|
||||||
|
|
||||||
$app .= '<font size=-1>'.$info['description'].'</font>';
|
$app .= $info['description'];
|
||||||
|
|
||||||
|
|
||||||
if (isset($HTTP_GET_VARS['do'])) $do = $HTTP_GET_VARS['do'];
|
if (isset($HTTP_GET_VARS['do'])) $do = $HTTP_GET_VARS['do'];
|
||||||
@ -616,10 +616,10 @@ Committed_AS: 348732 kB
|
|||||||
|
|
||||||
if (empty($HTTP_GET_VARS['hidem']))
|
if (empty($HTTP_GET_VARS['hidem']))
|
||||||
echo "<table border=1 width=100% bgcolor=lightyellow><tr><td colspan=2>
|
echo "<table border=1 width=100% bgcolor=lightyellow><tr><td colspan=2>
|
||||||
<b><a href=http://php.weblogs.com/adodb?perf=1>ADOdb</a> Performance Monitor</b> for $app</tr><tr><td>
|
<b><a href=http://php.weblogs.com/adodb?perf=1>ADOdb</a> Performance Monitor</b> <font size=1>for $app</font></tr><tr><td>
|
||||||
<a href=?do=stats>Performance Stats</a> <a href=?do=viewsql>View SQL</a>
|
<a href=?do=stats><b>Performance Stats</b></a> <a href=?do=viewsql><b>View SQL</b></a>
|
||||||
<a href=?do=tables>View Tables</a> <a href=?do=poll>Poll Stats</a>",
|
<a href=?do=tables><b>View Tables</b></a> <a href=?do=poll><b>Poll Stats</b></a>",
|
||||||
$allowsql ? ' <a href=?do=dosql>Run SQL</a>' : '',
|
$allowsql ? ' <a href=?do=dosql><b>Run SQL</b></a>' : '',
|
||||||
"$form",
|
"$form",
|
||||||
"</tr></table>";
|
"</tr></table>";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -174,6 +174,9 @@ c. Implement daylight savings, which looks awfully complicated, see
|
|||||||
|
|
||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
- 20 Mar 2004 0.12
|
||||||
|
Fixed month calculation error in adodb_date. 2102-June-01 appeared as 2102-May-32.
|
||||||
|
|
||||||
- 26 Oct 2003 0.11
|
- 26 Oct 2003 0.11
|
||||||
Because of daylight savings problems (some systems apply daylight savings to
|
Because of daylight savings problems (some systems apply daylight savings to
|
||||||
January!!!), changed adodb_get_gmt_diff() to ignore daylight savings.
|
January!!!), changed adodb_get_gmt_diff() to ignore daylight savings.
|
||||||
@ -234,7 +237,7 @@ First implementation.
|
|||||||
/*
|
/*
|
||||||
Version Number
|
Version Number
|
||||||
*/
|
*/
|
||||||
define('ADODB_DATE_VERSION',0.11);
|
define('ADODB_DATE_VERSION',0.12);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We check for Windows as only +ve ints are accepted as dates on Windows.
|
We check for Windows as only +ve ints are accepted as dates on Windows.
|
||||||
@ -276,6 +279,13 @@ function adodb_date_test()
|
|||||||
// This flag disables calling of PHP native functions, so we can properly test the code
|
// This flag disables calling of PHP native functions, so we can properly test the code
|
||||||
if (!defined('ADODB_TEST_DATES')) define('ADODB_TEST_DATES',1);
|
if (!defined('ADODB_TEST_DATES')) define('ADODB_TEST_DATES',1);
|
||||||
|
|
||||||
|
$t = adodb_mktime(0,0,0,6,1,2102);
|
||||||
|
if (!(adodb_date('Y-m-d',$t) == '2102-06-01')) print 'Error in '.adodb_date('Y-m-d',$t).'<br>';
|
||||||
|
|
||||||
|
$t = adodb_mktime(0,0,0,2,1,2102);
|
||||||
|
if (!(adodb_date('Y-m-d',$t) == '2102-02-01')) print 'Error in '.adodb_date('Y-m-d',$t).'<br>';
|
||||||
|
|
||||||
|
|
||||||
print "<p>Testing gregorian <=> julian conversion<p>";
|
print "<p>Testing gregorian <=> julian conversion<p>";
|
||||||
$t = adodb_mktime(0,0,0,10,11,1492);
|
$t = adodb_mktime(0,0,0,10,11,1492);
|
||||||
//http://www.holidayorigins.com/html/columbus_day.html - Friday check
|
//http://www.holidayorigins.com/html/columbus_day.html - Friday check
|
||||||
@ -598,7 +608,7 @@ function _adodb_getdate($origd=false,$fast=false,$is_gmt=false)
|
|||||||
for ($a = 1 ; $a <= 12; $a++) {
|
for ($a = 1 ; $a <= 12; $a++) {
|
||||||
$lastd = $d;
|
$lastd = $d;
|
||||||
$d -= $mtab[$a] * $_day_power;
|
$d -= $mtab[$a] * $_day_power;
|
||||||
if ($d <= 0) {
|
if ($d < 0) {
|
||||||
$month = $a;
|
$month = $a;
|
||||||
$ndays = $mtab[$a];
|
$ndays = $mtab[$a];
|
||||||
break;
|
break;
|
||||||
|
BIN
phpgwapi/inc/adodb/adodb-time.zip
Normal file
BIN
phpgwapi/inc/adodb/adodb-time.zip
Normal file
Binary file not shown.
@ -14,7 +14,7 @@
|
|||||||
/**
|
/**
|
||||||
\mainpage
|
\mainpage
|
||||||
|
|
||||||
@version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim\@natsoft.com.my). All rights reserved.
|
@version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim\@natsoft.com.my). All rights reserved.
|
||||||
|
|
||||||
Released under both BSD license and Lesser GPL library license. You can choose which license
|
Released under both BSD license and Lesser GPL library license. You can choose which license
|
||||||
you prefer.
|
you prefer.
|
||||||
@ -133,7 +133,7 @@
|
|||||||
$ADODB_FETCH_MODE = ADODB_FETCH_DEFAULT;
|
$ADODB_FETCH_MODE = ADODB_FETCH_DEFAULT;
|
||||||
|
|
||||||
if (!isset($ADODB_CACHE_DIR)) {
|
if (!isset($ADODB_CACHE_DIR)) {
|
||||||
$ADODB_CACHE_DIR = '/tmp';
|
$ADODB_CACHE_DIR = '/tmp'; //(isset($_ENV['TMP'])) ? $_ENV['TMP'] : '/tmp';
|
||||||
} else {
|
} else {
|
||||||
// do not accept url based paths, eg. http:/ or ftp:/
|
// do not accept url based paths, eg. http:/ or ftp:/
|
||||||
if (strpos($ADODB_CACHE_DIR,'://') !== false)
|
if (strpos($ADODB_CACHE_DIR,'://') !== false)
|
||||||
@ -147,7 +147,7 @@
|
|||||||
/**
|
/**
|
||||||
* ADODB version as a string.
|
* ADODB version as a string.
|
||||||
*/
|
*/
|
||||||
$ADODB_vers = 'V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.';
|
$ADODB_vers = 'V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether recordset->RecordCount() is used.
|
* Determines whether recordset->RecordCount() is used.
|
||||||
@ -323,12 +323,16 @@
|
|||||||
*/
|
*/
|
||||||
function outp($msg,$newline=true)
|
function outp($msg,$newline=true)
|
||||||
{
|
{
|
||||||
global $HTTP_SERVER_VARS,$ADODB_FLUSH;
|
global $HTTP_SERVER_VARS,$ADODB_FLUSH,$ADODB_OUTP;
|
||||||
|
|
||||||
if (defined('ADODB_OUTP')) {
|
if (defined('ADODB_OUTP')) {
|
||||||
$fn = ADODB_OUTP;
|
$fn = ADODB_OUTP;
|
||||||
$fn($msg,$newline);
|
$fn($msg,$newline);
|
||||||
return;
|
return;
|
||||||
|
} else if (isset($ADODB_OUTP)) {
|
||||||
|
$fn = $ADODB_OUTP;
|
||||||
|
$fn($msg,$newline);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($newline) $msg .= "<br>\n";
|
if ($newline) $msg .= "<br>\n";
|
||||||
@ -339,6 +343,14 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Time()
|
||||||
|
{
|
||||||
|
$rs =& $this->Execute("select $this->sysTimeStamp");
|
||||||
|
if ($rs && !$rs->EOF) return $this->UnixTimeStamp(reset($rs->fields));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to database
|
* Connect to database
|
||||||
*
|
*
|
||||||
@ -474,7 +486,7 @@
|
|||||||
* if the database does not support prepare.
|
* if the database does not support prepare.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function PrepareSP($sql,$param=false)
|
function PrepareSP($sql,$param=true)
|
||||||
{
|
{
|
||||||
return $this->Prepare($sql,$param);
|
return $this->Prepare($sql,$param);
|
||||||
}
|
}
|
||||||
@ -786,9 +798,10 @@
|
|||||||
|
|
||||||
function& _Execute($sql,$inputarr=false)
|
function& _Execute($sql,$inputarr=false)
|
||||||
{
|
{
|
||||||
// debug version of query
|
|
||||||
if ($this->debug) {
|
if ($this->debug) {
|
||||||
global $HTTP_SERVER_VARS;
|
global $HTTP_SERVER_VARS;
|
||||||
|
|
||||||
$ss = '';
|
$ss = '';
|
||||||
if ($inputarr) {
|
if ($inputarr) {
|
||||||
foreach($inputarr as $kk=>$vv) {
|
foreach($inputarr as $kk=>$vv) {
|
||||||
@ -802,44 +815,41 @@
|
|||||||
// check if running from browser or command-line
|
// check if running from browser or command-line
|
||||||
$inBrowser = isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']);
|
$inBrowser = isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']);
|
||||||
|
|
||||||
if ($inBrowser)
|
if ($inBrowser) {
|
||||||
if ($this->debug === -1)
|
if ($this->debug === -1)
|
||||||
ADOConnection::outp( "<br>\n($this->databaseType): ".htmlspecialchars($sqlTxt)." <code>$ss</code>\n<br>\n",false);
|
ADOConnection::outp( "<br>\n($this->databaseType): ".htmlspecialchars($sqlTxt)." <code>$ss</code>\n<br>\n",false);
|
||||||
else ADOConnection::outp( "<hr />\n($this->databaseType): ".htmlspecialchars($sqlTxt)." <code>$ss</code>\n<hr />\n",false);
|
else
|
||||||
else
|
ADOConnection::outp( "<hr>\n($this->databaseType): ".htmlspecialchars($sqlTxt)." <code>$ss</code>\n<hr>\n",false);
|
||||||
ADOConnection::outp( "=----\n($this->databaseType): ".($sqlTxt)." \n-----\n",false);
|
} else {
|
||||||
|
ADOConnection::outp("-----\n($this->databaseType): ".($sqlTxt)." \n-----\n",false);
|
||||||
|
}
|
||||||
$this->_queryID = $this->_query($sql,$inputarr);
|
$this->_queryID = $this->_query($sql,$inputarr);
|
||||||
/*
|
/*
|
||||||
Alexios Fakios notes that ErrorMsg() must be called before ErrorNo() for mssql
|
Alexios Fakios notes that ErrorMsg() must be called before ErrorNo() for mssql
|
||||||
because ErrorNo() calls Execute('SELECT @ERROR'), causing recure
|
because ErrorNo() calls Execute('SELECT @ERROR'), causing recursion
|
||||||
*/
|
*/
|
||||||
if ($this->databaseType == 'mssql') {
|
if ($this->databaseType == 'mssql') {
|
||||||
// ErrorNo is a slow function call in mssql, and not reliable
|
// ErrorNo is a slow function call in mssql, and not reliable in PHP 4.0.6
|
||||||
// in PHP 4.0.6
|
|
||||||
if($emsg = $this->ErrorMsg()) {
|
if($emsg = $this->ErrorMsg()) {
|
||||||
$err = $this->ErrorNo();
|
if ($err = $this->ErrorNo()) ADOConnection::outp($err.': '.$emsg);
|
||||||
if ($err) {
|
|
||||||
ADOConnection::outp($err.': '.$emsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
if (!$this->_queryID) {
|
|
||||||
$e = $this->ErrorNo();
|
|
||||||
$m = $this->ErrorMsg();
|
|
||||||
ADOConnection::outp($e .': '. $m );
|
|
||||||
}
|
}
|
||||||
|
} else if (!$this->_queryID) {
|
||||||
|
ADOConnection::outp($this->ErrorNo() .': '. $this->ErrorMsg());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//****************************
|
||||||
// non-debug version of query
|
// non-debug version of query
|
||||||
|
//****************************
|
||||||
|
|
||||||
$this->_queryID =@$this->_query($sql,$inputarr);
|
$this->_queryID =@$this->_query($sql,$inputarr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************
|
/************************
|
||||||
OK, query executed
|
// OK, query executed
|
||||||
*************************/
|
*************************/
|
||||||
// error handling if query fails
|
|
||||||
if ($this->_queryID === false) {
|
if ($this->_queryID === false) {
|
||||||
|
// error handling if query fails
|
||||||
if ($this->debug == 99) adodb_backtrace(true,5);
|
if ($this->debug == 99) adodb_backtrace(true,5);
|
||||||
$fn = $this->raiseErrorFn;
|
$fn = $this->raiseErrorFn;
|
||||||
if ($fn) {
|
if ($fn) {
|
||||||
@ -847,7 +857,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else if ($this->_queryID === true) {
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->_queryID === true) {
|
||||||
// return simplified empty recordset for inserts/updates/deletes with lower overhead
|
// return simplified empty recordset for inserts/updates/deletes with lower overhead
|
||||||
$rs =& new ADORecordSet_empty();
|
$rs =& new ADORecordSet_empty();
|
||||||
return $rs;
|
return $rs;
|
||||||
@ -855,7 +868,7 @@
|
|||||||
|
|
||||||
// return real recordset from select statement
|
// return real recordset from select statement
|
||||||
$rsclass = $this->rsPrefix.$this->databaseType;
|
$rsclass = $this->rsPrefix.$this->databaseType;
|
||||||
$rs =& new $rsclass($this->_queryID,$this->fetchMode); // &new not supported by older PHP versions
|
$rs =& new $rsclass($this->_queryID,$this->fetchMode);
|
||||||
$rs->connection = &$this; // Pablo suggestion
|
$rs->connection = &$this; // Pablo suggestion
|
||||||
$rs->Init();
|
$rs->Init();
|
||||||
if (is_array($sql)) $rs->sql = $sql[0];
|
if (is_array($sql)) $rs->sql = $sql[0];
|
||||||
@ -1972,7 +1985,7 @@
|
|||||||
|
|
||||||
$arr = array();
|
$arr = array();
|
||||||
foreach($objarr as $v) {
|
foreach($objarr as $v) {
|
||||||
$arr[] = $v->name;
|
$arr[strtoupper($v->name)] = $v->name;
|
||||||
}
|
}
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
@ -2640,7 +2653,7 @@
|
|||||||
*
|
*
|
||||||
* @return false or array containing the current record
|
* @return false or array containing the current record
|
||||||
*/
|
*/
|
||||||
function FetchRow()
|
function &FetchRow()
|
||||||
{
|
{
|
||||||
if ($this->EOF) return false;
|
if ($this->EOF) return false;
|
||||||
$arr = $this->fields;
|
$arr = $this->fields;
|
||||||
@ -3269,12 +3282,12 @@
|
|||||||
* unless paramter $colnames is used.
|
* unless paramter $colnames is used.
|
||||||
* @param fieldarr holds an array of ADOFieldObject's.
|
* @param fieldarr holds an array of ADOFieldObject's.
|
||||||
*/
|
*/
|
||||||
function InitArrayFields($array,$fieldarr)
|
function InitArrayFields(&$array,&$fieldarr)
|
||||||
{
|
{
|
||||||
$this->_array = $array;
|
$this->_array =& $array;
|
||||||
$this->_skiprow1= false;
|
$this->_skiprow1= false;
|
||||||
if ($fieldarr) {
|
if ($fieldarr) {
|
||||||
$this->_fieldobjects = $fieldarr;
|
$this->_fieldobjects =& $fieldarr;
|
||||||
}
|
}
|
||||||
$this->Init();
|
$this->Init();
|
||||||
}
|
}
|
||||||
@ -3412,7 +3425,7 @@
|
|||||||
if ($ok) return $db;
|
if ($ok) return $db;
|
||||||
|
|
||||||
$file = ADODB_DIR."/drivers/adodb-".$db.".inc.php";
|
$file = ADODB_DIR."/drivers/adodb-".$db.".inc.php";
|
||||||
if (file_exists($file)) ADOConnection::outp("Missing file: $file");
|
if (!file_exists($file)) ADOConnection::outp("Missing file: $file");
|
||||||
else ADOConnection::outp("Syntax error in file: $file");
|
else ADOConnection::outp("Syntax error in file: $file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
@ -19,7 +19,7 @@ class ADODB2_db2 extends ADODB_DataDict {
|
|||||||
{
|
{
|
||||||
switch($meta) {
|
switch($meta) {
|
||||||
case 'C': return 'VARCHAR';
|
case 'C': return 'VARCHAR';
|
||||||
case 'XL':
|
case 'XL': return 'CLOB';
|
||||||
case 'X': return 'VARCHAR(3600)';
|
case 'X': return 'VARCHAR(3600)';
|
||||||
|
|
||||||
case 'C2': return 'VARCHAR'; // up to 32K
|
case 'C2': return 'VARCHAR'; // up to 32K
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<body bgcolor="#FFFFFF">
|
<body bgcolor="#FFFFFF">
|
||||||
|
|
||||||
<h2>ADOdb Library for PHP</h2>
|
<h2>ADOdb Library for PHP</h2>
|
||||||
<p>V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim#natsoft.com)</p>
|
<p>V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim#natsoft.com)</p>
|
||||||
<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This
|
<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This
|
||||||
means you can use it in compiled proprietary and commercial products.</font></p>
|
means you can use it in compiled proprietary and commercial products.</font></p>
|
||||||
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb>Download</a> <a href=http://php.weblogs.com/adodb_manual>Other Docs</a>
|
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb>Download</a> <a href=http://php.weblogs.com/adodb_manual>Other Docs</a>
|
||||||
@ -202,24 +202,30 @@ visit <a href="http://php.weblogs.com/adodb-cool-applications">http://php.weblog
|
|||||||
<li>adodb.inc.php
|
<li>adodb.inc.php
|
||||||
<li>adodb-lib.inc.php
|
<li>adodb-lib.inc.php
|
||||||
<li>adodb-time.inc.php
|
<li>adodb-time.inc.php
|
||||||
<li>adodb-csvlib.inc.php (if you use cached recordsets - CacheExecute(), etc)
|
|
||||||
<li>adodb-error.inc.php and lang/adodb-$lang.inc.php (if you use MetaError())
|
|
||||||
<li>drivers/adodb-$database.inc.php
|
<li>drivers/adodb-$database.inc.php
|
||||||
<li>license.txt (for legal reasons)
|
<li>license.txt (for legal reasons)
|
||||||
|
<li>adodb-php4.inc.php
|
||||||
|
<li>adodb-iterator.inc.php
|
||||||
|
</ul>
|
||||||
|
Optional:
|
||||||
|
<ul>
|
||||||
|
<li>adodb-error.inc.php and lang/adodb-$lang.inc.php (if you use MetaError())
|
||||||
|
<li>adodb-csvlib.inc.php (if you use cached recordsets - CacheExecute(), etc)
|
||||||
|
<li>adodb-exceptions.inc.php and adodb-errorhandler.inc.php (if you use adodb error handler or php5 exceptions).
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>Code Initialization Examples<a name="coding"></a></h3>
|
<h3>Code Initialization Examples<a name="coding"></a></h3>
|
||||||
<p>When running ADOdb, at least two files are loaded. First is adodb/adodb.inc.php,
|
<p>When running ADOdb, at least two files are loaded. First is adodb/adodb.inc.php,
|
||||||
which contains all functions used by all database classes. The code specific
|
which contains all functions used by all database classes. The code specific
|
||||||
to a particular database is in the adodb/driver/adodb-????.inc.php file.</p>
|
to a particular database is in the adodb/driver/adodb-????.inc.php file.</p>
|
||||||
<a name="adonewconnection">
|
<a name="adonewconnection"></a>
|
||||||
<p>For example, to connect to a mysql database:</p>
|
<p>For example, to connect to a mysql database:</p>
|
||||||
<pre>
|
<pre>
|
||||||
include('/path/to/set/here/adodb.inc.php');
|
include('/path/to/set/here/adodb.inc.php');
|
||||||
$conn = &ADONewConnection('mysql');
|
$conn = &ADONewConnection('mysql');
|
||||||
</pre>
|
</pre>
|
||||||
<p>Whenever you need to connect to a database, you create a Connection object
|
<p>Whenever you need to connect to a database, you create a Connection object
|
||||||
using the <b>ADONewConnection</b></a>($driver) function.
|
using the <b>ADONewConnection</b>($driver) function.
|
||||||
<b>NewADOConnection</b>($driver) is an alternative name for the same function.</p>
|
<b>NewADOConnection</b>($driver) is an alternative name for the same function.</p>
|
||||||
|
|
||||||
<p>At this point, you are not connected to the database. You will first need to decide
|
<p>At this point, you are not connected to the database. You will first need to decide
|
||||||
@ -256,7 +262,48 @@ different databases. The solution is to always use different userid's for differ
|
|||||||
<p> b. the classical 4 parameters:</p>
|
<p> b. the classical 4 parameters:</p>
|
||||||
<pre>
|
<pre>
|
||||||
$conn->PConnect('localhost','userid','password','database');
|
$conn->PConnect('localhost','userid','password','database');
|
||||||
</pre>
|
</pre><a name=ldap>
|
||||||
|
<h4>LDAP</h4>
|
||||||
|
<p>Here is an example of querying a LDAP server. Thanks to Josh Eldridge for the driver and this example:
|
||||||
|
<pre>
|
||||||
|
<?php
|
||||||
|
require('/path/to/adodb.inc.php');
|
||||||
|
|
||||||
|
$host = 'ldap.baylor.edu';
|
||||||
|
$ldapbase = 'ou=People,o=Baylor University,c=US';
|
||||||
|
|
||||||
|
$ldap = NewADOConnection( 'ldap' );
|
||||||
|
$ldap->Connect( $host, $user_name='', $password='', $ldapbase );
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
|
||||||
|
print_r( $ldap->ServerInfo() );
|
||||||
|
$ldap->SetFetchMode(ADODB_FETCH_ASSOC);
|
||||||
|
$userName = 'eldridge';
|
||||||
|
$filter="(|(CN=$userName*)(sn=$userName*)(givenname=$userName*)(uid=$userName*))";
|
||||||
|
|
||||||
|
$rs = $ldap->Execute( $filter );
|
||||||
|
if ($rs)
|
||||||
|
while ($arr = $rs->FetchRow()) {
|
||||||
|
print_r($arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rs = $ldap->Execute( $filter );
|
||||||
|
if ($rs)
|
||||||
|
while (!$rs->EOF) {
|
||||||
|
print_r($rs->fields);
|
||||||
|
$rs->MoveNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
$rs = $ldap->Execute( $filter );
|
||||||
|
print_r( $ldap->GetArray( $filter ) );
|
||||||
|
|
||||||
|
$rs = $ldap->Execute( $filter );
|
||||||
|
print_r( $ldap->GetRow( $filter ) );
|
||||||
|
|
||||||
|
$ldap->Close();
|
||||||
|
echo "</pre>";
|
||||||
|
?></pre>
|
||||||
<h4>Interbase/Firebird</h4>
|
<h4>Interbase/Firebird</h4>
|
||||||
You define the database in the $host parameter:
|
You define the database in the $host parameter:
|
||||||
<pre>
|
<pre>
|
||||||
@ -330,7 +377,7 @@ using the ADOdb library and Microsoft's ADO:
|
|||||||
<tr>
|
<tr>
|
||||||
<td><p align="center">Connect, PConnect, NConnect<br>
|
<td><p align="center">Connect, PConnect, NConnect<br>
|
||||||
Execute, CacheExecute<br>
|
Execute, CacheExecute<br>
|
||||||
SelectLimit, SelectLimit<br>
|
SelectLimit, CacheSelectLimit<br>
|
||||||
MoveNext, Close <br>
|
MoveNext, Close <br>
|
||||||
qstr, Affected_Rows, Insert_ID</p></td>
|
qstr, Affected_Rows, Insert_ID</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -392,12 +439,12 @@ include_once('adodb.inc.php');
|
|||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<p>Don't forget to call the constructor of the parent class.
|
<p>Don't forget to call the constructor of the parent class.
|
||||||
<a name="php5">
|
<a name="php5"></a>
|
||||||
<h2>PHP5 Features</h2>
|
<h2>PHP5 Features</h2>
|
||||||
ADOdb 4.02 or later will transparently determine which version of PHP you are using.
|
ADOdb 4.02 or later will transparently determine which version of PHP you are using.
|
||||||
If PHP5 is detected, the following features become available:
|
If PHP5 is detected, the following features become available:
|
||||||
<ul>
|
<ul>
|
||||||
<a name="php5iterators">
|
<a name="php5iterators"></a>
|
||||||
<li><b>Foreach iterators</b>: This is a very natural way of going through a recordset:
|
<li><b>Foreach iterators</b>: This is a very natural way of going through a recordset:
|
||||||
<pre>
|
<pre>
|
||||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||||
@ -407,7 +454,7 @@ If PHP5 is detected, the following features become available:
|
|||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
<a name="php5exceptions">
|
<a name="php5exceptions"></a>
|
||||||
<li><b>Exceptions</b>: Just include <i>adodb-exceptions.inc.php</i> and you can now
|
<li><b>Exceptions</b>: Just include <i>adodb-exceptions.inc.php</i> and you can now
|
||||||
catch exceptions on errors as they occur.
|
catch exceptions on errors as they occur.
|
||||||
<pre>
|
<pre>
|
||||||
@ -420,6 +467,7 @@ catch exceptions on errors as they occur.
|
|||||||
var_dump($e);
|
var_dump($e);
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
<p>Note that reaching EOF is <b>not</b> considered an error nor an exception.
|
||||||
</ul>
|
</ul>
|
||||||
<h3><a name="drivers"></a>Databases Supported</h3>
|
<h3><a name="drivers"></a>Databases Supported</h3>
|
||||||
<table width="100%" border="1">
|
<table width="100%" border="1">
|
||||||
@ -541,6 +589,23 @@ catch exceptions on errors as they occur.
|
|||||||
<td><font size="2">Informix client</font></td>
|
<td><font size="2">Informix client</font></td>
|
||||||
<td><font size="2">Unix and Windows</font></td>
|
<td><font size="2">Unix and Windows</font></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td><b><font size="2">informix72</font></b></td>
|
||||||
|
<td><font size="2">C</font></td>
|
||||||
|
<td><font size="2"> Informix databases before Informix 7.3 that do no support
|
||||||
|
SELECT FIRST.</font></td>
|
||||||
|
<td><font size="2">Y/N</font></td>
|
||||||
|
<td><font size="2">Informix client</font></td>
|
||||||
|
<td><font size="2">Unix and Windows</font></td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td><b><font size="2">ldap</font></b></td>
|
||||||
|
<td><font size="2">C</font></td>
|
||||||
|
<td><font size="2">LDAP driver. See this example for usage information.</font></td>
|
||||||
|
<td> </td>
|
||||||
|
<td><font size="2">LDAP extension</font></td>
|
||||||
|
<td><font size="2">?</font></td>
|
||||||
|
</tr>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<td height="73"><b><font size="2">mssql</font></b></td>
|
<td height="73"><b><font size="2">mssql</font></b></td>
|
||||||
<td height="73"><font size="2">A</font></td>
|
<td height="73"><font size="2">A</font></td>
|
||||||
@ -653,6 +718,24 @@ catch exceptions on errors as they occur.
|
|||||||
<td><font size="2">ODBC</font></td>
|
<td><font size="2">ODBC</font></td>
|
||||||
<td><font size="2">Unix and Windows. </font></td>
|
<td><font size="2">Unix and Windows. </font></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr valign="top">
|
||||||
|
<td><b><font size="2">odbtp</font></b></td>
|
||||||
|
<td><font size="2">C</font></td>
|
||||||
|
<td><font size="2">Generic odbtp driver. <a href=http://odbtp.sourceforge.net/>Odbtp</a> is a software for
|
||||||
|
accessing Windows ODBC data sources from other operating systems.</font></td>
|
||||||
|
<td><font size="2">Y/N</font></td>
|
||||||
|
<td><font size="2">odbtp</font></td>
|
||||||
|
<td><font size="2">Unix and Windows</font></td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td><b><font size="2">odbtp_unicode</font></b></td>
|
||||||
|
<td><font size="2">C</font></td>
|
||||||
|
<td><font size="2">Odtbp with unicode support</font></td>
|
||||||
|
<td><font size="2">Y/N</font></td>
|
||||||
|
<td><font size="2">odbtp</font></td>
|
||||||
|
<td><font size="2">Unix and Windows</font></td>
|
||||||
|
</tr>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<td height="34"><b><font size="2">oracle</font></b></td>
|
<td height="34"><b><font size="2">oracle</font></b></td>
|
||||||
<td height="34"><font size="2">C</font></td>
|
<td height="34"><font size="2">C</font></td>
|
||||||
@ -662,6 +745,14 @@ catch exceptions on errors as they occur.
|
|||||||
<td height="34"><font size="2">Oracle client</font></td>
|
<td height="34"><font size="2">Oracle client</font></td>
|
||||||
<td height="34"><font size="2">Unix and Windows</font></td>
|
<td height="34"><font size="2">Unix and Windows</font></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td height="34"><b><font size="2">netezza</font></b></td>
|
||||||
|
<td height="34"><font size="2">C</font></td>
|
||||||
|
<td height="34"><font size="2">Netezza driver. Netezza is based on postgres code-base.</font></td>
|
||||||
|
<td height="34"><font size="2">Y</font></td>
|
||||||
|
<td height="34"><font size="2">?</font></td>
|
||||||
|
<td height="34"><font size="2">?</font></td>
|
||||||
|
</tr>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<td><b><font size="2">postgres</font></b></td>
|
<td><b><font size="2">postgres</font></b></td>
|
||||||
<td><font size="2">A</font></td>
|
<td><font size="2">A</font></td>
|
||||||
@ -944,6 +1035,8 @@ update or insert into the table automatically.
|
|||||||
fields: (ID, FirstName, LastName, Created).
|
fields: (ID, FirstName, LastName, Created).
|
||||||
<p> Before these functions can be called, you need to initialize the recordset
|
<p> Before these functions can be called, you need to initialize the recordset
|
||||||
by performing a select on the table. Idea and code by Jonathan Younger jyounger#unilab.com.
|
by performing a select on the table. Idea and code by Jonathan Younger jyounger#unilab.com.
|
||||||
|
Since ADOdb 2.42, you can pass a table name instead of a recordset into
|
||||||
|
GetInsertSQL (in $rs), and it will generate an insert statement for that table.
|
||||||
<p>
|
<p>
|
||||||
<pre><?
|
<pre><?
|
||||||
#==============================================
|
#==============================================
|
||||||
@ -1965,6 +2058,8 @@ $ret = $db->Replace('atable2',
|
|||||||
|
|
||||||
<p>Since 3.61, define('ADODB_FORCE_NULLS',1) and all PHP nulls will be auto-converted
|
<p>Since 3.61, define('ADODB_FORCE_NULLS',1) and all PHP nulls will be auto-converted
|
||||||
to SQL nulls.
|
to SQL nulls.
|
||||||
|
Since ADOdb 2.42, you can pass a table name instead of a recordset into
|
||||||
|
GetInsertSQL (in $rs), and it will generate an insert statement for that table.
|
||||||
<p><b>PageExecute<a name="pageexecute"></a>($sql, $nrows, $page, $inputarr=false)</b>
|
<p><b>PageExecute<a name="pageexecute"></a>($sql, $nrows, $page, $inputarr=false)</b>
|
||||||
<p>Used for pagination of recordset. $page is 1-based. See <a href="#ex8">Example
|
<p>Used for pagination of recordset. $page is 1-based. See <a href="#ex8">Example
|
||||||
8</a>.</p>
|
8</a>.</p>
|
||||||
@ -2176,7 +2271,7 @@ as the function to retrieve a sub-string. To use this property:
|
|||||||
offset (1-based) to the beginning of the sub-string, and the 3rd is the length of the sub-string.
|
offset (1-based) to the beginning of the sub-string, and the 3rd is the length of the sub-string.
|
||||||
|
|
||||||
|
|
||||||
<p><b>Param<a name="param"></a>($name )</b></p>
|
<p><b>Param<a name="param"></a>($name)</b></p>
|
||||||
<p>Generates a bind placeholder portably. For most databases, the bind placeholder
|
<p>Generates a bind placeholder portably. For most databases, the bind placeholder
|
||||||
is "?". However some databases use named bind parameters such as Oracle, eg
|
is "?". However some databases use named bind parameters such as Oracle, eg
|
||||||
":somevar". This allows us to portably define an SQL statement with bind parameters:
|
":somevar". This allows us to portably define an SQL statement with bind parameters:
|
||||||
@ -2188,12 +2283,14 @@ $stmt = $DB->Execute($stmt,array('one','two'));
|
|||||||
</font></pre>
|
</font></pre>
|
||||||
<font color="#000000">
|
<font color="#000000">
|
||||||
<p></p>
|
<p></p>
|
||||||
<p><b>PrepareSP</b><b><a name="preparesp"></a></b><b>($sql)</b></p>
|
<p><b>PrepareSP</b><b><a name="preparesp"></a></b><b>($sql, $cursor=false )</b></p>
|
||||||
<p>When calling stored procedures in mssql and oci8 (oracle), and you might want
|
<p>When calling stored procedures in mssql and oci8 (oracle), and you might want
|
||||||
to directly bind to parameters that return values, or for special LOB handling.
|
to directly bind to parameters that return values, or for special LOB handling.
|
||||||
PrepareSP() allows you to do so.
|
PrepareSP() allows you to do so.
|
||||||
<p>Returns the same array or $sql string as Prepare( ) above. If you do not need
|
<p>Returns the same array or $sql string as Prepare( ) above. If you do not need
|
||||||
to bind to return values, you should use Prepare( ) instead.</p>
|
to bind to return values, you should use Prepare( ) instead.</p>
|
||||||
|
<p>The 2nd parameter, $cursor is not used except with oci8. Setting it to true will
|
||||||
|
force OCINewCursor to be called; this is to support output REF CURSORs.
|
||||||
<p>For examples of usage of PrepareSP( ), see InParameter( ) below.
|
<p>For examples of usage of PrepareSP( ), see InParameter( ) below.
|
||||||
<p>Note: in the mssql driver, preparing stored procedures requires a special function
|
<p>Note: in the mssql driver, preparing stored procedures requires a special function
|
||||||
call, mssql_init( ), which is called by this function. PrepareSP( ) is available
|
call, mssql_init( ), which is called by this function. PrepareSP( ) is available
|
||||||
@ -2512,7 +2609,11 @@ printf("<p>Total queries=%d; total cached=%d</p>",$EXECS+$
|
|||||||
<p>For schema support, pass in the $table parameter, "$schema.$tablename". This is only
|
<p>For schema support, pass in the $table parameter, "$schema.$tablename". This is only
|
||||||
supported for selected databases.
|
supported for selected databases.
|
||||||
<p><b>MetaColumnNames<a name="metacolumnames"></a>($table)</b></p>
|
<p><b>MetaColumnNames<a name="metacolumnames"></a>($table)</b></p>
|
||||||
<p>Returns an array of column names for $table.
|
<p>Returns an array of column names for $table. Since ADOdb 4.22, this is an associative array, with the
|
||||||
|
keys in uppercase.
|
||||||
|
<p>
|
||||||
|
e.g. array('FIELD1' => 'Field1', 'FIELD2'=>'Field2')
|
||||||
|
<p>
|
||||||
<p><font color="#000000"><b>MetaPrimaryKeys<a name="metaprimarykeys"></a>($table,
|
<p><font color="#000000"><b>MetaPrimaryKeys<a name="metaprimarykeys"></a>($table,
|
||||||
$owner=false)</b></font></font>
|
$owner=false)</b></font></font>
|
||||||
<p><font color="#000000">Returns an array containing column names that are the
|
<p><font color="#000000">Returns an array containing column names that are the
|
||||||
@ -2679,6 +2780,7 @@ supports:
|
|||||||
<pre>
|
<pre>
|
||||||
Y: 4-digit Year
|
Y: 4-digit Year
|
||||||
Q: Quarter (1-4)
|
Q: Quarter (1-4)
|
||||||
|
M: Month (Jan-Dec)
|
||||||
m: Month (01-12)
|
m: Month (01-12)
|
||||||
d: Day (01-31)
|
d: Day (01-31)
|
||||||
H: Hour (00-23)
|
H: Hour (00-23)
|
||||||
@ -2980,6 +3082,32 @@ $<font color="#663300">rs</font> = $<font color="#663300">conn</font>->Execute
|
|||||||
PHP</a>. </p>
|
PHP</a>. </p>
|
||||||
</font>
|
</font>
|
||||||
<h2>Change Log<a name="Changes"></a><a name="changes"></a><a name="changelog"></a></h2>
|
<h2>Change Log<a name="Changes"></a><a name="changes"></a><a name="changelog"></a></h2>
|
||||||
|
<p><b>4.?? 2004</b>
|
||||||
|
<p>Fixed session bug when quoting compressed/encrypted data in Replace().
|
||||||
|
<p>Netezza Driver and LDAP drivers contributed by Josh Eldridge.
|
||||||
|
<p>GetMenu now uses rtrim() on values instead of trim().
|
||||||
|
<p>Changed MetaColumnNames to return an associative array, keys being the field names in uppercase.
|
||||||
|
<p>Suggested fix to adodb-ado.inc.php affected_rows to support PHP5 variants. Thx to Alexios Fakos.
|
||||||
|
<p>Contributed bulgarian language file by Valentin Sheiretsky valio#valio.eu.org.
|
||||||
|
<p>Contributed romanian language file by stefan bogdan.
|
||||||
|
<p>GetInsertSQL now checks for table name (string) in $rs, and will create a recordset for that
|
||||||
|
table automatically. Contributed by Walt Boring. Also added OCI_B_BLOB in bind on Walt's request - hope
|
||||||
|
it doesn't break anything :-)
|
||||||
|
<p>Some minor postgres speedups in _initrs().
|
||||||
|
<p> ChangeTableSQL checks now if MetaColumns returns empty. Thx Jason Judge.
|
||||||
|
<p>Added ADOConnection::Time(), returns current database time in unix timestamp format, or false.
|
||||||
|
<p><b>4.21 20 Mar 2004</b>
|
||||||
|
<p>We no longer in SelectLimit for VFP driver add SELECT TOP X unless an ORDER BY exists.
|
||||||
|
<p>Pim Koeman contributed dutch language file adodb-nl.inc.php.
|
||||||
|
<p>Rick Hickerson added CLOB support to db2 datadict.
|
||||||
|
<p>Added odbtp driver. Thx to "stefan bogdan" sbogdan#rsb.ro.
|
||||||
|
<p>Changed PrepareSP() 2nd parameter, $cursor, to default to true (formerly false). Fixes oci8 backward
|
||||||
|
compat problems with OUT params.
|
||||||
|
<p>Fixed month calculation error in adodb-time.inc.php. 2102-June-01 appeared as 2102-May-32.
|
||||||
|
<p>Updated PHP5 RC1 iterator support. API changed, hasMore() renamed to valid().
|
||||||
|
<p>Changed internal format of serialized cache recordsets. As we store a version number, this should be
|
||||||
|
backward compatible.
|
||||||
|
<p>Error handling when driver file not found was flawed in ADOLoadCode(). Fixed.
|
||||||
<p><b>4.20 27 Feb 2004</b>
|
<p><b>4.20 27 Feb 2004</b>
|
||||||
<p>Updated to AXMLS 1.01.
|
<p>Updated to AXMLS 1.01.
|
||||||
<p>MetaForeignKeys for postgres7 modified by Edward Jaramilla, works on pg 7.4.
|
<p>MetaForeignKeys for postgres7 modified by Edward Jaramilla, works on pg 7.4.
|
@ -18,7 +18,7 @@
|
|||||||
<body bgcolor="#FFFFFF">
|
<body bgcolor="#FFFFFF">
|
||||||
|
|
||||||
<h2>ADOdb Data Dictionary Library for PHP</h2>
|
<h2>ADOdb Data Dictionary Library for PHP</h2>
|
||||||
<p>V4.20 22 Feb 2004 (c) 2000-2004 John Lim (<a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a>).<br> AXMLS (c) 2004 ars Cognita, Inc</p>
|
<p>V4.22 15 Apr 2004 (c) 2000-2004 John Lim (<a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a>).<br> AXMLS (c) 2004 ars Cognita, Inc</p>
|
||||||
<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial products.</font></p>
|
<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial products.</font></p>
|
||||||
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb?dd=1>Download</a> <a href=http://php.weblogs.com/adodb_manual?dd=1>Other Docs</a></p>
|
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb?dd=1>Download</a> <a href=http://php.weblogs.com/adodb_manual?dd=1>Other Docs</a></p>
|
||||||
|
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h3>The ADOdb Performance Monitoring Library</h3>
|
<h3>The ADOdb Performance Monitoring Library</h3>
|
||||||
<p>V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my)</p>
|
<p>V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my)</p>
|
||||||
<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This
|
<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This
|
||||||
means you can use it in compiled proprietary and commercial products.</font></p>
|
means you can use it in compiled proprietary and commercial products.</font></p>
|
||||||
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb?perf=1>Download</a> <a href=http://php.weblogs.com/adodb_manual?perf=1>Other Docs</a>
|
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb?perf=1>Download</a> <a href=http://php.weblogs.com/adodb_manual?perf=1>Other Docs</a>
|
@ -11,7 +11,7 @@
|
|||||||
<body bgcolor="#FFFFFF">
|
<body bgcolor="#FFFFFF">
|
||||||
<h3>ADODB Session Management Manual</h3>
|
<h3>ADODB Session Management Manual</h3>
|
||||||
<p>
|
<p>
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my)
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my)
|
||||||
<p> <font size=1>This software is dual licensed using BSD-Style and LGPL. This
|
<p> <font size=1>This software is dual licensed using BSD-Style and LGPL. This
|
||||||
means you can use it in compiled proprietary and commercial products. </font>
|
means you can use it in compiled proprietary and commercial products. </font>
|
||||||
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb>Download</a> <a href=http://php.weblogs.com/adodb_manual>Other Docs</a>
|
<p>Useful ADOdb links: <a href=http://php.weblogs.com/adodb>Download</a> <a href=http://php.weblogs.com/adodb_manual>Other Docs</a>
|
||||||
@ -186,12 +186,36 @@ When a session is first created, we check a global variable $ADODB_SESSION_EXPIR
|
|||||||
}</font>
|
}</font>
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
|
NOTE 1: If you have register_globals disabled in php.ini, then you will have to
|
||||||
|
manually set the EXPIREREF. E.g.
|
||||||
|
<pre> <font color=#004040>
|
||||||
|
$GLOBALS['USERID'] =& $_SESSION['USERID'];
|
||||||
|
$ADODB_SESSION_EXPIRE_NOTIFY = array('USERID','NotifyFn');
|
||||||
|
</font></pre>
|
||||||
<p>
|
<p>
|
||||||
NOTE: If you want to change the EXPIREREF after the session record has been
|
NOTE 2: If you want to change the EXPIREREF after the session record has been
|
||||||
created, you will need to modify any session variable to force a database
|
created, you will need to modify any session variable to force a database
|
||||||
record update.
|
record update.
|
||||||
<h4>Compression/Encryption Schemes</h4>
|
|
||||||
|
<h4>Neat Notification Tricks</h4>
|
||||||
|
|
||||||
|
<p><i>ExpireRef</i> normally holds the user id of the current session.
|
||||||
|
<p>
|
||||||
|
1. You can then write a session monitor, scanning expireref to see
|
||||||
|
who is currently logged on.
|
||||||
|
<p>
|
||||||
|
2. If you delete the sessions record for a specific user, eg.
|
||||||
|
<pre>
|
||||||
|
delete from sessions where expireref = '$USER'
|
||||||
|
</pre>
|
||||||
|
then the user is logged out. Useful for ejecting someone from a
|
||||||
|
site.
|
||||||
|
<p>
|
||||||
|
3. You can scan the sessions table to ensure no user
|
||||||
|
can be logged in twice. Useful for security reasons.
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<h3>Compression/Encryption Schemes</h3>
|
||||||
Since ADOdb 4.05, thanks to Ross Smith, multiple encryption and compression schemes are supported.
|
Since ADOdb 4.05, thanks to Ross Smith, multiple encryption and compression schemes are supported.
|
||||||
Currently, supported:
|
Currently, supported:
|
||||||
<pre>
|
<pre>
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
@ -34,6 +34,11 @@ class ADODB_access extends ADODB_odbc {
|
|||||||
$this->ADODB_odbc();
|
$this->ADODB_odbc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Time()
|
||||||
|
{
|
||||||
|
return time();
|
||||||
|
}
|
||||||
|
|
||||||
function BeginTrans() { return false;}
|
function BeginTrans() { return false;}
|
||||||
|
|
||||||
function IfNull( $field, $ifNull )
|
function IfNull( $field, $ifNull )
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
@ -45,7 +45,9 @@ class ADODB_ado extends ADOConnection {
|
|||||||
|
|
||||||
function _affectedrows()
|
function _affectedrows()
|
||||||
{
|
{
|
||||||
return $this->_affectedRows->value;
|
if (PHP_VERSION >= 5) return $this->_affectedRows;
|
||||||
|
|
||||||
|
return $this->_affectedRows->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// you can also pass a connection string like this:
|
// you can also pass a connection string like this:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
@version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
@version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
@ -295,7 +295,8 @@ class ADODB_ibase extends ADOConnection {
|
|||||||
$sql = $sql[1];
|
$sql = $sql[1];
|
||||||
|
|
||||||
if (is_array($iarr)) {
|
if (is_array($iarr)) {
|
||||||
if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
|
if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
|
||||||
|
if ( !isset($iarr[0]) ) $iarr[0] = ''; // PHP5 compat hack
|
||||||
$fnarr =& array_merge( array($sql) , $iarr);
|
$fnarr =& array_merge( array($sql) , $iarr);
|
||||||
$ret = call_user_func_array($fn,$fnarr);
|
$ret = call_user_func_array($fn,$fnarr);
|
||||||
} else {
|
} else {
|
||||||
@ -317,6 +318,7 @@ class ADODB_ibase extends ADOConnection {
|
|||||||
|
|
||||||
if (is_array($iarr)) {
|
if (is_array($iarr)) {
|
||||||
if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
|
if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
|
||||||
|
if ( !isset($iarr[0]) ) $iarr[0] = ''; // PHP5 compat hack
|
||||||
$fnarr =& array_merge( array($conn,$sql) , $iarr);
|
$fnarr =& array_merge( array($conn,$sql) , $iarr);
|
||||||
$ret = call_user_func_array($fn,$fnarr);
|
$ret = call_user_func_array($fn,$fnarr);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
* Whenever there is any discrepancy between the two licenses,
|
* Whenever there is any discrepancy between the two licenses,
|
||||||
* the BSD license will take precedence.
|
* the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim. All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim. All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
309
phpgwapi/inc/adodb/drivers/adodb-ldap.inc.php
Normal file
309
phpgwapi/inc/adodb/drivers/adodb-ldap.inc.php
Normal file
@ -0,0 +1,309 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
V4.22 15 Apr 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.
|
||||||
|
Set tabs to 8.
|
||||||
|
|
||||||
|
|
||||||
|
Joshua Eldridge (joshuae74#hotmail.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class ADODB_ldap extends ADOConnection {
|
||||||
|
var $databaseType = 'ldap';
|
||||||
|
var $dataProvider = 'ldap';
|
||||||
|
|
||||||
|
# Connection information
|
||||||
|
var $username = false;
|
||||||
|
var $password = false;
|
||||||
|
|
||||||
|
# Used during searches
|
||||||
|
var $filter;
|
||||||
|
var $dn;
|
||||||
|
|
||||||
|
|
||||||
|
function ADODB_ldap()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns true or false
|
||||||
|
|
||||||
|
function _connect( $host, $username, $password, $ldapbase )
|
||||||
|
{
|
||||||
|
|
||||||
|
if ( !function_exists( 'ldap_connect' ) ) return false;
|
||||||
|
|
||||||
|
$conn_info = array( $host );
|
||||||
|
|
||||||
|
if ( strstr( $host, ':' ) ) {
|
||||||
|
$conn_info = split( ':', $host );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_connectionID = ldap_connect( $conn_info[0], $conn_info[1] )
|
||||||
|
or die( 'Could not connect to ' . $this->_connectionID );
|
||||||
|
if ($username && $password) {
|
||||||
|
$bind = ldap_bind( $this->_connectionID, $username, $password )
|
||||||
|
or die( 'Could not bind to ' . $this->_connectionID . ' with $username & $password');
|
||||||
|
} else {
|
||||||
|
$bind = ldap_bind( $this->_connectionID )
|
||||||
|
or die( 'Could not bind anonymously to ' . $this->_connectionID );
|
||||||
|
}
|
||||||
|
return $this->_connectionID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* returns _queryID or false */
|
||||||
|
function _query($sql,$inputarr)
|
||||||
|
{
|
||||||
|
$rs = ldap_search( $this->_connectionID, $this->database, $sql );
|
||||||
|
return $rs;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* closes the LDAP connection */
|
||||||
|
function _close()
|
||||||
|
{
|
||||||
|
@ldap_close( $this->_connectionID );
|
||||||
|
$this->_connectionID = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ServerInfo()
|
||||||
|
{
|
||||||
|
if( is_array( $this->version ) ) return $this->version;
|
||||||
|
$version = array();
|
||||||
|
/*
|
||||||
|
Determines how aliases are handled during search.
|
||||||
|
LDAP_DEREF_NEVER (0x00)
|
||||||
|
LDAP_DEREF_SEARCHING (0x01)
|
||||||
|
LDAP_DEREF_FINDING (0x02)
|
||||||
|
LDAP_DEREF_ALWAYS (0x03)
|
||||||
|
The LDAP_DEREF_SEARCHING value means aliases are dereferenced during the search but
|
||||||
|
not when locating the base object of the search. The LDAP_DEREF_FINDING value means
|
||||||
|
aliases are dereferenced when locating the base object but not during the search.
|
||||||
|
Default: LDAP_DEREF_NEVER
|
||||||
|
*/
|
||||||
|
ldap_get_option( $this->_connectionID, LDAP_OPT_DEREF, $version['LDAP_OPT_DEREF'] ) ;
|
||||||
|
switch ( $version['LDAP_OPT_DEREF'] ) {
|
||||||
|
case 0:
|
||||||
|
$version['LDAP_OPT_DEREF'] = 'LDAP_DEREF_NEVER';
|
||||||
|
case 1:
|
||||||
|
$version['LDAP_OPT_DEREF'] = 'LDAP_DEREF_SEARCHING';
|
||||||
|
case 2:
|
||||||
|
$version['LDAP_OPT_DEREF'] = 'LDAP_DEREF_FINDING';
|
||||||
|
case 3:
|
||||||
|
$version['LDAP_OPT_DEREF'] = 'LDAP_DEREF_ALWAYS';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
A limit on the number of entries to return from a search.
|
||||||
|
LDAP_NO_LIMIT (0) means no limit.
|
||||||
|
Default: LDAP_NO_LIMIT
|
||||||
|
*/
|
||||||
|
ldap_get_option( $this->_connectionID, LDAP_OPT_SIZELIMIT, $version['LDAP_OPT_SIZELIMIT'] );
|
||||||
|
if ( $version['LDAP_OPT_SIZELIMIT'] == 0 ) {
|
||||||
|
$version['LDAP_OPT_SIZELIMIT'] = 'LDAP_NO_LIMIT';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
A limit on the number of seconds to spend on a search.
|
||||||
|
LDAP_NO_LIMIT (0) means no limit.
|
||||||
|
Default: LDAP_NO_LIMIT
|
||||||
|
*/
|
||||||
|
ldap_get_option( $this->_connectionID, LDAP_OPT_TIMELIMIT, $version['LDAP_OPT_TIMELIMIT'] );
|
||||||
|
if ( $version['LDAP_OPT_TIMELIMIT'] == 0 ) {
|
||||||
|
$version['LDAP_OPT_TIMELIMIT'] = 'LDAP_NO_LIMIT';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Determines whether the LDAP library automatically follows referrals returned by LDAP servers or not.
|
||||||
|
LDAP_OPT_ON
|
||||||
|
LDAP_OPT_OFF
|
||||||
|
Default: ON
|
||||||
|
*/
|
||||||
|
ldap_get_option( $this->_connectionID, LDAP_OPT_REFERRALS, $version['LDAP_OPT_REFERRALS'] );
|
||||||
|
if ( $version['LDAP_OPT_REFERRALS'] == 0 ) {
|
||||||
|
$version['LDAP_OPT_REFERRALS'] = 'LDAP_OPT_OFF';
|
||||||
|
} else {
|
||||||
|
$version['LDAP_OPT_REFERRALS'] = 'LDAP_OPT_ON';
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Determines whether LDAP I/O operations are automatically restarted if they abort prematurely.
|
||||||
|
LDAP_OPT_ON
|
||||||
|
LDAP_OPT_OFF
|
||||||
|
Default: OFF
|
||||||
|
*/
|
||||||
|
ldap_get_option( $this->_connectionID, LDAP_OPT_RESTART, $version['LDAP_OPT_RESTART'] );
|
||||||
|
if ( $version['LDAP_OPT_RESTART'] == 0 ) {
|
||||||
|
$version['LDAP_OPT_RESTART'] = 'LDAP_OPT_OFF';
|
||||||
|
} else {
|
||||||
|
$version['LDAP_OPT_RESTART'] = 'LDAP_OPT_ON';
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
This option indicates the version of the LDAP protocol used when communicating with the primary LDAP server.
|
||||||
|
LDAP_VERSION2 (2)
|
||||||
|
LDAP_VERSION3 (3)
|
||||||
|
Default: LDAP_VERSION2 (2)
|
||||||
|
*/
|
||||||
|
ldap_get_option( $this->_connectionID, LDAP_OPT_PROTOCOL_VERSION, $version['LDAP_OPT_PROTOCOL_VERSION'] );
|
||||||
|
if ( $version['LDAP_OPT_PROTOCOL_VERSION'] == 2 ) {
|
||||||
|
$version['LDAP_OPT_PROTOCOL_VERSION'] = 'LDAP_VERSION2';
|
||||||
|
} else {
|
||||||
|
$version['LDAP_OPT_PROTOCOL_VERSION'] = 'LDAP_VERSION3';
|
||||||
|
|
||||||
|
}
|
||||||
|
/* The host name (or list of hosts) for the primary LDAP server. */
|
||||||
|
ldap_get_option( $this->_connectionID, LDAP_OPT_HOST_NAME, $version['LDAP_OPT_HOST_NAME'] );
|
||||||
|
ldap_get_option( $this->_connectionID, OPT_ERROR_NUMBER, $version['OPT_ERROR_NUMBER'] );
|
||||||
|
ldap_get_option( $this->_connectionID, OPT_ERROR_STRING, $version['OPT_ERROR_STRING'] );
|
||||||
|
ldap_get_option( $this->_connectionID, LDAP_OPT_MATCHED_DN, $version['LDAP_OPT_MATCHED_DN'] );
|
||||||
|
|
||||||
|
return $this->version = $version;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------------
|
||||||
|
Class Name: Recordset
|
||||||
|
--------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class ADORecordSet_ldap extends ADORecordSet{
|
||||||
|
|
||||||
|
var $databaseType = "ldap";
|
||||||
|
var $canSeek = false;
|
||||||
|
var $_entryID; /* keeps track of the entry resource identifier */
|
||||||
|
|
||||||
|
function ADORecordSet_ldap($queryID,$mode=false)
|
||||||
|
{
|
||||||
|
if ($mode === false) {
|
||||||
|
global $ADODB_FETCH_MODE;
|
||||||
|
$mode = $ADODB_FETCH_MODE;
|
||||||
|
}
|
||||||
|
switch ($mode)
|
||||||
|
{
|
||||||
|
case ADODB_FETCH_NUM:
|
||||||
|
$this->fetchMode = LDAP_NUM;
|
||||||
|
break;
|
||||||
|
case ADODB_FETCH_ASSOC:
|
||||||
|
$this->fetchMode = LDAP_ASSOC;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case ADODB_FETCH_DEFAULT:
|
||||||
|
case ADODB_FETCH_BOTH:
|
||||||
|
$this->fetchMode = LDAP_BOTH;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->ADORecordSet($queryID);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _initrs()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
This could be teaked to respect the $COUNTRECS directive from ADODB
|
||||||
|
It's currently being used in the _fetch() function and the
|
||||||
|
GetAssoc() function
|
||||||
|
*/
|
||||||
|
$this->_numOfRows = ldap_count_entries( $this->connection->_connectionID, $this->_queryID );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return whole recordset as a multi-dimensional associative array
|
||||||
|
*/
|
||||||
|
function &GetAssoc($force_array = false, $first2cols = false)
|
||||||
|
{
|
||||||
|
$records = $this->_numOfRows;
|
||||||
|
$results = array();
|
||||||
|
for ( $i=0; $i < $records; $i++ ) {
|
||||||
|
foreach ( $this->fields as $k=>$v ) {
|
||||||
|
if ( is_array( $v ) ) {
|
||||||
|
if ( $v['count'] == 1 ) {
|
||||||
|
$results[$i][$k] = $v[0];
|
||||||
|
} else {
|
||||||
|
array_shift( $v );
|
||||||
|
$results[$i][$k] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &GetRowAssoc()
|
||||||
|
{
|
||||||
|
$results = array();
|
||||||
|
foreach ( $this->fields as $k=>$v ) {
|
||||||
|
if ( is_array( $v ) ) {
|
||||||
|
if ( $v['count'] == 1 ) {
|
||||||
|
$results[$k] = $v[0];
|
||||||
|
} else {
|
||||||
|
array_shift( $v );
|
||||||
|
$results[$k] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetRowNums()
|
||||||
|
{
|
||||||
|
$results = array();
|
||||||
|
foreach ( $this->fields as $k=>$v ) {
|
||||||
|
static $i = 0;
|
||||||
|
if (is_array( $v )) {
|
||||||
|
if ( $v['count'] == 1 ) {
|
||||||
|
$results[$i] = $v[0];
|
||||||
|
} else {
|
||||||
|
array_shift( $v );
|
||||||
|
$results[$i] = $v;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _fetch()
|
||||||
|
{
|
||||||
|
if ( $this->_currentRow >= $this->_numOfRows && $this->_numOfRows >= 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( $this->_currentRow == 0 ) {
|
||||||
|
$this->_entryID = ldap_first_entry( $this->connection->_connectionID, $this->_queryID );
|
||||||
|
} else {
|
||||||
|
$this->_entryID = ldap_next_entry( $this->connection->_connectionID, $this->_entryID );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fields = ldap_get_attributes( $this->connection->_connectionID, $this->_entryID );
|
||||||
|
$this->_numOfFields = $this->fields['count'];
|
||||||
|
switch ( $this->fetchMode ) {
|
||||||
|
|
||||||
|
case LDAP_ASSOC:
|
||||||
|
$this->fields = $this->GetRowAssoc();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LDAP_NUM:
|
||||||
|
$this->fields = $this->GetRowNums();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LDAP_BOTH:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ( is_array( $this->fields ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
function _close() {
|
||||||
|
@ldap_free_result( $this->_queryID );
|
||||||
|
$this->_queryID = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
* Whenever there is any discrepancy between the two licenses,
|
* Whenever there is any discrepancy between the two licenses,
|
||||||
* the BSD license will take precedence.
|
* the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
168
phpgwapi/inc/adodb/drivers/adodb-netezza.inc.php
Normal file
168
phpgwapi/inc/adodb/drivers/adodb-netezza.inc.php
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
V4.22 15 Apr 2004 (c) 2000-2004 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/
|
||||||
|
Major Additions/Changes:
|
||||||
|
MetaDatabasesSQL, MetaTablesSQL, MetaColumnsSQL
|
||||||
|
Note: You have to have admin privileges to access the system tables
|
||||||
|
Removed non-working keys code (Netezza has no concept of keys)
|
||||||
|
Fixed the way data types and lengths are returned in MetaColumns()
|
||||||
|
as well as added the default lengths for certain types
|
||||||
|
Updated public variables for Netezza
|
||||||
|
Still need to remove blob functions, as Netezza doesn't suppport blob
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
include_once(ADODB_DIR.'/drivers/adodb-postgres64.inc.php');
|
||||||
|
|
||||||
|
class ADODB_netezza extends ADODB_postgres64 {
|
||||||
|
var $databaseType = 'netezza';
|
||||||
|
var $dataProvider = 'netezza';
|
||||||
|
var $hasInsertID = false;
|
||||||
|
var $_resultid = false;
|
||||||
|
var $concat_operator='||';
|
||||||
|
var $random = 'random';
|
||||||
|
var $upperCase = 'upper';
|
||||||
|
var $metaDatabasesSQL = "select objname from _v_object_data where objtype='database' order by 1";
|
||||||
|
var $metaTablesSQL = "select objname from _v_object_data where objtype='table' order by 1";
|
||||||
|
var $isoDates = true; // accepts dates in ISO format
|
||||||
|
var $sysDate = "CURRENT_DATE";
|
||||||
|
var $sysTimeStamp = "CURRENT_TIMESTAMP";
|
||||||
|
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
|
||||||
|
// something that can be pulled from the system tables
|
||||||
|
var $metaKeySQL = "";
|
||||||
|
var $hasAffectedRows = 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
|
||||||
|
var $fmtTimeStamp = "'Y-m-d G:i:s'"; // used by DBTimeStamp as the default timestamp fmt.
|
||||||
|
var $ansiOuter = true;
|
||||||
|
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 &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) {
|
||||||
|
$fld = new ADOFieldObject();
|
||||||
|
$fld->name = $rs->fields[0];
|
||||||
|
|
||||||
|
// 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":
|
||||||
|
$fld->max_length = 1;
|
||||||
|
break;
|
||||||
|
case "smallint":
|
||||||
|
$fld->max_length = 2;
|
||||||
|
break;
|
||||||
|
case "integer":
|
||||||
|
case "numeric":
|
||||||
|
case "date":
|
||||||
|
$fld->max_length = 4;
|
||||||
|
break;
|
||||||
|
case "bigint":
|
||||||
|
case "time":
|
||||||
|
case "timestamp":
|
||||||
|
$fld->max_length = 8;
|
||||||
|
break;
|
||||||
|
case "timetz":
|
||||||
|
case "time with time zone":
|
||||||
|
$fld->max_length = 12;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
|
||||||
|
else $retarr[($upper) ? strtoupper($fld->name) : $fld->name] = $fld;
|
||||||
|
|
||||||
|
$rs->MoveNext();
|
||||||
|
}
|
||||||
|
$rs->Close();
|
||||||
|
return $retarr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------------
|
||||||
|
Class Name: Recordset
|
||||||
|
--------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class ADORecordSet_netezza extends ADORecordSet_postgres64
|
||||||
|
{
|
||||||
|
var $databaseType = "netezza";
|
||||||
|
var $canSeek = true;
|
||||||
|
|
||||||
|
function ADORecordSet_netezza($queryID,$mode=false)
|
||||||
|
{
|
||||||
|
if ($mode === false) {
|
||||||
|
global $ADODB_FETCH_MODE;
|
||||||
|
$mode = $ADODB_FETCH_MODE;
|
||||||
|
}
|
||||||
|
switch ($mode)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
$this->ADORecordSet($queryID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// _initrs modified to disable blob handling
|
||||||
|
function _initrs()
|
||||||
|
{
|
||||||
|
global $ADODB_COUNTRECS;
|
||||||
|
$this->_numOfRows = ($ADODB_COUNTRECS)? @pg_numrows($this->_queryID):-1;
|
||||||
|
$this->_numOfFields = @pg_numfields($this->_queryID);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
|
|
||||||
version V4.20 22 Feb 2004 (c) 2000-2004 John Lim. All rights reserved.
|
version V4.22 15 Apr 2004 (c) 2000-2004 John Lim. All rights reserved.
|
||||||
|
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
@ -112,6 +112,14 @@ class ADODB_oci8 extends ADOConnection {
|
|||||||
return $retarr;
|
return $retarr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Time()
|
||||||
|
{
|
||||||
|
$rs =& $this->Execute("select TO_CHAR($this->sysTimeStamp,'YYYY-MM-DD HH24:MI:SS') from dual");
|
||||||
|
if ($rs && !$rs->EOF) return $this->UnixTimeStamp(reset($rs->fields));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Multiple modes of connection are supported:
|
Multiple modes of connection are supported:
|
||||||
@ -589,6 +597,7 @@ NATSOFT.DOMAIN =
|
|||||||
return $rez;
|
return $rez;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Example of usage:
|
Example of usage:
|
||||||
|
|
||||||
@ -683,6 +692,11 @@ NATSOFT.DOMAIN =
|
|||||||
if ($type !== false) $rez = OCIBindByName($stmt[1],":".$name,$var,$size,$type);
|
if ($type !== false) $rez = OCIBindByName($stmt[1],":".$name,$var,$size,$type);
|
||||||
else $rez = OCIBindByName($stmt[1],":".$stmt[2],$var,$size); // +1 byte for null terminator
|
else $rez = OCIBindByName($stmt[1],":".$stmt[2],$var,$size); // +1 byte for null terminator
|
||||||
$stmt[2] += 1;
|
$stmt[2] += 1;
|
||||||
|
} else if ($type == OCI_B_BLOB){
|
||||||
|
//we have to create a new Descriptor here
|
||||||
|
$_blob = OCINewDescriptor($this->_connectionID, OCI_D_LOB);
|
||||||
|
$rez = OCIBindByName($stmt[1], ":".$name, &$_blob, -1, OCI_B_BLOB);
|
||||||
|
$rez = $_blob;
|
||||||
} else {
|
} else {
|
||||||
if ($type !== false) $rez = OCIBindByName($stmt[1],":".$name,$var,$size,$type);
|
if ($type !== false) $rez = OCIBindByName($stmt[1],":".$name,$var,$size,$type);
|
||||||
else $rez = OCIBindByName($stmt[1],":".$name,$var,$size); // +1 byte for null terminator
|
else $rez = OCIBindByName($stmt[1],":".$name,$var,$size); // +1 byte for null terminator
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
* Whenever there is any discrepancy between the two licenses,
|
* Whenever there is any discrepancy between the two licenses,
|
||||||
* the BSD license will take precedence.
|
* the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim. All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim. All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
@ -159,7 +159,7 @@ class ADODB_odbc extends ADOConnection {
|
|||||||
|
|
||||||
if (!function_exists('odbc_connect')) return false;
|
if (!function_exists('odbc_connect')) return false;
|
||||||
|
|
||||||
if ($this->debug && $argDatabasename) {
|
if ($this->debug && $argDatabasename && $this->databaseType != 'vfp') {
|
||||||
ADOConnection::outp("For odbc Connect(), $argDatabasename is not used. Place dsn in 1st parameter.");
|
ADOConnection::outp("For odbc Connect(), $argDatabasename is not used. Place dsn in 1st parameter.");
|
||||||
}
|
}
|
||||||
$php_errormsg = '';
|
$php_errormsg = '';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
630
phpgwapi/inc/adodb/drivers/adodb-odbtp.inc.php
Normal file
630
phpgwapi/inc/adodb/drivers/adodb-odbtp.inc.php
Normal file
@ -0,0 +1,630 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
V4.22 15 Apr 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. See License.txt.
|
||||||
|
Set tabs to 4 for best viewing.
|
||||||
|
Latest version is available at http://php.weblogs.com/
|
||||||
|
*/
|
||||||
|
// Code contributed by "stefan bogdan" <sbogdan#rsb.ro>
|
||||||
|
|
||||||
|
define("_ADODB_ODBTP_LAYER", 2 );
|
||||||
|
|
||||||
|
class ADODB_odbtp extends ADOConnection{
|
||||||
|
var $databaseType = "odbtp";
|
||||||
|
var $dataProvider = "odbtp";
|
||||||
|
var $fmtDate = "'Y-m-d'";
|
||||||
|
var $fmtTimeStamp = "'Y-m-d, h:i:sA'";
|
||||||
|
var $replaceQuote = "''"; // string to use to replace quotes
|
||||||
|
var $odbc_driver = 0;
|
||||||
|
var $hasAffectedRows = true;
|
||||||
|
var $hasInsertID = false;
|
||||||
|
var $hasGenID = true;
|
||||||
|
var $hasMoveFirst = true;
|
||||||
|
|
||||||
|
var $_genSeqSQL = "create table %s (seq_name char(30) not null unique , seq_value integer not null)";
|
||||||
|
var $_dropSeqSQL = "delete from adodb_seq where seq_name = '%s'";
|
||||||
|
var $_autocommit = true;
|
||||||
|
var $_bindInputArray = false;
|
||||||
|
var $_useUnicodeSQL = false;
|
||||||
|
var $_canPrepareSP = false;
|
||||||
|
|
||||||
|
function ADODB_odbtp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
function ServerInfo()
|
||||||
|
{
|
||||||
|
return array('description' => @odbtp_get_attr( ODB_ATTR_DBMSNAME, $this->_connectionID),
|
||||||
|
'version' => @odbtp_get_attr( ODB_ATTR_DBMSVER, $this->_connectionID));
|
||||||
|
}
|
||||||
|
|
||||||
|
function ErrorMsg()
|
||||||
|
{
|
||||||
|
if (empty($this->_connectionID)) return @odbtp_last_error();
|
||||||
|
return @odbtp_last_error($this->_connectionID);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ErrorNo()
|
||||||
|
{
|
||||||
|
if (empty($this->_connectionID)) return @odbtp_last_error_state();
|
||||||
|
return @odbtp_last_error_state($this->_connectionID);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
// they are in the same stored procedure, function, or batch.
|
||||||
|
return $this->GetOne($this->identitySQL);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _affectedrows()
|
||||||
|
{
|
||||||
|
if ($this->_queryID) {
|
||||||
|
return @odbtp_affected_rows ($this->_queryID);
|
||||||
|
} else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CreateSequence($seqname='adodbseq',$start=1)
|
||||||
|
{
|
||||||
|
//verify existence
|
||||||
|
$num = $this->GetOne("select seq_value from adodb_seq");
|
||||||
|
$seqtab='adodb_seq';
|
||||||
|
if( $this->odbc_driver == ODB_DRIVER_FOXPRO ) {
|
||||||
|
$path = @odbtp_get_attr( ODB_ATTR_DATABASENAME, $this->_connectionID );
|
||||||
|
//if using vfp dbc file
|
||||||
|
if( !strcasecmp(strrchr($path, '.'), '.dbc') )
|
||||||
|
$path = substr($path,0,strrpos($path,'\/'));
|
||||||
|
$seqtab = $path . '/' . $seqtab;
|
||||||
|
}
|
||||||
|
if($num == false) {
|
||||||
|
if (empty($this->_genSeqSQL)) return false;
|
||||||
|
$ok = $this->Execute(sprintf($this->_genSeqSQL ,$seqtab));
|
||||||
|
}
|
||||||
|
$num = $this->GetOne("select seq_value from adodb_seq where seq_name='$seqname'");
|
||||||
|
if ($num) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$start -= 1;
|
||||||
|
return $this->Execute("insert into adodb_seq values('$seqname',$start)");
|
||||||
|
}
|
||||||
|
|
||||||
|
function DropSequence($seqname)
|
||||||
|
{
|
||||||
|
if (empty($this->_dropSeqSQL)) return false;
|
||||||
|
return $this->Execute(sprintf($this->_dropSeqSQL,$seqname));
|
||||||
|
}
|
||||||
|
|
||||||
|
function GenID($seq='adodbseq',$start=1)
|
||||||
|
{
|
||||||
|
$seqtab='adodb_seq';
|
||||||
|
if( $this->odbc_driver == ODB_DRIVER_FOXPRO ) {
|
||||||
|
$path = @odbtp_get_attr( ODB_ATTR_DATABASENAME, $this->_connectionID );
|
||||||
|
//if using vfp dbc file
|
||||||
|
if( !strcasecmp(strrchr($path, '.'), '.dbc') )
|
||||||
|
$path = substr($path,0,strrpos($path,'\/'));
|
||||||
|
$seqtab = $path . '/' . $seqtab;
|
||||||
|
}
|
||||||
|
$MAXLOOPS = 100;
|
||||||
|
while (--$MAXLOOPS>=0) {
|
||||||
|
$num = $this->GetOne("select seq_value from adodb_seq where seq_name='$seq'");
|
||||||
|
if ($num === false) {
|
||||||
|
//verify if abodb_seq table exist
|
||||||
|
$ok = $this->GetOne("select seq_value from adodb_seq ");
|
||||||
|
if(!$ok) {
|
||||||
|
//creating the sequence table adodb_seq
|
||||||
|
$this->Execute(sprintf($this->_genSeqSQL ,$seqtab));
|
||||||
|
}
|
||||||
|
$start -= 1;
|
||||||
|
$num = '0';
|
||||||
|
$ok = $this->Execute("insert into adodb_seq values('$seq',$start)");
|
||||||
|
if (!$ok) return false;
|
||||||
|
}
|
||||||
|
$ok = $this->Execute("update adodb_seq set seq_value=seq_value+1 where seq_name='$seq'");
|
||||||
|
if($ok) {
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
//example for $UserOrDSN
|
||||||
|
//for visual fox : DRIVER={Microsoft Visual FoxPro Driver};SOURCETYPE=DBF;SOURCEDB=c:\YourDbfFileDir;EXCLUSIVE=NO;
|
||||||
|
//for visual fox dbc: DRIVER={Microsoft Visual FoxPro Driver};SOURCETYPE=DBC;SOURCEDB=c:\YourDbcFileDir\mydb.dbc;EXCLUSIVE=NO;
|
||||||
|
//for access : DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\path_to_access_db\base_test.mdb;UID=root;PWD=;
|
||||||
|
//for mssql : DRIVER={SQL Server};SERVER=myserver;UID=myuid;PWD=mypwd;DATABASE=OdbtpTest;
|
||||||
|
//if uid & pwd can be separate
|
||||||
|
function _connect($HostOrInterface, $UserOrDSN='', $argPassword='', $argDatabase='')
|
||||||
|
{
|
||||||
|
$this->_connectionID = @odbtp_connect($HostOrInterface,$UserOrDSN,$argPassword,$argDatabase);
|
||||||
|
if ($this->_connectionID === false)
|
||||||
|
{
|
||||||
|
$this->_errorMsg = $this->ErrorMsg() ;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$this->odbc_driver = @odbtp_get_attr(ODB_ATTR_DRIVER, $this->_connectionID);
|
||||||
|
|
||||||
|
// Set driver specific attributes
|
||||||
|
switch( $this->odbc_driver ) {
|
||||||
|
case ODB_DRIVER_MSSQL:
|
||||||
|
$this->fmtDate = "'Y-m-d'";
|
||||||
|
$this->fmtTimeStamp = "'Y-m-d h:i:sA'";
|
||||||
|
$this->sysDate = 'convert(datetime,convert(char,GetDate(),102),102)';
|
||||||
|
$this->sysTimeStamp = 'GetDate()';
|
||||||
|
$this->ansiOuter = true;
|
||||||
|
$this->leftOuter = '*=';
|
||||||
|
$this->rightOuter = '=*';
|
||||||
|
$this->hasTop = 'top';
|
||||||
|
$this->hasInsertID = true;
|
||||||
|
$this->hasTransactions = true;
|
||||||
|
$this->_bindInputArray = true;
|
||||||
|
$this->_canSelectDb = true;
|
||||||
|
$this->substr = "substring";
|
||||||
|
$this->length = 'len';
|
||||||
|
$this->upperCase = 'upper';
|
||||||
|
$this->identitySQL = 'select @@IDENTITY';
|
||||||
|
$this->metaDatabasesSQL = "select name from master..sysdatabases where name <> 'master'";
|
||||||
|
break;
|
||||||
|
case ODB_DRIVER_JET:
|
||||||
|
$this->fmtDate = "#Y-m-d#";
|
||||||
|
$this->fmtTimeStamp = "#Y-m-d h:i:sA#";
|
||||||
|
$this->sysDate = "FORMAT(NOW,'yyyy-mm-dd')";
|
||||||
|
$this->sysTimeStamp = 'NOW';
|
||||||
|
$this->hasTop = 'top';
|
||||||
|
$this->hasTransactions = false;
|
||||||
|
$this->_canPrepareSP = true; // For MS Access only.
|
||||||
|
|
||||||
|
// Can't rebind ODB_CHAR to ODB_WCHAR if row cache enabled.
|
||||||
|
if ($this->_useUnicodeSQL)
|
||||||
|
odbtp_use_row_cache($this->_connectionID, FALSE, 0);
|
||||||
|
break;
|
||||||
|
case ODB_DRIVER_FOXPRO:
|
||||||
|
$this->fmtDate = "{^Y-m-d}";
|
||||||
|
$this->fmtTimeStamp = "{^Y-m-d, h:i:sA}";
|
||||||
|
$this->sysDate = 'date()';
|
||||||
|
$this->sysTimeStamp = 'datetime()';
|
||||||
|
$this->ansiOuter = true;
|
||||||
|
$this->hasTop = 'top';
|
||||||
|
$this->hasTransactions = false;
|
||||||
|
$this->replaceQuote = "'+chr(39)+'";
|
||||||
|
$this->true = '.T.';
|
||||||
|
$this->false = '.F.';
|
||||||
|
$this->upperCase = 'upper';
|
||||||
|
break;
|
||||||
|
case ODB_DRIVER_ORACLE:
|
||||||
|
$this->fmtDate = "'Y-m-d 00:00:00'";
|
||||||
|
$this->fmtTimeStamp = "'Y-m-d h:i:sA'";
|
||||||
|
$this->sysDate = 'TRUNC(SYSDATE)';
|
||||||
|
$this->sysTimeStamp = 'SYSDATE';
|
||||||
|
$this->hasTransactions = true;
|
||||||
|
$this->_bindInputArray = true;
|
||||||
|
$this->concat_operator = '||';
|
||||||
|
break;
|
||||||
|
case ODB_DRIVER_SYBASE:
|
||||||
|
$this->fmtDate = "'Y-m-d'";
|
||||||
|
$this->fmtTimeStamp = "'Y-m-d H:i:s'";
|
||||||
|
$this->sysDate = 'GetDate()';
|
||||||
|
$this->sysTimeStamp = 'GetDate()';
|
||||||
|
$this->leftOuter = '*=';
|
||||||
|
$this->rightOuter = '=*';
|
||||||
|
$this->hasInsertID = true;
|
||||||
|
$this->hasTransactions = true;
|
||||||
|
$this->upperCase = 'upper';
|
||||||
|
$this->identitySQL = 'select @@IDENTITY';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if( @odbtp_get_attr(ODB_ATTR_TXNCAPABLE, $this->_connectionID) )
|
||||||
|
$this->hasTransactions = true;
|
||||||
|
else
|
||||||
|
$this->hasTransactions = false;
|
||||||
|
}
|
||||||
|
@odbtp_set_attr(ODB_ATTR_FULLCOLINFO, TRUE, $this->_connectionID );
|
||||||
|
if ($this->_useUnicodeSQL )
|
||||||
|
@odbtp_set_attr(ODB_ATTR_UNICODESQL, TRUE, $this->_connectionID);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _pconnect($HostOrInterface, $UserOrDSN='', $argPassword='', $argDatabase='')
|
||||||
|
{
|
||||||
|
return $this->_connect($HostOrInterface, $UserOrDSN, $argPassword, $argDatabase);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SelectDB($dbName)
|
||||||
|
{
|
||||||
|
if (!@odbtp_select_db($dbName, $this->_connectionID)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$this->databaseName = $dbName;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &MetaTables($ttype='',$showSchema=false,$mask=false)
|
||||||
|
{
|
||||||
|
global $ADODB_FETCH_MODE;
|
||||||
|
|
||||||
|
$savem = $ADODB_FETCH_MODE;
|
||||||
|
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||||
|
$arr =& $this->GetArray("||SQLTables||||$ttype");
|
||||||
|
$ADODB_FETCH_MODE = $savem;
|
||||||
|
|
||||||
|
$arr2 = array();
|
||||||
|
for ($i=0; $i < sizeof($arr); $i++) {
|
||||||
|
if ($arr[$i][3] == 'SYSTEM TABLE' ) continue;
|
||||||
|
if ($arr[$i][2])
|
||||||
|
$arr2[] = $showSchema ? $arr[$i][1].'.'.$arr[$i][2] : $arr[$i][2];
|
||||||
|
}
|
||||||
|
return $arr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &MetaColumns($table,$upper=true)
|
||||||
|
{
|
||||||
|
global $ADODB_FETCH_MODE;
|
||||||
|
|
||||||
|
$schema = false;
|
||||||
|
$this->_findschema($table,$schema);
|
||||||
|
if ($upper) $table = strtoupper($table);
|
||||||
|
|
||||||
|
$savem = $ADODB_FETCH_MODE;
|
||||||
|
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||||
|
$rs = $this->Execute( "||SQLColumns||$schema|$table" );
|
||||||
|
$ADODB_FETCH_MODE = $savem;
|
||||||
|
|
||||||
|
if (!$rs) return false;
|
||||||
|
|
||||||
|
while (!$rs->EOF) {
|
||||||
|
//print_r($rs->fields);
|
||||||
|
if (strtoupper($rs->fields[2]) == $table) {
|
||||||
|
$fld = new ADOFieldObject();
|
||||||
|
$fld->name = $rs->fields[3];
|
||||||
|
$fld->type = $rs->fields[5];
|
||||||
|
$fld->max_length = $rs->fields[6];
|
||||||
|
$fld->not_null = !empty($rs->fields[9]);
|
||||||
|
$fld->scale = $rs->fields[7];
|
||||||
|
if (!is_null($rs->fields[12])) {
|
||||||
|
$fld->has_default = true;
|
||||||
|
$fld->default_value = $rs->fields[12];
|
||||||
|
}
|
||||||
|
$retarr[strtoupper($fld->name)] = $fld;
|
||||||
|
} else if (sizeof($retarr)>0)
|
||||||
|
break;
|
||||||
|
$rs->MoveNext();
|
||||||
|
}
|
||||||
|
$rs->Close();
|
||||||
|
|
||||||
|
return $retarr;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &MetaPrimaryKeys($table, $owner='')
|
||||||
|
{
|
||||||
|
global $ADODB_FETCH_MODE;
|
||||||
|
|
||||||
|
$savem = $ADODB_FETCH_MODE;
|
||||||
|
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||||
|
$arr =& $this->GetArray("||SQLPrimaryKeys||$owner|$table");
|
||||||
|
$ADODB_FETCH_MODE = $savem;
|
||||||
|
|
||||||
|
//print_r($arr);
|
||||||
|
$arr2 = array();
|
||||||
|
for ($i=0; $i < sizeof($arr); $i++) {
|
||||||
|
if ($arr[$i][3]) $arr2[] = $arr[$i][3];
|
||||||
|
}
|
||||||
|
return $arr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &MetaForeignKeys($table, $owner='', $upper=false)
|
||||||
|
{
|
||||||
|
global $ADODB_FETCH_MODE;
|
||||||
|
|
||||||
|
$savem = $ADODB_FETCH_MODE;
|
||||||
|
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||||
|
$constraints =& $this->GetArray("||SQLForeignKeys|||||$owner|$table");
|
||||||
|
$ADODB_FETCH_MODE = $savem;
|
||||||
|
|
||||||
|
$arr = false;
|
||||||
|
foreach($constraints as $constr) {
|
||||||
|
//print_r($constr);
|
||||||
|
$arr[$constr[11]][$constr[2]][] = $constr[7].'='.$constr[3];
|
||||||
|
}
|
||||||
|
if (!$arr) return false;
|
||||||
|
|
||||||
|
$arr2 = array();
|
||||||
|
|
||||||
|
foreach($arr as $k => $v) {
|
||||||
|
foreach($v as $a => $b) {
|
||||||
|
if ($upper) $a = strtoupper($a);
|
||||||
|
$arr2[$a] = $b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $arr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
function BeginTrans()
|
||||||
|
{
|
||||||
|
if (!$this->hasTransactions) return false;
|
||||||
|
if ($this->transOff) return true;
|
||||||
|
$this->transCnt += 1;
|
||||||
|
$this->_autocommit = false;
|
||||||
|
$rs = @odbtp_set_attr(ODB_ATTR_TRANSACTIONS,ODB_TXN_READUNCOMMITTED,$this->_connectionID);
|
||||||
|
if(!$rs) return false;
|
||||||
|
else 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;
|
||||||
|
if( ($ret = odbtp_commit($this->_connectionID)) )
|
||||||
|
$ret = @odbtp_set_attr(ODB_ATTR_TRANSACTIONS, ODB_TXN_NONE, $this->_connectionID);//set transaction off
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
function RollbackTrans()
|
||||||
|
{
|
||||||
|
if ($this->transOff) return true;
|
||||||
|
if ($this->transCnt) $this->transCnt -= 1;
|
||||||
|
$this->_autocommit = true;
|
||||||
|
if( ($ret = odbtp_rollback($this->_connectionID)) )
|
||||||
|
$ret = @odbtp_set_attr(ODB_ATTR_TRANSACTIONS, ODB_TXN_NONE, $this->_connectionID);//set transaction off
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
|
||||||
|
{
|
||||||
|
// TOP requires ORDER BY for Visual FoxPro
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Prepare($sql)
|
||||||
|
{
|
||||||
|
if (! $this->_bindInputArray) return $sql; // no binding
|
||||||
|
$stmt = odbtp_prepare($sql,$this->_connectionID);
|
||||||
|
if (!$stmt) {
|
||||||
|
// print "Prepare Error for ($sql) ".$this->ErrorMsg()."<br>";
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
|
return array($sql,$stmt,false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function PrepareSP($sql)
|
||||||
|
{
|
||||||
|
if (!$this->_canPrepareSP) return $sql; // Can't prepare procedures
|
||||||
|
|
||||||
|
$stmt = odbtp_prepare_proc($sql,$this->_connectionID);
|
||||||
|
if (!$stmt) return false;
|
||||||
|
return array($sql,$stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Usage:
|
||||||
|
$stmt = $db->PrepareSP('SP_RUNSOMETHING'); -- takes 2 params, @myid and @group
|
||||||
|
|
||||||
|
# note that the parameter does not have @ in front!
|
||||||
|
$db->Parameter($stmt,$id,'myid');
|
||||||
|
$db->Parameter($stmt,$group,'group',false,64);
|
||||||
|
$db->Parameter($stmt,$group,'photo',false,100000,ODB_BINARY);
|
||||||
|
$db->Execute($stmt);
|
||||||
|
|
||||||
|
@param $stmt Statement returned by Prepare() or PrepareSP().
|
||||||
|
@param $var PHP variable to bind to. Can set to null (for isNull support).
|
||||||
|
@param $name Name of stored procedure variable name to bind to.
|
||||||
|
@param [$isOutput] Indicates direction of parameter 0/false=IN 1=OUT 2= IN/OUT. This is ignored in odbtp.
|
||||||
|
@param [$maxLen] Holds an maximum length of the variable.
|
||||||
|
@param [$type] The data type of $var. Legal values depend on driver.
|
||||||
|
|
||||||
|
See odbtp_attach_param documentation at http://odbtp.sourceforge.net.
|
||||||
|
*/
|
||||||
|
function Parameter(&$stmt, &$var, $name, $isOutput=false, $maxLen=0, $type=0)
|
||||||
|
{
|
||||||
|
if ( $this->odbc_driver == ODB_DRIVER_JET ) {
|
||||||
|
$name = '['.$name.']';
|
||||||
|
if( !$type && $this->_useUnicodeSQL
|
||||||
|
&& @odbtp_param_bindtype($stmt[1], $name) == ODB_CHAR )
|
||||||
|
{
|
||||||
|
$type = ODB_WCHAR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$name = '@'.$name;
|
||||||
|
}
|
||||||
|
return odbtp_attach_param($stmt[1], $name, $var, $type, $maxLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
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='image')
|
||||||
|
{
|
||||||
|
$sql = "UPDATE $table SET $column = ? WHERE $where";
|
||||||
|
if( !($stmt = odbtp_prepare($sql, $this->_connectionID)) )
|
||||||
|
return false;
|
||||||
|
if( !odbtp_input( $stmt, 1, ODB_BINARY, 1000000, $blobtype ) )
|
||||||
|
return false;
|
||||||
|
if( !odbtp_set( $stmt, 1, $val ) )
|
||||||
|
return false;
|
||||||
|
return odbtp_execute( $stmt ) != false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function IfNull( $field, $ifNull )
|
||||||
|
{
|
||||||
|
switch( $this->odbc_driver ) {
|
||||||
|
case ODB_DRIVER_MSSQL:
|
||||||
|
return " ISNULL($field, $ifNull) ";
|
||||||
|
case ODB_DRIVER_JET:
|
||||||
|
return " IIF(IsNull($field), $ifNull, $field) ";
|
||||||
|
}
|
||||||
|
return " CASE WHEN $field is null THEN $ifNull ELSE $field END ";
|
||||||
|
}
|
||||||
|
|
||||||
|
function _query($sql,$inputarr=false)
|
||||||
|
{
|
||||||
|
if ($inputarr) {
|
||||||
|
if (is_array($sql)) {
|
||||||
|
$stmtid = $sql[1];
|
||||||
|
} else {
|
||||||
|
$stmtid = odbtp_prepare($sql,$this->_connectionID);
|
||||||
|
if ($stmtid == false) {
|
||||||
|
$this->_errorMsg = $php_errormsg;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$num_params = odbtp_num_params( $stmtid );
|
||||||
|
for( $param = 1; $param <= $num_params; $param++ ) {
|
||||||
|
@odbtp_input( $stmtid, $param );
|
||||||
|
@odbtp_set( $stmtid, $param, $inputarr[$param-1] );
|
||||||
|
}
|
||||||
|
if (! odbtp_execute($stmtid) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (is_array($sql)) {
|
||||||
|
$stmtid = $sql[1];
|
||||||
|
if (!odbtp_execute($stmtid)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$stmtid = @odbtp_query($sql,$this->_connectionID);
|
||||||
|
}
|
||||||
|
$this->_lastAffectedRows = 0;
|
||||||
|
if ($stmtid) {
|
||||||
|
$this->_lastAffectedRows = @odbtp_affected_rows($stmtid);
|
||||||
|
}
|
||||||
|
return $stmtid;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _close()
|
||||||
|
{
|
||||||
|
$ret = @odbtp_close($this->_connectionID);
|
||||||
|
$this->_connectionID = false;
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ADORecordSet_odbtp extends ADORecordSet {
|
||||||
|
|
||||||
|
var $databaseType = 'odbtp';
|
||||||
|
var $canSeek = true;
|
||||||
|
|
||||||
|
function ADORecordSet_odbtp($queryID,$mode=false)
|
||||||
|
{
|
||||||
|
if ($mode === false) {
|
||||||
|
global $ADODB_FETCH_MODE;
|
||||||
|
$mode = $ADODB_FETCH_MODE;
|
||||||
|
}
|
||||||
|
$this->fetchMode = $mode;
|
||||||
|
$this->ADORecordSet($queryID);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _initrs()
|
||||||
|
{
|
||||||
|
$this->_numOfFields = @odbtp_num_fields($this->_queryID);
|
||||||
|
if (!($this->_numOfRows = @odbtp_num_rows($this->_queryID)))
|
||||||
|
$this->_numOfRows = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &FetchField($fieldOffset = 0)
|
||||||
|
{
|
||||||
|
$off=$fieldOffset; // offsets begin at 0
|
||||||
|
$o= new ADOFieldObject();
|
||||||
|
$o->name = @odbtp_field_name($this->_queryID,$off);
|
||||||
|
$o->type = @odbtp_field_type($this->_queryID,$off);
|
||||||
|
$o->max_length = @odbtp_field_length($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;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _seek($row)
|
||||||
|
{
|
||||||
|
return @odbtp_data_seek($this->_queryID, $row);
|
||||||
|
}
|
||||||
|
|
||||||
|
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++) {
|
||||||
|
$name = @odbtp_field_name( $this->_queryID, $i );
|
||||||
|
$this->bind[strtoupper($name)] = $i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->fields[$this->bind[strtoupper($colname)]];
|
||||||
|
}
|
||||||
|
|
||||||
|
function _fetch_odbtp($type=0)
|
||||||
|
{
|
||||||
|
switch ($this->fetchMode) {
|
||||||
|
case ADODB_FETCH_NUM:
|
||||||
|
$this->fields = @odbtp_fetch_row($this->_queryID, $type);
|
||||||
|
break;
|
||||||
|
case ADODB_FETCH_ASSOC:
|
||||||
|
$this->fields = @odbtp_fetch_assoc($this->_queryID, $type);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->fields = @odbtp_fetch_array($this->_queryID, $type);
|
||||||
|
}
|
||||||
|
return is_array($this->fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _fetch()
|
||||||
|
{
|
||||||
|
return $this->_fetch_odbtp();
|
||||||
|
}
|
||||||
|
|
||||||
|
function MoveFirst()
|
||||||
|
{
|
||||||
|
if (!$this->_fetch_odbtp(ODB_FETCH_FIRST)) return false;
|
||||||
|
$this->EOF = false;
|
||||||
|
$this->_currentRow = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function MoveLast()
|
||||||
|
{
|
||||||
|
if (!$this->_fetch_odbtp(ODB_FETCH_LAST)) return false;
|
||||||
|
$this->EOF = false;
|
||||||
|
$this->_currentRow = $this->_numOfRows - 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function NextRecordSet()
|
||||||
|
{
|
||||||
|
if (!@odbtp_next_result($this->_queryID)) return false;
|
||||||
|
$this->_inited = false;
|
||||||
|
$this->bind = false;
|
||||||
|
$this->_currentRow = -1;
|
||||||
|
$this->Init();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _close()
|
||||||
|
{
|
||||||
|
return @odbtp_free_query($this->_queryID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
60
phpgwapi/inc/adodb/drivers/adodb-odbtp_unicode.inc.php
Normal file
60
phpgwapi/inc/adodb/drivers/adodb-odbtp_unicode.inc.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
V4.22 15 Apr 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. See License.txt.
|
||||||
|
Set tabs to 4 for best viewing.
|
||||||
|
Latest version is available at http://php.weblogs.com/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code contributed by "Robert Twitty" <rtwitty#neutron.ushmm.org>
|
||||||
|
|
||||||
|
/*
|
||||||
|
Because the ODBTP server sends and reads UNICODE text data using UTF-8
|
||||||
|
encoding, the following HTML meta tag must be included within the HTML
|
||||||
|
head section of every HTML form and script page:
|
||||||
|
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
|
||||||
|
Also, all SQL query strings must be submitted as UTF-8 encoded text.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('_ADODB_ODBTP_LAYER')) {
|
||||||
|
include(ADODB_DIR."/drivers/adodb-odbtp.inc.php");
|
||||||
|
}
|
||||||
|
|
||||||
|
class ADODB_odbtp_unicode extends ADODB_odbtp {
|
||||||
|
var $databaseType = "odbtp_unicode";
|
||||||
|
var $_useUnicodeSQL = true;
|
||||||
|
|
||||||
|
function ADODB_odbtp_unicode()
|
||||||
|
{
|
||||||
|
$this->ADODB_odbtp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ADORecordSet_odbtp_unicode extends ADORecordSet_odbtp {
|
||||||
|
var $databaseType = 'odbtp_unicode';
|
||||||
|
|
||||||
|
function ADORecordSet_odbtp_unicode($queryID,$mode=false)
|
||||||
|
{
|
||||||
|
$this->ADORecordSet_odbtp($queryID, $mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _initrs()
|
||||||
|
{
|
||||||
|
$this->_numOfFields = @odbtp_num_fields($this->_queryID);
|
||||||
|
if (!($this->_numOfRows = @odbtp_num_rows($this->_queryID)))
|
||||||
|
$this->_numOfRows = -1;
|
||||||
|
|
||||||
|
if ($this->connection->odbc_driver == ODB_DRIVER_JET) {
|
||||||
|
for ($f = 0; $f < $this->_numOfFields; $f++) {
|
||||||
|
if (odbtp_field_bindtype($this->_queryID, $f) == ODB_CHAR)
|
||||||
|
odbtp_bind_field($this->_queryID, $f, ODB_WCHAR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
@ -39,7 +39,6 @@ class ADODB_oracle extends ADOConnection {
|
|||||||
// format and return date string in database timestamp format
|
// format and return date string in database timestamp format
|
||||||
function DBTimeStamp($ts)
|
function DBTimeStamp($ts)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (is_string($ts)) $d = ADORecordSet::UnixTimeStamp($ts);
|
if (is_string($ts)) $d = ADORecordSet::UnixTimeStamp($ts);
|
||||||
return 'TO_DATE('.adodb_date($this->fmtTimeStamp,$ts).",'RRRR-MM-DD, HH:MI:SS AM')";
|
return 'TO_DATE('.adodb_date($this->fmtTimeStamp,$ts).",'RRRR-MM-DD, HH:MI:SS AM')";
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
@ -791,14 +791,15 @@ class ADORecordSet_postgres64 extends ADORecordSet{
|
|||||||
function _initrs()
|
function _initrs()
|
||||||
{
|
{
|
||||||
global $ADODB_COUNTRECS;
|
global $ADODB_COUNTRECS;
|
||||||
$this->_numOfRows = ($ADODB_COUNTRECS)? @pg_numrows($this->_queryID):-1;
|
$qid = $this->_queryID;
|
||||||
$this->_numOfFields = @pg_numfields($this->_queryID);
|
$this->_numOfRows = ($ADODB_COUNTRECS)? @pg_numrows($qid):-1;
|
||||||
|
$this->_numOfFields = @pg_numfields($qid);
|
||||||
|
|
||||||
// cache types for blob decode check
|
// cache types for blob decode check
|
||||||
for ($i=0, $max = $this->_numOfFields; $i < $max; $i++) {
|
for ($i=0, $max = $this->_numOfFields; $i < $max; $i++) {
|
||||||
$f1 = $this->FetchField($i);
|
if (pg_fieldtype($qid,$i) == 'bytea') {
|
||||||
//print_r($f1);
|
$this->_blobArr[$i] = pg_fieldname($qid,$off);
|
||||||
if ($f1->type == 'bytea') $this->_blobArr[$i] = $f1->name;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,8 +826,6 @@ class ADORecordSet_postgres64 extends ADORecordSet{
|
|||||||
$o->name = @pg_fieldname($this->_queryID,$off);
|
$o->name = @pg_fieldname($this->_queryID,$off);
|
||||||
$o->type = @pg_fieldtype($this->_queryID,$off);
|
$o->type = @pg_fieldtype($this->_queryID,$off);
|
||||||
$o->max_length = @pg_fieldsize($this->_queryID,$off);
|
$o->max_length = @pg_fieldsize($this->_queryID,$off);
|
||||||
//print_r($o);
|
|
||||||
//print "off=$off name=$o->name type=$o->type len=$o->max_length<br>";
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights
|
version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights
|
||||||
reserved.
|
reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim. All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim. All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
@ -37,6 +37,12 @@ class ADODB_vfp extends ADODB_odbc {
|
|||||||
$this->ADODB_odbc();
|
$this->ADODB_odbc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Time()
|
||||||
|
{
|
||||||
|
return time();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function BeginTrans() { return false;}
|
function BeginTrans() { return false;}
|
||||||
|
|
||||||
// quote string to be sent back to database
|
// quote string to be sent back to database
|
||||||
@ -50,11 +56,12 @@ class ADODB_vfp extends ADODB_odbc {
|
|||||||
// TOP requires ORDER BY for VFP
|
// TOP requires ORDER BY for VFP
|
||||||
function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
|
function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
|
||||||
{
|
{
|
||||||
if (!preg_match('/ORDER[ \t\r\n]+BY/is',$sql)) $sql .= ' ORDER BY 1';
|
$this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is',$sql) ? 'top' : false;
|
||||||
return ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
|
return ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
38
phpgwapi/inc/adodb/lang/adodb-bg.inc.php
Normal file
38
phpgwapi/inc/adodb/lang/adodb-bg.inc.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Bulgarian language, v1.0, 25.03.2004, encoding by Windows-1251 charset
|
||||||
|
contributed by Valentin Sheiretsky <valio#valio.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$ADODB_LANG_ARRAY = array (
|
||||||
|
'LANG' => 'bg',
|
||||||
|
DB_ERROR => 'неизвестна грешка',
|
||||||
|
DB_ERROR_ALREADY_EXISTS => 'вече съществува',
|
||||||
|
DB_ERROR_CANNOT_CREATE => 'не може да бъде създадена',
|
||||||
|
DB_ERROR_CANNOT_DELETE => 'не може да бъде изтрита',
|
||||||
|
DB_ERROR_CANNOT_DROP => 'не може да бъде унищожена',
|
||||||
|
DB_ERROR_CONSTRAINT => 'нарушено условие',
|
||||||
|
DB_ERROR_DIVZERO => 'деление на нула',
|
||||||
|
DB_ERROR_INVALID => 'неправилно',
|
||||||
|
DB_ERROR_INVALID_DATE => 'некоректна дата или час',
|
||||||
|
DB_ERROR_INVALID_NUMBER => 'невалиден номер',
|
||||||
|
DB_ERROR_MISMATCH => 'погрешна употреба',
|
||||||
|
DB_ERROR_NODBSELECTED => 'не е избрана база данни',
|
||||||
|
DB_ERROR_NOSUCHFIELD => 'несъществуващо поле',
|
||||||
|
DB_ERROR_NOSUCHTABLE => 'несъществуваща таблица',
|
||||||
|
DB_ERROR_NOT_CAPABLE => 'DB backend not capable',
|
||||||
|
DB_ERROR_NOT_FOUND => 'не е намерена',
|
||||||
|
DB_ERROR_NOT_LOCKED => 'не е заключена',
|
||||||
|
DB_ERROR_SYNTAX => 'грешен синтаксис',
|
||||||
|
DB_ERROR_UNSUPPORTED => 'не се поддържа',
|
||||||
|
DB_ERROR_VALUE_COUNT_ON_ROW => 'некоректен брой колони в реда',
|
||||||
|
DB_ERROR_INVALID_DSN => 'невалиден DSN',
|
||||||
|
DB_ERROR_CONNECT_FAILED => 'връзката не може да бъде осъществена',
|
||||||
|
0 => 'няма грешки', // DB_OK
|
||||||
|
DB_ERROR_NEED_MORE_DATA => 'предоставените данни са недостатъчни',
|
||||||
|
DB_ERROR_EXTENSION_NOT_FOUND=> 'разширението не е намерено',
|
||||||
|
DB_ERROR_NOSUCHDB => 'несъществуваща база данни',
|
||||||
|
DB_ERROR_ACCESS_VIOLATION => 'нямате достатъчно права'
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
|
38
phpgwapi/inc/adodb/lang/adodb-bgutf8.inc.php
Normal file
38
phpgwapi/inc/adodb/lang/adodb-bgutf8.inc.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Bulgarian language, v1.0, 25.03.2004, encoding by UTF-8 charset
|
||||||
|
contributed by Valentin Sheiretsky <valio#valio.eu.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$ADODB_LANG_ARRAY = array (
|
||||||
|
'LANG' => 'bgutf8',
|
||||||
|
DB_ERROR => 'неизвестна грешка',
|
||||||
|
DB_ERROR_ALREADY_EXISTS => 'вече съществува',
|
||||||
|
DB_ERROR_CANNOT_CREATE => 'не може да бъде създадена',
|
||||||
|
DB_ERROR_CANNOT_DELETE => 'не може да бъде изтрита',
|
||||||
|
DB_ERROR_CANNOT_DROP => 'не може да бъде унищожена',
|
||||||
|
DB_ERROR_CONSTRAINT => 'нарушено условие',
|
||||||
|
DB_ERROR_DIVZERO => 'деление на нула',
|
||||||
|
DB_ERROR_INVALID => 'неправилно',
|
||||||
|
DB_ERROR_INVALID_DATE => 'некоректна дата или час',
|
||||||
|
DB_ERROR_INVALID_NUMBER => 'невалиден номер',
|
||||||
|
DB_ERROR_MISMATCH => 'погрешна употреба',
|
||||||
|
DB_ERROR_NODBSELECTED => 'не е избрана база данни',
|
||||||
|
DB_ERROR_NOSUCHFIELD => 'несъществуващо поле',
|
||||||
|
DB_ERROR_NOSUCHTABLE => 'несъществуваща таблица',
|
||||||
|
DB_ERROR_NOT_CAPABLE => 'DB backend not capable',
|
||||||
|
DB_ERROR_NOT_FOUND => 'не е намерена',
|
||||||
|
DB_ERROR_NOT_LOCKED => 'не е заключена',
|
||||||
|
DB_ERROR_SYNTAX => 'грешен синтаксис',
|
||||||
|
DB_ERROR_UNSUPPORTED => 'не се поддържа',
|
||||||
|
DB_ERROR_VALUE_COUNT_ON_ROW => 'некоректен брой колони в реда',
|
||||||
|
DB_ERROR_INVALID_DSN => 'невалиден DSN',
|
||||||
|
DB_ERROR_CONNECT_FAILED => 'връзката не може да бъде осъществена',
|
||||||
|
0 => 'няма грешки', // DB_OK
|
||||||
|
DB_ERROR_NEED_MORE_DATA => 'предоставените данни са недостатъчни',
|
||||||
|
DB_ERROR_EXTENSION_NOT_FOUND=> 'разширението не е намерено',
|
||||||
|
DB_ERROR_NOSUCHDB => 'несъществуваща база данни',
|
||||||
|
DB_ERROR_ACCESS_VIOLATION => 'нямате достатъчно права'
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
|
33
phpgwapi/inc/adodb/lang/adodb-nl.inc.php
Normal file
33
phpgwapi/inc/adodb/lang/adodb-nl.inc.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
// Translated by Pim Koeman (pim#wittenborg-university.com)
|
||||||
|
$ADODB_LANG_ARRAY = array (
|
||||||
|
'LANG' => 'nl',
|
||||||
|
DB_ERROR => 'onbekende fout',
|
||||||
|
DB_ERROR_ALREADY_EXISTS => 'bestaat al',
|
||||||
|
DB_ERROR_CANNOT_CREATE => 'kan niet aanmaken',
|
||||||
|
DB_ERROR_CANNOT_DELETE => 'kan niet wissen',
|
||||||
|
DB_ERROR_CANNOT_DROP => 'kan niet verwijderen',
|
||||||
|
DB_ERROR_CONSTRAINT => 'constraint overtreding',
|
||||||
|
DB_ERROR_DIVZERO => 'poging tot delen door nul',
|
||||||
|
DB_ERROR_INVALID => 'ongeldig',
|
||||||
|
DB_ERROR_INVALID_DATE => 'ongeldige datum of tijd',
|
||||||
|
DB_ERROR_INVALID_NUMBER => 'ongeldig nummer',
|
||||||
|
DB_ERROR_MISMATCH => 'is incorrect',
|
||||||
|
DB_ERROR_NODBSELECTED => 'geen database geselecteerd',
|
||||||
|
DB_ERROR_NOSUCHFIELD => 'onbekend veld',
|
||||||
|
DB_ERROR_NOSUCHTABLE => 'onbekende tabel',
|
||||||
|
DB_ERROR_NOT_CAPABLE => 'database systeem is niet tot uitvoer in staat',
|
||||||
|
DB_ERROR_NOT_FOUND => 'niet gevonden',
|
||||||
|
DB_ERROR_NOT_LOCKED => 'niet vergrendeld',
|
||||||
|
DB_ERROR_SYNTAX => 'syntaxis fout',
|
||||||
|
DB_ERROR_UNSUPPORTED => 'niet ondersteund',
|
||||||
|
DB_ERROR_VALUE_COUNT_ON_ROW => 'waarde telling op rij',
|
||||||
|
DB_ERROR_INVALID_DSN => 'ongeldige DSN',
|
||||||
|
DB_ERROR_CONNECT_FAILED => 'connectie mislukt',
|
||||||
|
0 => 'geen fout', // DB_OK
|
||||||
|
DB_ERROR_NEED_MORE_DATA => 'onvoldoende data gegeven',
|
||||||
|
DB_ERROR_EXTENSION_NOT_FOUND=> 'extensie niet gevonden',
|
||||||
|
DB_ERROR_NOSUCHDB => 'onbekende database',
|
||||||
|
DB_ERROR_ACCESS_VIOLATION => 'onvoldoende rechten'
|
||||||
|
);
|
||||||
|
?>
|
36
phpgwapi/inc/adodb/lang/adodb-ro.inc.php
Normal file
36
phpgwapi/inc/adodb/lang/adodb-ro.inc.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* Romanian - by "bogdan stefan" <sbogdan#rsb.ro> */
|
||||||
|
|
||||||
|
$ADODB_LANG_ARRAY = array (
|
||||||
|
'LANG' => 'ro',
|
||||||
|
DB_ERROR => 'eroare necunoscuta',
|
||||||
|
DB_ERROR_ALREADY_EXISTS => 'deja exista',
|
||||||
|
DB_ERROR_CANNOT_CREATE => 'nu se poate creea',
|
||||||
|
DB_ERROR_CANNOT_DELETE => 'nu se poate sterge',
|
||||||
|
DB_ERROR_CANNOT_DROP => 'nu se poate executa drop',
|
||||||
|
DB_ERROR_CONSTRAINT => 'violare de constrain',
|
||||||
|
DB_ERROR_DIVZERO => 'se divide la zero',
|
||||||
|
DB_ERROR_INVALID => 'invalid',
|
||||||
|
DB_ERROR_INVALID_DATE => 'data sau timp invalide',
|
||||||
|
DB_ERROR_INVALID_NUMBER => 'numar invalid',
|
||||||
|
DB_ERROR_MISMATCH => 'nepotrivire-mismatch',
|
||||||
|
DB_ERROR_NODBSELECTED => 'nu exista baza de date selectata',
|
||||||
|
DB_ERROR_NOSUCHFIELD => 'camp inexistent',
|
||||||
|
DB_ERROR_NOSUCHTABLE => 'tabela inexistenta',
|
||||||
|
DB_ERROR_NOT_CAPABLE => 'functie optionala neinstalata',
|
||||||
|
DB_ERROR_NOT_FOUND => 'negasit',
|
||||||
|
DB_ERROR_NOT_LOCKED => 'neblocat',
|
||||||
|
DB_ERROR_SYNTAX => 'eroare de sintaxa',
|
||||||
|
DB_ERROR_UNSUPPORTED => 'nu e suportat',
|
||||||
|
DB_ERROR_VALUE_COUNT_ON_ROW => 'valoare prea mare pentru coloana',
|
||||||
|
DB_ERROR_INVALID_DSN => 'DSN invalid',
|
||||||
|
DB_ERROR_CONNECT_FAILED => 'conectare esuata',
|
||||||
|
0 => 'fara eroare', // DB_OK
|
||||||
|
DB_ERROR_NEED_MORE_DATA => 'data introduse insuficiente',
|
||||||
|
DB_ERROR_EXTENSION_NOT_FOUND=> 'extensie negasita',
|
||||||
|
DB_ERROR_NOSUCHDB => 'nu exista baza de date',
|
||||||
|
DB_ERROR_ACCESS_VIOLATION => 'permisiuni insuficiente'
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence. See License.txt.
|
the BSD license will take precedence. See License.txt.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
* Whenever there is any discrepancy between the two licenses,
|
* Whenever there is any discrepancy between the two licenses,
|
||||||
* the BSD license will take precedence.
|
* the BSD license will take precedence.
|
||||||
|
@ -22,8 +22,9 @@ We hope more people will contribute drivers to support other databases.
|
|||||||
|
|
||||||
>> Documentation and Examples
|
>> Documentation and Examples
|
||||||
|
|
||||||
Refer to readme.htm for full documentation and examples. There is also a
|
Refer to the adodb/docs directory for full documentation and examples.
|
||||||
tutorial tute.htm that contrasts ADODB code with mysql code.
|
There is also a tutorial tute.htm that contrasts ADODB code with
|
||||||
|
mysql code.
|
||||||
|
|
||||||
|
|
||||||
>>> Files
|
>>> Files
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
* Whenever there is any discrepancy between the two licenses,
|
* Whenever there is any discrepancy between the two licenses,
|
||||||
* the BSD license will take precedence.
|
* the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -581,6 +581,7 @@ class ADODB_Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$clob) { // no lobs, simply use replace()
|
if (!$clob) { // no lobs, simply use replace()
|
||||||
|
$arr[$data] = $conn->qstr($val);
|
||||||
$rs = $conn->Replace($table, $arr, 'sesskey', $autoQuote = true);
|
$rs = $conn->Replace($table, $arr, 'sesskey', $autoQuote = true);
|
||||||
ADODB_Session::_dumprs($rs);
|
ADODB_Session::_dumprs($rs);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<body bgcolor=white>
|
<body bgcolor=white>
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* V4.20 22 Feb 2004 (c) 2001-2002 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* V4.22 15 Apr 2004 (c) 2001-2002 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
|
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
|
|
||||||
// V4.20 22 Feb 2004
|
// V4.22 15 Apr 2004
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
@ -10,6 +10,7 @@ V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights rese
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
$ADODB_FLUSH = true;
|
$ADODB_FLUSH = true;
|
||||||
|
|
||||||
define('ADODB_ASSOC_CASE',0);
|
define('ADODB_ASSOC_CASE',0);
|
||||||
@ -29,13 +30,13 @@ function CheckWS($conn)
|
|||||||
global $ADODB_EXTENSION;
|
global $ADODB_EXTENSION;
|
||||||
|
|
||||||
include_once('../session/adodb-session.php');
|
include_once('../session/adodb-session.php');
|
||||||
|
if (defined('CHECKWSFAIL')){ echo " TESTING $conn ";flush();}
|
||||||
$saved = $ADODB_EXTENSION;
|
$saved = $ADODB_EXTENSION;
|
||||||
$db = ADONewConnection($conn);
|
$db = ADONewConnection($conn);
|
||||||
$ADODB_EXTENSION = $saved;
|
$ADODB_EXTENSION = $saved;
|
||||||
if (headers_sent()) {
|
if (headers_sent()) {
|
||||||
print "<p><b>White space detected in adodb-$conn.inc.php or include file...</b></p>";
|
print "<p><b>White space detected in adodb-$conn.inc.php or include file...</b></p>";
|
||||||
die();
|
//die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +104,6 @@ FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_to
|
|||||||
}
|
}
|
||||||
$ADODB_CACHE_DIR = dirname(TempNam('/tmp','testadodb'));
|
$ADODB_CACHE_DIR = dirname(TempNam('/tmp','testadodb'));
|
||||||
$db->debug = false;
|
$db->debug = false;
|
||||||
|
|
||||||
//print $db->UnixTimeStamp('2003-7-22 23:00:00');
|
//print $db->UnixTimeStamp('2003-7-22 23:00:00');
|
||||||
|
|
||||||
$phpv = phpversion();
|
$phpv = phpversion();
|
||||||
@ -116,6 +116,14 @@ FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_to
|
|||||||
echo "<br>";
|
echo "<br>";
|
||||||
$e = error_reporting(E_ALL-E_WARNING);
|
$e = error_reporting(E_ALL-E_WARNING);
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
|
$tt = $db->Time();
|
||||||
|
if ($tt == 0) echo '<br><b>$db->Time failed</b>';
|
||||||
|
else echo "<br>db->Time: ".date('d-m-Y H:i:s',$tt);
|
||||||
|
echo '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print "<i>date1</i> (1969-02-20) = ".$db->DBDate('1969-2-20');
|
print "<i>date1</i> (1969-02-20) = ".$db->DBDate('1969-2-20');
|
||||||
print "<br><i>date1</i> (1999-02-20) = ".$db->DBDate('1999-2-20');
|
print "<br><i>date1</i> (1999-02-20) = ".$db->DBDate('1999-2-20');
|
||||||
print "<br><i>date1.1</i> 1999 = ".$db->DBDate("'1999'");
|
print "<br><i>date1.1</i> 1999 = ".$db->DBDate("'1999'");
|
||||||
@ -436,7 +444,6 @@ END adodb;
|
|||||||
print "<b>Error in using Cursor Variables 1</b><p>";
|
print "<b>Error in using Cursor Variables 1</b><p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print "<h4>Testing Stored Procedures for oci8</h4>";
|
print "<h4>Testing Stored Procedures for oci8</h4>";
|
||||||
|
|
||||||
$stmt = $db->PrepareSP("BEGIN adodb.data_out(:a1, :a2); END;");
|
$stmt = $db->PrepareSP("BEGIN adodb.data_out(:a1, :a2); END;");
|
||||||
@ -1296,6 +1303,11 @@ END adodb;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$saved = $db->debug;
|
||||||
|
$db->debug=1;
|
||||||
|
$cnt = _adodb_getcount($db, 'select * from ADOXYZ where firstname in (select firstname from ADOXYZ)');
|
||||||
|
echo "<b>Count=</b> $cnt";
|
||||||
|
$db->debug=$saved;
|
||||||
|
|
||||||
global $TESTERRS;
|
global $TESTERRS;
|
||||||
$debugerr = true;
|
$debugerr = true;
|
||||||
@ -1399,7 +1411,7 @@ if (isset($_SERVER['argv'][1])) {
|
|||||||
$HTTP_GET_VARS[$_SERVER['argv'][1]] = 1;
|
$HTTP_GET_VARS[$_SERVER['argv'][1]] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (@$HTTP_SERVER_VARS['COMPUTERNAME'] == 'TIGRESS') {
|
if ( @$HTTP_SERVER_VARS['COMPUTERNAME'] == 'TIGRESS') {
|
||||||
CheckWS('mysqlt');
|
CheckWS('mysqlt');
|
||||||
CheckWS('postgres');
|
CheckWS('postgres');
|
||||||
CheckWS('oci8po');
|
CheckWS('oci8po');
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
* @version V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
* Released under both BSD license and Lesser GPL library license.
|
* Released under both BSD license and Lesser GPL library license.
|
||||||
* Whenever there is any discrepancy between the two licenses,
|
* Whenever there is any discrepancy between the two licenses,
|
||||||
* the BSD license will take precedence.
|
* the BSD license will take precedence.
|
||||||
@ -31,10 +31,13 @@ FROM ADOXYZ WHERE id = -1";
|
|||||||
// Select an empty record from the database
|
// Select an empty record from the database
|
||||||
|
|
||||||
$conn = &ADONewConnection("mysql"); // create a connection
|
$conn = &ADONewConnection("mysql"); // create a connection
|
||||||
|
$conn->PConnect("localhost", "root", "", "test"); // connect to MySQL, testdb
|
||||||
|
|
||||||
|
//$conn =& ADONewConnection('oci8');
|
||||||
|
//$conn->Connect('','scott','natsoft');
|
||||||
//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||||
|
|
||||||
$conn->debug=1;
|
$conn->debug=1;
|
||||||
$conn->PConnect("localhost", "root", "", "test"); // connect to MySQL, testdb
|
|
||||||
$conn->Execute("delete from adoxyz where lastname like 'Smith%'");
|
$conn->Execute("delete from adoxyz where lastname like 'Smith%'");
|
||||||
|
|
||||||
$rs = $conn->Execute($sql); // Execute the query and get the empty recordset
|
$rs = $conn->Execute($sql); // Execute the query and get the empty recordset
|
||||||
@ -53,6 +56,8 @@ $insertSQL = $conn->GetInsertSQL($rs, $record);
|
|||||||
|
|
||||||
$conn->Execute($insertSQL); // Insert the record into the database
|
$conn->Execute($insertSQL); // Insert the record into the database
|
||||||
|
|
||||||
|
$insertSQL2 = $conn->GetInsertSQL($table='ADOXYZ', $record);
|
||||||
|
if ($insertSQL != $insertSQL2) echo "<p><b>Walt's new stuff failed</b>: $insertSQL2</p>";
|
||||||
//==========================
|
//==========================
|
||||||
// This code tests an update
|
// This code tests an update
|
||||||
|
|
||||||
@ -62,7 +67,7 @@ FROM ADOXYZ WHERE lastname=".$conn->qstr($record['lastname']);
|
|||||||
// Select a record to update
|
// Select a record to update
|
||||||
|
|
||||||
$rs = $conn->Execute($sql); // Execute the query and get the existing record to update
|
$rs = $conn->Execute($sql); // Execute the query and get the existing record to update
|
||||||
if (!$rs) print "<p>No record found!</p>";
|
if (!$rs) print "<p><b>No record found!</b></p>";
|
||||||
|
|
||||||
$record = array(); // Initialize an array to hold the record data to update
|
$record = array(); // Initialize an array to hold the record data to update
|
||||||
|
|
||||||
@ -78,7 +83,7 @@ $record['num'] = 3921;
|
|||||||
$updateSQL = $conn->GetUpdateSQL($rs, $record);
|
$updateSQL = $conn->GetUpdateSQL($rs, $record);
|
||||||
|
|
||||||
$conn->Execute($updateSQL); // Update the record in the database
|
$conn->Execute($updateSQL); // Update the record in the database
|
||||||
print "<p>Rows Affected=".$conn->Affected_Rows()."</p>";
|
if ($conn->Affected_Rows() != 1)print "<p><b>Error</b>: Rows Affected=".$conn->Affected_Rows().", should be 1</p>";
|
||||||
|
|
||||||
$rs = $conn->Execute("select * from adoxyz where lastname like 'Smith%'");
|
$rs = $conn->Execute("select * from adoxyz where lastname like 'Smith%'");
|
||||||
adodb_pr($rs);
|
adodb_pr($rs);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
V4.22 15 Apr 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
|
||||||
Released under both BSD license and Lesser GPL library license.
|
Released under both BSD license and Lesser GPL library license.
|
||||||
Whenever there is any discrepancy between the two licenses,
|
Whenever there is any discrepancy between the two licenses,
|
||||||
the BSD license will take precedence.
|
the BSD license will take precedence.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user