/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
<?php
/**
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
return $sql;
}
+
+
function _GenFields($flds,$widespacing=false)
{
return $newopts;
}
+
+ function _getSizePrec($size)
+ {
+ $fsize = false;
+ $fprec = false;
+ $dotat = strpos($size,'.');
+ if ($dotat === false) $dotat = strpos($size,',');
+ if ($dotat === false) $fsize = $size;
+ else {
+ $fsize = substr($size,0,$dotat);
+ $fprec = substr($size,$dotat+1);
+ }
+ return array($fsize, $fprec);
+ }
+
/**
"Florian Buzin [ easywe ]" <florian.buzin#easywe.de>
$c = $cols[$k];
$ml = $c->max_length;
$mt = $this->MetaType($c->type,$ml);
+
+ if (isset($c->scale)) $sc = $c->scale;
+ else $sc = 99; // always force change if scale not known.
+
+ if ($sc == -1) $sc = false;
+ list($fsize, $fprec) = $this->_getSizePrec($v['SIZE']);
+
if ($ml == -1) $ml = '';
if ($mt == 'X') $ml = $v['SIZE'];
- if (($mt != $v['TYPE']) || $ml != $v['SIZE'] || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) {
+ if (($mt != $v['TYPE']) || ($ml != $fsize || $sc != $fprec) || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) {
$holdflds[$k] = $v;
}
} else {
<?php
/**
- * @version V5.06 16 Oct 2008 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ * @version V5.06 16 Oct 2008 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
'/ttribute [\"\'].*[\"\'] not found|Relation [\"\'].*[\"\'] does not have attribute [\"\'].*[\"\']/i' => DB_ERROR_NOSUCHFIELD,
'/parser: parse error at or near \"/i' => DB_ERROR_SYNTAX,
'/referential integrity violation/i' => DB_ERROR_CONSTRAINT,
- '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/i'
+ '/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key.*violates unique constraint/i'
=> DB_ERROR_ALREADY_EXISTS
);
reset($error_regexps);
<?php
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
$ADODB_INCLUDED_LIB = 1;
/*
- @version V5.06 16 Oct 2008 (c) 2000-2009 John Lim (jlim\@natsoft.com.my). All rights reserved.
+ @version V5.06 16 Oct 2008 (c) 2000-2010 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.
if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0];
- $rstest = $zthis->Execute($rewritesql,$inputarr);
- if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr);
-
+ if ($secs2cache) {
+ $rstest = $zthis->CacheExecute($secs2cache,$rewritesql,$inputarr);
+ if (!$rstest) $rstest = $zthis->CacheExecute($secs2cache,$sql,$inputarr);
+ } else {
+ $rstest = $zthis->Execute($rewritesql,$inputarr);
+ if (!$rstest) $rstest = $zthis->Execute($sql,$inputarr);
+ }
if ($rstest) {
$qryRecs = $rstest->RecordCount();
if ($qryRecs == -1) {
*/
for ($i=0; $i < $max; $i++) {
switch($fmt[$i]) {
+ case 'e':
+ $dates .= date('e');
+ break;
case 'T':
if ($ADODB_DATETIME_CLASS) {
$dt = new DateTime();
/**
\mainpage
- @version V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ @version V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights reserved.
Released under both BSD license and Lesser GPL library license. You can choose which license
you prefer.
/**
* ADODB version as a string.
*/
- $ADODB_vers = 'V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved. Released BSD & LGPL.';
+ $ADODB_vers = 'V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights reserved. Released BSD & LGPL.';
/**
* Determines whether recordset->RecordCount() is used.
var $fetchMode=false;
var $null2null = 'null'; // in autoexecute/getinsertsql/getupdatesql, this value will be converted to a null
+ var $bulkBind = false; // enable 2D Execute array
//
// PRIVATE VARS
//
{
global $ADODB_vers;
- return (float) substr($ADODB_vers,1);
+ $ok = preg_match( '/^[Vv]([0-9\.]+)/', $ADODB_vers, $matches );
+ if (!$ok) return (float) substr($ADODB_vers,1);
+ else return $matches[1];
}
/**
{
if ($argHostname != "") $this->host = $argHostname;
if ($argUsername != "") $this->user = $argUsername;
- if ($argPassword != "") $this->password = $argPassword; // not stored for security reasons
+ if ($argPassword != "") $this->password = 'not stored'; // not stored for security reasons
if ($argDatabaseName != "") $this->database = $argDatabaseName;
$this->_isPersistentConnection = false;
if ($forceNew) {
- if ($rez=$this->_nconnect($this->host, $this->user, $this->password, $this->database)) return true;
+ if ($rez=$this->_nconnect($this->host, $this->user, $argPassword, $this->database)) return true;
} else {
- if ($rez=$this->_connect($this->host, $this->user, $this->password, $this->database)) return true;
+ if ($rez=$this->_connect($this->host, $this->user, $argPassword, $this->database)) return true;
}
if (isset($rez)) {
$err = $this->ErrorMsg();
if ($argHostname != "") $this->host = $argHostname;
if ($argUsername != "") $this->user = $argUsername;
- if ($argPassword != "") $this->password = $argPassword;
+ if ($argPassword != "") $this->password = 'not stored';
if ($argDatabaseName != "") $this->database = $argDatabaseName;
$this->_isPersistentConnection = true;
- if ($rez = $this->_pconnect($this->host, $this->user, $this->password, $this->database)) return true;
+ if ($rez = $this->_pconnect($this->host, $this->user, $argPassword, $this->database)) return true;
if (isset($rez)) {
$err = $this->ErrorMsg();
if (empty($err)) $err = "Connection error to server '$argHostname' with user '$argUsername'";
* @param $table name of table to lock
* @param $where where clause to use, eg: "WHERE row=12". If left empty, will escalate to table lock
*/
- function RowLock($table,$where,$col='1 as ignore')
+ function RowLock($table,$where,$col='1 as adodbignore')
{
return false;
}
$element0 = reset($inputarr);
# is_object check because oci8 descriptors can be passed in
- $array_2d = is_array($element0) && !is_object(reset($element0));
+ $array_2d = $this->bulkBind && is_array($element0) && !is_object(reset($element0));
//remove extra memory copy of input -mikefedyk
unset($element0);
// special handling of oracle, which might not have host
$fakedsn = str_replace('@/','@adodb-fakehost/',$fakedsn);
}
+
+ if ((strpos($origdsn, 'sqlite')) !== FALSE) {
+ // special handling for SQLite, it only might have the path to the database file.
+ // If you try to connect to a SQLite database using a dsn like 'sqlite:///path/to/database', the 'parse_url' php function
+ // will throw you an exception with a message such as "unable to parse url"
+ list($scheme, $path) = explode('://', $origdsn);
+ $dsna['scheme'] = $scheme;
+ if ($qmark = strpos($path,'?')) {
+ $dsn['query'] = substr($path,$qmark+1);
+ $path = substr($path,0,$qmark);
+ }
+ $dsna['path'] = '/' . urlencode($path);
+ } else
$dsna = @parse_url($fakedsn);
+
if (!$dsna) {
return $false;
}
- $dsna['scheme'] = substr($origdsn,0,$at);
+ $dsna['scheme'] = substr($origdsn,0,$at);
if ($at2 !== FALSE) {
$dsna['host'] = '';
}
}
-?>
\ No newline at end of file
+?>
<?php
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
<?php
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
return @pg_Exec($this->_connectionID, "begin ".$this->_transmode);
}
- function RowLock($tables,$where,$col='1 as ignore')
+ function RowLock($tables,$where,$col='1 as adodbignore')
{
if (!$this->transCnt) $this->BeginTrans();
return $this->GetOne("select $col from $tables where $where for update");
}
- function MetaIndexes ($table, $primary = FALSE)
+ function MetaIndexes ($table, $primary = FALSE, $owner = false)
{
global $ADODB_FETCH_MODE;
}
//if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432";
-
+
if ($ctype === 1) { // persistent
$this->_connectionID = pg_pconnect($str);
} else {
<?php
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
<?php
/*
- V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
<?php
/**
- * @version V4.93 10 Oct 2006 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ * @version V4.93 10 Oct 2006 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.
<?php
/*
- V4.93 10 Oct 2006 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
+ V4.93 10 Oct 2006 (c) 2000-2010 John Lim (jlim#natsoft.com). 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.