function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; if (!function_exists('odbc_connect')) { return null; } if (isset($php_errormsg)) { $php_errormsg = ''; } $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; if ($this->debug && $argDatabasename) { ADOConnection::outp("For odbc PConnect(), {$argDatabasename} is not used. Place dsn in 1st parameter."); } // print "dsn=$argDSN u=$argUsername p=$argPassword<br>"; flush(); if ($this->curmode === false) { $this->_connectionID = odbc_connect($argDSN, $argUsername, $argPassword); } else { $this->_connectionID = odbc_pconnect($argDSN, $argUsername, $argPassword, $this->curmode); } $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : ''; if ($this->_connectionID && $this->autoRollback) { @odbc_rollback($this->_connectionID); } if (isset($this->connectStmt)) { $this->Execute($this->connectStmt); } return $this->_connectionID != false; }
function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; if (!function_exists('db2_connect')) { ADOConnection::outp("Warning: The old ODBC based DB2 driver has been renamed 'odbc_db2'. This ADOdb driver calls PHP's native db2 extension."); return null; } // This needs to be set before the connect(). // Replaces the odbc_binmode() call that was in Execute() ini_set('ibm_db2.binmode', $this->binmode); if ($argDatabasename) { $this->_connectionID = db2_connect($argDatabasename, $argUsername, $argPassword); } else { $this->_connectionID = db2_connect($argDSN, $argUsername, $argPassword); } if (isset($php_errormsg)) { $php_errormsg = ''; } // For db2_connect(), there is an optional 4th arg. If present, it must be // an array of valid options. So far, we don't use them. $this->_errorMsg = @db2_conn_errormsg(); if (isset($this->connectStmt)) { $this->Execute($this->connectStmt); } return $this->_connectionID != false; }
public function DropColumnSQL($tabname, $flds, $tableflds = '', $tableoptions = '') { if ($this->debug) { ADOConnection::outp("DropColumnSQL not supported"); } return array(); }
function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; if (!function_exists('db2_connect')) { ADOConnection::outp("Warning: The old ODBC based DB2 driver has been renamed 'odbc_db2'. This ADOdb driver calls PHP's native db2 extension which is not installed."); return null; } // This needs to be set before the connect(). // Replaces the odbc_binmode() call that was in Execute() ini_set('ibm_db2.binmode', $this->binmode); if ($argDatabasename && empty($argDSN)) { if (stripos($argDatabasename,'UID=') && stripos($argDatabasename,'PWD=')) $this->_connectionID = db2_connect($argDatabasename,null,null); else $this->_connectionID = db2_connect($argDatabasename,$argUsername,$argPassword); } else { if ($argDatabasename) $schema = $argDatabasename; if (stripos($argDSN,'UID=') && stripos($argDSN,'PWD=')) $this->_connectionID = db2_connect($argDSN,null,null); else $this->_connectionID = db2_connect($argDSN,$argUsername,$argPassword); } if (isset($php_errormsg)) $php_errormsg = ''; // For db2_connect(), there is an optional 4th arg. If present, it must be // an array of valid options. So far, we don't use them. $this->_errorMsg = @db2_conn_errormsg(); if (isset($this->connectStmt)) $this->Execute($this->connectStmt); if ($this->_connectionID && isset($schema)) $this->Execute("SET SCHEMA=$schema"); return $this->_connectionID != false; }
function DropColumnSQL($tabname, $flds) { if ($this->debug) { ADOConnection::outp("DropColumnSQL not supported"); } return array(); }
public function PrepareSP($sql) { if (!$this->_has_mssql_init) { ADOConnection::outp( "PrepareSP: mssql_init only available since PHP 4.1.0"); return $sql; } if (is_string($sql)) $sql = str_replace('||','+',$sql); $stmt = mssql_init($sql,$this->_connectionID); if (!$stmt) return $sql; return array($sql,$stmt); }
function _connect($host, $username, $password, $ldapbase) { global $LDAP_CONNECT_OPTIONS; if (!function_exists('ldap_connect')) { return null; } if (strpos($host, 'ldap://') === 0 || strpos($host, 'ldaps://') === 0) { $this->_connectionID = @ldap_connect($host); } else { $conn_info = array($host, $this->port); if (strstr($host, ':')) { $conn_info = explode(':', $host); } $this->_connectionID = @ldap_connect($conn_info[0], $conn_info[1]); } if (!$this->_connectionID) { $e = 'Could not connect to ' . $conn_info[0]; $this->_errorMsg = $e; if ($this->debug) { ADOConnection::outp($e); } return false; } if (count($LDAP_CONNECT_OPTIONS) > 0) { $this->_inject_bind_options($LDAP_CONNECT_OPTIONS); } if ($username) { $bind = @ldap_bind($this->_connectionID, $username, $password); } else { $username = '******'; $bind = @ldap_bind($this->_connectionID); } if (!$bind) { $e = sprintf($this->_bind_errmsg, ldap_error($this->_connectionID)); $this->_errorMsg = $e; if ($this->debug) { ADOConnection::outp($e); } return false; } $this->_errorMsg = ''; $this->database = $ldapbase; return $this->_connectionID; }
public function _connect( $host, $username, $password, $ldapbase) { global $LDAP_CONNECT_OPTIONS; if ( !function_exists( 'ldap_connect' ) ) return null; $conn_info = array( $host,$this->port); if ( strstr( $host, ':' ) ) { $conn_info = split( ':', $host ); } $this->_connectionID = ldap_connect( $conn_info[0], $conn_info[1] ); if (!$this->_connectionID) { $e = 'Could not connect to ' . $conn_info[0]; $this->_errorMsg = $e; if ($this->debug) ADOConnection::outp($e); return false; } if( count( $LDAP_CONNECT_OPTIONS ) > 0 ) { $this->_inject_bind_options( $LDAP_CONNECT_OPTIONS ); } if ($username) { $bind = ldap_bind( $this->_connectionID, $username, $password ); } else { $username = '******'; $bind = ldap_bind( $this->_connectionID ); } if (!$bind) { $e = 'Could not bind to ' . $conn_info[0] . " as ".$username; $this->_errorMsg = $e; if ($this->debug) ADOConnection::outp($e); return false; } $this->_errorMsg = ''; $this->database = $ldapbase; return $this->_connectionID; }
/** * @see adodb_perf#optimizeTable */ function optimizeTable($table, $mode = ADODB_OPT_LOW) { if (!is_string($table)) { return false; } $conn = $this->conn; if (!$conn) { return false; } $sql = ''; switch ($mode) { case ADODB_OPT_LOW: $sql = $this->optimizeTableLow; break; case ADODB_OPT_HIGH: $sql = $this->optimizeTableHigh; break; default: ADOConnection::outp(sprintf("<p>%s: '%s' using of undefined mode '%s'</p>", __CLASS__, 'optimizeTable', $mode)); return false; } $sql = sprintf($sql, $table); return $conn->Execute($sql) !== false; }
function gc($maxlifetime) { $conn =& ADODB_Session::_conn(); $debug = ADODB_Session::debug(); $expire_notify = ADODB_Session::expireNotify(); $optimize = ADODB_Session::optimize(); $sync_seconds = ADODB_Session::syncSeconds(); $table = ADODB_Session::table(); if (!$conn) { return false; } $time = time(); $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : ''; if ($expire_notify) { reset($expire_notify); $fn = next($expire_notify); $savem = $conn->SetFetchMode(ADODB_FETCH_NUM); $sql = "SELECT expireref, sesskey FROM {$table} WHERE expiry < {$time}"; $rs =& $conn->Execute($sql); ADODB_Session::_dumprs($rs); $conn->SetFetchMode($savem); if ($rs) { $conn->StartTrans(); $keys = array(); while (!$rs->EOF) { $ref = $rs->fields[0]; $key = $rs->fields[1]; $fn($ref, $key); $del = $conn->Execute("DELETE FROM {$table} WHERE sesskey=" . $conn->Param('0'), array($key)); $rs->MoveNext(); } $rs->Close(); $conn->CompleteTrans(); } } else { if (1) { $sql = "SELECT sesskey FROM {$table} WHERE expiry < {$time}"; $arr =& $conn->GetAll($sql); foreach ($arr as $row) { $sql2 = "DELETE FROM {$table} WHERE sesskey=" . $conn->Param('0'); $conn->Execute($sql2, array($row[0])); } } else { $sql = "DELETE FROM {$table} WHERE expiry < {$time}"; $rs =& $conn->Execute($sql); ADODB_Session::_dumprs($rs); if ($rs) { $rs->Close(); } } if ($debug) { ADOConnection::outp("<p><b>Garbage Collection</b>: {$sql}</p>"); } } // suggested by Cameron, "GaM3R" <*****@*****.**> if ($optimize) { $driver = ADODB_Session::driver(); if (preg_match('/mysql/i', $driver)) { $sql = "OPTIMIZE TABLE {$table}"; } if (preg_match('/postgres/i', $driver)) { $sql = "VACUUM {$table}"; } if (!empty($sql)) { $conn->Execute($sql); } } if ($sync_seconds) { $sql = 'SELECT '; if ($conn->dataProvider === 'oci8') { $sql .= "TO_CHAR({$conn->sysTimeStamp}, 'RRRR-MM-DD HH24:MI:SS')"; } else { $sql .= $conn->sysTimeStamp; } $sql .= " FROM {$table}"; $rs =& $conn->SelectLimit($sql, 1); if ($rs && !$rs->EOF) { $dbts = reset($rs->fields); $rs->Close(); $dbt = $conn->UnixTimeStamp($dbts); $t = time(); if (abs($dbt - $t) >= $sync_seconds) { $msg = __FILE__ . ": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: " . " database={$dbt} ({$dbts}), webserver={$t} (diff=" . abs($dbt - $t) / 60 . ' minutes)'; error_log($msg); if ($debug) { ADOConnection::outp("<p>{$msg}</p>"); } } } } return true; }
function flushmemcache($key = false, $host, $port, $debug = false) { if (!function_exists('memcache_pconnect')) { if ($debug) { ADOConnection::outp(" Memcache module PECL extension not found!<br>\n"); } return; } $memcache = new Memcache(); if (!@$memcache->pconnect($host, $port)) { if ($debug) { ADOConnection::outp(" Can't connect to memcache server on: {$host}:{$port}<br>\n"); } return; } if ($key) { if (!$memcache->delete($key)) { if ($debug) { ADOConnection::outp("CacheFlush: {$key} entery doesn't exist on memcached server!<br>\n"); } } else { if ($debug) { ADOConnection::outp("CacheFlush: {$key} entery flushed from memcached server!<br>\n"); } } } else { if (!$memcache->flush()) { if ($debug) { ADOConnection::outp("CacheFlush: Failure flushing all enteries from memcached server!<br>\n"); } } else { if ($debug) { ADOConnection::outp("CacheFlush: All enteries flushed from memcached server!<br>\n"); } } } return; }
/** * Execute SQL, caching recordsets. * * @param [secs2cache] seconds to cache data, set to 0 to force query. * This is an optional parameter. * @param sql SQL statement to execute * @param [inputarr] holds the input data to bind to * @return RecordSet or false */ function &CacheExecute($secs2cache,$sql=false,$inputarr=false) { if (!is_numeric($secs2cache)) { $inputarr = $sql; $sql = $secs2cache; $secs2cache = $this->cacheSecs; } global $ADODB_INCLUDED_CSV; if (empty($ADODB_INCLUDED_CSV)) include_once(ADODB_DIR.'/adodb-csvlib.inc.php'); if (is_array($sql)) $sql = $sql[0]; $md5file = $this->_gencachename($sql.serialize($inputarr),true); $err = ''; if ($secs2cache > 0){ $rs = &csv2rs($md5file,$err,$secs2cache); $this->numCacheHits += 1; } else { $err='Timeout 1'; $rs = false; $this->numCacheMisses += 1; } if (!$rs) { // no cached rs found if ($this->debug) { if (get_magic_quotes_runtime()) { ADOConnection::outp("Please disable magic_quotes_runtime - it corrupts cache files :("); } if ($this->debug !== -1) ADOConnection::outp( " $md5file cache failure: $err (see sql below)"); } $rs = &$this->Execute($sql,$inputarr); if ($rs) { $eof = $rs->EOF; $rs = &$this->_rs2rs($rs); // read entire recordset into memory immediately $txt = _rs2serialize($rs,false,$sql); // serialize if (!adodb_write_file($md5file,$txt,$this->debug)) { if ($fn = $this->raiseErrorFn) { $fn($this->databaseType,'CacheExecute',-32000,"Cache write error",$md5file,$sql,$this); } if ($this->debug) ADOConnection::outp( " Cache write error"); } if ($rs->EOF && !$eof) { $rs->MoveFirst(); //$rs = &csv2rs($md5file,$err); $rs->connection = &$this; // Pablo suggestion } } else @unlink($md5file); } else { $this->_errorMsg = ''; $this->_errorCode = 0; if ($this->fnCacheExecute) { $fn = $this->fnCacheExecute; $fn($this, $secs2cache, $sql, $inputarr); } // ok, set cached object found $rs->connection = &$this; // Pablo suggestion if ($this->debug){ global $HTTP_SERVER_VARS; $inBrowser = isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']); $ttl = $rs->timeCreated + $secs2cache - time(); $s = is_array($sql) ? $sql[0] : $sql; if ($inBrowser) $s = '<i>'.htmlspecialchars($s).'</i>'; ADOConnection::outp( " $md5file reloaded, ttl=$ttl [ $s ]"); } } return $rs; }
function adodb_sess_gc($maxlifetime) { global $ADODB_SESS_DEBUG, $ADODB_SESS_CONN, $ADODB_SESSION_TBL, $ADODB_SESSION_EXPIRE_NOTIFY; if ($ADODB_SESSION_EXPIRE_NOTIFY) { reset($ADODB_SESSION_EXPIRE_NOTIFY); $fn = next($ADODB_SESSION_EXPIRE_NOTIFY); $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM); $t = time(); $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM {$ADODB_SESSION_TBL} WHERE expiry < {$t}"); $ADODB_SESS_CONN->SetFetchMode($savem); if ($rs) { $ADODB_SESS_CONN->BeginTrans(); while (!$rs->EOF) { $ref = $rs->fields[0]; $key = $rs->fields[1]; $fn($ref, $key); $del = $ADODB_SESS_CONN->Execute("DELETE FROM {$ADODB_SESSION_TBL} WHERE sesskey='{$key}'"); $rs->MoveNext(); } $rs->Close(); //$ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE expiry < $t"); $ADODB_SESS_CONN->CommitTrans(); } } else { $ADODB_SESS_CONN->Execute("DELETE FROM {$ADODB_SESSION_TBL} WHERE expiry < " . time()); if ($ADODB_SESS_DEBUG) { ADOConnection::outp("\n-- <b>Garbage Collection</b>: {$qry}</p>"); } } // suggested by Cameron, "GaM3R" <*****@*****.**> if (defined('ADODB_SESSION_OPTIMIZE')) { global $ADODB_SESSION_DRIVER; switch ($ADODB_SESSION_DRIVER) { case 'mysql': case 'mysqlt': $opt_qry = 'OPTIMIZE TABLE ' . $ADODB_SESSION_TBL; break; case 'postgresql': case 'postgresql7': $opt_qry = 'VACUUM ' . $ADODB_SESSION_TBL; break; } if (!empty($opt_qry)) { $ADODB_SESS_CONN->Execute($opt_qry); } } if ($ADODB_SESS_CONN->dataProvider === 'oci8') { $sql = 'select TO_CHAR(' . $ADODB_SESS_CONN->sysTimeStamp . ', \'RRRR-MM-DD HH24:MI:SS\') from ' . $ADODB_SESSION_TBL; } else { $sql = 'select ' . $ADODB_SESS_CONN->sysTimeStamp . ' from ' . $ADODB_SESSION_TBL; } $rs = $ADODB_SESS_CONN->SelectLimit($sql, 1); if ($rs && !$rs->EOF) { $dbts = reset($rs->fields); $rs->Close(); $dbt = $ADODB_SESS_CONN->UnixTimeStamp($dbts); $t = time(); if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) { $msg = __FILE__ . ": Server time for webserver {$_SERVER['HTTP_HOST']} not in synch with database: database={$dbt} ({$dbts}), webserver={$t} (diff=" . abs($dbt - $t) / 3600 . " hrs)"; error_log($msg); if ($ADODB_SESS_DEBUG) { ADOConnection::outp("\n-- {$msg}</p>"); } } } return true; }
function _adodb_debug_execute(&$zthis, $sql, $inputarr) { $ss = ''; if ($inputarr) { foreach ($inputarr as $kk => $vv) { if (is_string($vv) && strlen($vv) > 64) { $vv = substr($vv, 0, 64) . '...'; } if (is_null($vv)) { $ss .= "({$kk}=>null) "; } else { $ss .= "({$kk}=>'{$vv}') "; } } $ss = "[ {$ss} ]"; } $sqlTxt = is_array($sql) ? $sql[0] : $sql; /*str_replace(', ','##1#__^LF',is_array($sql) ? $sql[0] : $sql); $sqlTxt = str_replace(',',', ',$sqlTxt); $sqlTxt = str_replace('##1#__^LF', ', ' ,$sqlTxt); */ // check if running from browser or command-line $inBrowser = isset($_SERVER['HTTP_USER_AGENT']); $dbt = $zthis->databaseType; if (isset($zthis->dsnType)) { $dbt .= '-' . $zthis->dsnType; } if ($inBrowser) { if ($ss) { $ss = '<code>' . htmlspecialchars($ss) . '</code>'; } if ($zthis->debug === -1) { ADOConnection::outp("<br>\n({$dbt}): " . htmlspecialchars($sqlTxt) . " {$ss}\n<br>\n", false); } else { if ($zthis->debug !== -99) { ADOConnection::outp("<hr>\n({$dbt}): " . htmlspecialchars($sqlTxt) . " {$ss}\n<hr>\n", false); } } } else { $ss = "\n " . $ss; if ($zthis->debug !== -99) { ADOConnection::outp("-----<hr>\n({$dbt}): " . $sqlTxt . " {$ss}\n-----<hr>\n", false); } } $qID = $zthis->_query($sql, $inputarr); /* Alexios Fakios notes that ErrorMsg() must be called before ErrorNo() for mssql because ErrorNo() calls Execute('SELECT @ERROR'), causing recursion */ if ($zthis->databaseType == 'mssql') { // ErrorNo is a slow function call in mssql, and not reliable in PHP 4.0.6 if ($emsg = $zthis->ErrorMsg()) { if ($err = $zthis->ErrorNo()) { if ($zthis->debug === -99) { ADOConnection::outp("<hr>\n({$dbt}): " . htmlspecialchars($sqlTxt) . " {$ss}\n<hr>\n", false); } ADOConnection::outp($err . ': ' . $emsg); } } } else { if (!$qID) { if ($zthis->debug === -99) { if ($inBrowser) { ADOConnection::outp("<hr>\n({$dbt}): " . htmlspecialchars($sqlTxt) . " {$ss}\n<hr>\n", false); } else { ADOConnection::outp("-----<hr>\n({$dbt}): " . $sqlTxt . "{$ss}\n-----<hr>\n", false); } } ADOConnection::outp($zthis->ErrorNo() . ': ' . $zthis->ErrorMsg()); } } if ($zthis->debug === 99) { _adodb_backtrace(true, 9999, 2); } return $qID; }
/** * @see adodb_perf#optimizeTable */ function optimizeTable($table, $mode = ADODB_OPT_LOW) { if (!is_string($table)) { return false; } $conn = $this->conn; if (!$conn) { return false; } $sql = ''; switch ($mode) { case ADODB_OPT_LOW: $sql = $this->optimizeTableLow; break; case ADODB_OPT_HIGH: $sql = $this->optimizeTableHigh; break; default: // May dont use __FUNCTION__ constant for BC (__FUNCTION__ Added in PHP 4.3.0) ADOConnection::outp(sprintf("<p>%s: '%s' using of undefined mode '%s'</p>", __CLASS__, __FUNCTION__, $mode)); return false; } $sql = sprintf($sql, $table); return $conn->Execute($sql) !== false; }
/** * Save a file $filename and its $contents (normally for caching) with file locking */ function adodb_write_file($filename, $contents, $debug = false) { # http://www.php.net/bugs.php?id=9203 Bug that flock fails on Windows # So to simulate locking, we assume that rename is an atomic operation. # First we delete $filename, then we create a $tempfile write to it and # rename to the desired $filename. If the rename works, then we successfully # modified the file exclusively. # What a stupid need - having to simulate locking. # Risks: # 1. $tempfile name is not unique -- very very low # 2. unlink($filename) fails -- ok, rename will fail # 3. adodb reads stale file because unlink fails -- ok, $rs timeout occurs # 4. another process creates $filename between unlink() and rename() -- ok, rename() fails and cache updated if (strncmp(PHP_OS, 'WIN', 3) === 0) { // skip the decimal place $mtime = substr(str_replace(' ', '_', microtime()), 2); // getmypid() actually returns 0 on Win98 - never mind! $tmpname = $filename . uniqid($mtime) . getmypid(); if (!($fd = @fopen($tmpname, 'a'))) { return false; } $ok = ftruncate($fd, 0); if (!fwrite($fd, $contents)) { $ok = false; } fclose($fd); chmod($tmpname, 0644); // the tricky moment @unlink($filename); if (!@rename($tmpname, $filename)) { unlink($tmpname); $ok = false; } if (!$ok) { if ($debug) { ADOConnection::outp(" Rename {$tmpname} " . ($ok ? 'ok' : 'failed')); } } return $ok; } if (!($fd = @fopen($filename, 'a'))) { return false; } if (flock($fd, LOCK_EX) && ftruncate($fd, 0)) { $ok = fwrite($fd, $contents); fclose($fd); chmod($filename, 0644); } else { fclose($fd); if ($debug) { ADOConnection::outp(" Failed acquiring lock for {$filename}<br>\n"); } $ok = false; } return $ok; }
function _query($sql, $inputarr) { $this->_errorMsg = false; if (is_array($inputarr)) { # bind input params with sp_executesql: # see http://www.quest-pipelines.com/newsletter-v3/0402_F.htm # works only with sql server 7 and newer if (!is_array($sql)) { $sql = $this->Prepare($sql); } $params = ''; $decl = ''; $i = 0; foreach ($inputarr as $v) { if ($decl) { $decl .= ', '; $params .= ', '; } if (is_string($v)) { $len = strlen($v); if ($len == 0) { $len = 1; } if ($len > 4000) { // NVARCHAR is max 4000 chars. Let's use NTEXT $decl .= "@P{$i} NTEXT"; } else { $decl .= "@P{$i} NVARCHAR({$len})"; } $params .= "@P{$i}=N" . (strncmp($v, "'", 1) == 0 ? $v : $this->qstr($v)); } else { if (is_integer($v)) { $decl .= "@P{$i} INT"; $params .= "@P{$i}=" . $v; } else { if (is_float($v)) { $decl .= "@P{$i} FLOAT"; $params .= "@P{$i}=" . $v; } else { if (is_bool($v)) { $decl .= "@P{$i} INT"; # Used INT just in case BIT in not supported on the user's MSSQL version. It will cast appropriately. $params .= "@P{$i}=" . ($v ? '1' : '0'); # True == 1 in MSSQL BIT fields and acceptable for storing logical true in an int field } else { $decl .= "@P{$i} CHAR"; # Used char because a type is required even when the value is to be NULL. $params .= "@P{$i}=NULL"; } } } } $i += 1; } $decl = $this->qstr($decl); if ($this->debug) { ADOConnection::outp("<font size=-1>sp_executesql N{$sql[1]},N{$decl},{$params}</font>"); } $rez = mssql_query("sp_executesql N{$sql[1]},N{$decl},{$params}"); } else { if (is_array($sql)) { # PrepareSP() $rez = mssql_execute($sql[1]); } else { $rez = mssql_query($sql, $this->_connectionID); } } return $rez; }
function BeginTrans() { if ($this->debug) { ADOConnection::outp("Transactions not supported in 'mysql' driver. Use 'mysqlt' or 'mysqli' driver"); } }
function _fetch() { $rs = $this->_queryID; if (!$rs or $rs->EOF) { $this->fields = false; return false; } $this->fields = array(); if (!$this->_tarr) { $tarr = array(); $flds = array(); for ($i = 0, $max = $this->_numOfFields; $i < $max; $i++) { $f = $rs->Fields($i); $flds[] = $f; $tarr[] = $f->Type; } // bind types and flds only once $this->_tarr = $tarr; $this->_flds = $flds; } $t = reset($this->_tarr); $f = reset($this->_flds); if ($this->hideErrors) { $olde = error_reporting(E_ERROR | E_CORE_ERROR); } // sometimes $f->value be null for ($i = 0, $max = $this->_numOfFields; $i < $max; $i++) { //echo "<p>",$t,' ';var_dump($f->value); echo '</p>'; switch ($t) { case 135: // timestamp if (!strlen((string) $f->value)) { $this->fields[] = false; } else { if (!is_numeric($f->value)) { $val = variant_date_to_timestamp($f->value); } else { $val = $f->value; } $this->fields[] = adodb_date('Y-m-d H:i:s', $val); } break; case 133: // A date value (yyyymmdd) if ($val = $f->value) { $this->fields[] = substr($val, 0, 4) . '-' . substr($val, 4, 2) . '-' . substr($val, 6, 2); } else { $this->fields[] = false; } break; case 7: // adDate if (!strlen((string) $f->value)) { $this->fields[] = false; } else { if (!is_numeric($f->value)) { $val = variant_date_to_timestamp($f->value); } else { $val = $f->value; } if ($val % 86400 == 0) { $this->fields[] = adodb_date('Y-m-d', $val); } else { $this->fields[] = adodb_date('Y-m-d H:i:s', $val); } } break; case 1: // null $this->fields[] = false; break; case 6: // currency is not supported properly; ADOConnection::outp('<b>' . $f->Name . ': currency type not supported by PHP</b>'); $this->fields[] = (double) $f->value; break; default: $this->fields[] = $f->value; break; } //print " $f->value $t, "; $f = next($this->_flds); $t = next($this->_tarr); } // for if ($this->hideErrors) { error_reporting($olde); } @$rs->MoveNext(); // @ needed for some versions of PHP! if ($this->fetchMode & ADODB_FETCH_ASSOC) { $this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE); } return true; }
function FailTrans() { if ($this->debug) { if ($this->transOff == 0) { ADOConnection::outp("FailTrans outside StartTrans/CompleteTrans"); } else { ADOConnection::outp("FailTrans was called"); } } $this->transaction_status = false; }
function _GenFields($flds, $widespacing = false) { if (is_string($flds)) { $padding = ' '; $txt = $flds . $padding; $flds = array(); $flds0 = Lens_ParseArgs($txt, ','); $hasparam = false; foreach ($flds0 as $f0) { $f1 = array(); foreach ($f0 as $token) { switch (strtoupper($token)) { case 'CONSTRAINT': case 'DEFAULT': $hasparam = $token; break; default: if ($hasparam) { $f1[$hasparam] = $token; } else { $f1[] = $token; } $hasparam = false; break; } } $flds[] = $f1; } } $this->autoIncrement = false; $lines = array(); $pkey = array(); foreach ($flds as $fld) { $fld = _array_change_key_case($fld); $fname = false; $fdefault = false; $fautoinc = false; $ftype = false; $fsize = false; $fprec = false; $fprimary = false; $fnoquote = false; $fdefts = false; $fdefdate = false; $fconstraint = false; $fnotnull = false; $funsigned = false; //----------------- // Parse attributes foreach ($fld as $attr => $v) { if ($attr == 2 && is_numeric($v)) { $attr = 'SIZE'; } else { if (is_numeric($attr) && $attr > 1 && !is_numeric($v)) { $attr = strtoupper($v); } } switch ($attr) { case '0': case 'NAME': $fname = $v; break; case '1': case 'TYPE': $ty = $v; $ftype = $this->ActualType(strtoupper($v)); break; case 'SIZE': $dotat = strpos($v, '.'); if ($dotat === false) { $dotat = strpos($v, ','); } if ($dotat === false) { $fsize = $v; } else { $fsize = substr($v, 0, $dotat); $fprec = substr($v, $dotat + 1); } break; case 'UNSIGNED': $funsigned = true; break; case 'AUTOINCREMENT': case 'AUTO': $fautoinc = true; $fnotnull = true; break; case 'KEY': case 'PRIMARY': $fprimary = $v; $fnotnull = true; break; case 'DEF': case 'DEFAULT': $fdefault = $v; break; case 'NOTNULL': $fnotnull = $v; break; case 'NOQUOTE': $fnoquote = $v; break; case 'DEFDATE': $fdefdate = $v; break; case 'DEFTIMESTAMP': $fdefts = $v; break; case 'CONSTRAINT': $fconstraint = $v; break; } //switch } // foreach $fld //-------------------- // VALIDATE FIELD INFO if (!strlen($fname)) { if ($this->debug) { ADOConnection::outp("Undefined NAME"); } return false; } $fid = strtoupper(preg_replace('/^`(.+)`$/', '$1', $fname)); $fname = $this->NameQuote($fname); if (!strlen($ftype)) { if ($this->debug) { ADOConnection::outp("Undefined TYPE for field '{$fname}'"); } return false; } else { $ftype = strtoupper($ftype); } $ftype = $this->_GetSize($ftype, $ty, $fsize, $fprec); if ($ty == 'X' || $ty == 'X2' || $ty == 'B') { $fnotnull = false; } // some blob types do not accept nulls if ($fprimary) { $pkey[] = $fname; } // some databases do not allow blobs to have defaults if ($ty == 'X') { $fdefault = false; } //-------------------- // CONSTRUCT FIELD SQL if ($fdefts) { if (substr($this->connection->databaseType, 0, 5) == 'mysql') { $ftype = 'TIMESTAMP'; } else { $fdefault = $this->connection->sysTimeStamp; } } else { if ($fdefdate) { if (substr($this->connection->databaseType, 0, 5) == 'mysql') { $ftype = 'TIMESTAMP'; } else { $fdefault = $this->connection->sysDate; } } else { if ($fdefault !== false && !$fnoquote) { if ($ty == 'C' or $ty == 'X' or substr($fdefault, 0, 1) != "'" && !is_numeric($fdefault)) { if (strlen($fdefault) != 1 && substr($fdefault, 0, 1) == ' ' && substr($fdefault, strlen($fdefault) - 1) == ' ') { $fdefault = trim($fdefault); } else { if (strtolower($fdefault) != 'null') { $fdefault = $this->connection->qstr($fdefault); } } } } } } $suffix = $this->_CreateSuffix($fname, $ftype, $fnotnull, $fdefault, $fautoinc, $fconstraint, $funsigned); if ($widespacing) { $fname = str_pad($fname, 24); } $lines[$fid] = $fname . ' ' . $ftype . $suffix; if ($fautoinc) { $this->autoIncrement = true; } } // foreach $flds return array($lines, $pkey); }
/** * Reorganise the table-indices/statistics/.. depending on the given mode. * Default Implementation throws an error. * * @param string table name of the table to optimize * @param int mode optimization-mode * <code>ADODB_OPT_HIGH</code> for full optimization * <code>ADODB_OPT_LOW</code> for CPU-less optimization * Default is LOW <code>ADODB_OPT_LOW</code> * @author Markus Staab * @return Returns <code>true</code> on success and <code>false</code> on error */ function OptimizeTable($table, $mode = ADODB_OPT_LOW) { ADOConnection::outp(sprintf("<p>%s: '%s' not implemented for driver '%s'</p>", __CLASS__, __FUNCTION__, $this->conn->databaseType)); return false; }
/** * Adds SQL into the SQL array. * * @param mixed $sql SQL to Add * @return boolean TRUE if successful, else FALSE. * * @access private */ function addSQL($sql = NULL) { if (is_array($sql)) { foreach ($sql as $line) { $this->addSQL($line); } return TRUE; } if (is_string($sql)) { $this->sqlArray[] = $sql; // if executeInline is enabled, and either no errors have occurred or continueOnError is enabled, execute SQL. if ($this->ExecuteInline() && ($this->success == 2 || $this->ContinueOnError())) { $saved = $this->db->debug; $this->db->debug = $this->debug; $ok = $this->db->Execute($sql); $this->db->debug = $saved; if (!$ok) { if ($this->debug) { ADOConnection::outp($this->db->ErrorMsg()); } $this->success = 1; } } return TRUE; } return FALSE; }
/** "Florian Buzin [ easywe ]" <florian.buzin#easywe.de> This function changes/adds new fields to your table. You don't have to know if the col is new or not. It will check on its own. */ function ChangeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds = false) { global $ADODB_FETCH_MODE; $save = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; if ($this->connection->fetchMode !== false) { $savem = $this->connection->SetFetchMode(false); } // check table exists $save_handler = $this->connection->raiseErrorFn; $this->connection->raiseErrorFn = ''; $cols = $this->MetaColumns($tablename); $this->connection->raiseErrorFn = $save_handler; if (isset($savem)) { $this->connection->SetFetchMode($savem); } $ADODB_FETCH_MODE = $save; if (empty($cols)) { return $this->CreateTableSQL($tablename, $flds, $tableoptions); } if (is_array($flds)) { // Cycle through the update fields, comparing // existing fields to fields to update. // if the Metatype and size is exactly the // same, ignore - by Mark Newham $holdflds = array(); foreach ($flds as $k => $v) { if (isset($cols[$k]) && is_object($cols[$k])) { // If already not allowing nulls, then don't change $obj = $cols[$k]; if (isset($obj->not_null) && $obj->not_null) { $v = str_replace('NOT NULL', '', $v); } if (isset($obj->auto_increment) && $obj->auto_increment && empty($v['AUTOINCREMENT'])) { $v = str_replace('AUTOINCREMENT', '', $v); } $c = $cols[$k]; $ml = $c->max_length; $mt = $this->MetaType($c->type, $ml); 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) { $holdflds[$k] = $v; } } else { $holdflds[$k] = $v; } } $flds = $holdflds; } // already exists, alter table instead list($lines, $pkey, $idxs) = $this->_GenFields($flds); // genfields can return FALSE at times if ($lines == null) { $lines = array(); } $alter = 'ALTER TABLE ' . $this->TableName($tablename); $sql = array(); foreach ($lines as $id => $v) { if (isset($cols[$id]) && is_object($cols[$id])) { $flds = Lens_ParseArgs($v, ','); // We are trying to change the size of the field, if not allowed, simply ignore the request. // $flds[1] holds the type, $flds[2] holds the size -postnuke addition if ($flds && in_array(strtoupper(substr($flds[0][1], 0, 4)), $this->invalidResizeTypes4) && (isset($flds[0][2]) && is_numeric($flds[0][2]))) { if ($this->debug) { ADOConnection::outp(sprintf("<h3>%s cannot be changed to %s currently</h3>", $flds[0][0], $flds[0][1])); } #echo "<h3>$this->alterCol cannot be changed to $flds currently</h3>"; continue; } $sql[] = $alter . $this->alterCol . ' ' . $v; } else { $sql[] = $alter . $this->addCol . ' ' . $v; } } if ($dropOldFlds) { foreach ($cols as $id => $v) { if (!isset($lines[$id])) { $sql[] = $alter . $this->dropCol . ' ' . $v->name; } } } return $sql; }
function Error($err, $fn) { global $_ADODB_ACTIVE_DBS; $fn = get_class($this) . '::' . $fn; $this->_lasterr = $fn . ': ' . $err; if ($this->_dbat < 0) { $db = false; } else { $activedb = $_ADODB_ACTIVE_DBS[$this->_dbat]; $db = $activedb->db; } if (function_exists('adodb_throw')) { if (!$db) { adodb_throw('ADOdb_Active_Record', $fn, -1, $err, 0, 0, false); } else { adodb_throw($db->databaseType, $fn, -1, $err, 0, 0, $db); } } else { if (!$db || $db->debug) { ADOConnection::outp($this->_lasterr); } } }
function _query($sql,$inputarr) { if (is_array($sql)) { // is prepared sql $stmt = $sql[1]; // we try to bind to permanent array, so that OCIBindByName is persistent // and carried out once only - note that max array element size is 4000 chars if (is_array($inputarr)) { $bindpos = $sql[3]; if (isset($this->_bind[$bindpos])) { // all tied up already $bindarr = $this->_bind[$bindpos]; } else { // one statement to bind them all $bindarr = array(); foreach($inputarr as $k => $v) { $bindarr[$k] = $v; OCIBindByName($stmt,":$k",$bindarr[$k],is_string($v) && strlen($v)>4000 ? -1 : 4000); } $this->_bind[$bindpos] = $bindarr; } } } else { $stmt=OCIParse($this->_connectionID,$sql); } $this->_stmt = $stmt; if (!$stmt) return false; if (defined('ADODB_PREFETCH_ROWS')) @OCISetPrefetch($stmt,ADODB_PREFETCH_ROWS); if (is_array($inputarr)) { foreach($inputarr as $k => $v) { if (is_array($v)) { if (sizeof($v) == 2) // suggested by g.giunta@libero. OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]); else OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]); if ($this->debug==99) { if (is_object($v[0])) echo "name=:$k",' len='.$v[1],' type='.$v[2],'<br>'; else echo "name=:$k",' var='.$inputarr[$k][0],' len='.$v[1],' type='.$v[2],'<br>'; } } else { $len = -1; if ($v === ' ') $len = 1; if (isset($bindarr)) { // is prepared sql, so no need to ocibindbyname again $bindarr[$k] = $v; } else { // dynamic sql, so rebind every time OCIBindByName($stmt,":$k",$inputarr[$k],$len); } } } } $this->_errorMsg = false; $this->_errorCode = false; if (OCIExecute($stmt,$this->_commit)) { //OCIInternalDebug(1); if (count($this -> _refLOBs) > 0) { foreach ($this -> _refLOBs as $key => $value) { if ($this -> _refLOBs[$key]['TYPE'] == true) { $tmp = $this -> _refLOBs[$key]['LOB'] -> load(); if ($this -> debug) { ADOConnection::outp("<b>OUT LOB</b>: LOB has been loaded. <br>"); } //$_GLOBALS[$this -> _refLOBs[$key]['VAR']] = $tmp; $this -> _refLOBs[$key]['VAR'] = $tmp; } else { $this->_refLOBs[$key]['LOB']->save($this->_refLOBs[$key]['VAR']); $this -> _refLOBs[$key]['LOB']->free(); unset($this -> _refLOBs[$key]); if ($this->debug) { ADOConnection::outp("<b>IN LOB</b>: LOB has been saved. <br>"); } } } } switch (@OCIStatementType($stmt)) { case "SELECT": return $stmt; case 'DECLARE': case "BEGIN": if (is_array($sql) && !empty($sql[4])) { $cursor = $sql[4]; if (is_resource($cursor)) { $ok = OCIExecute($cursor); return $cursor; } return $stmt; } else { if (is_resource($stmt)) { OCIFreeStatement($stmt); return true; } return $stmt; } break; default : // ociclose -- no because it could be used in a LOB? return true; } } return false; }
function &MetaColumns($table, $normalize = true) { global $ADODB_FETCH_MODE; $schema = false; $false = false; $this->_findschema($table, $schema); if ($normalize) { $table = strtolower($table); } $save = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; if ($this->fetchMode !== false) { $savem = $this->SetFetchMode(false); } if ($schema) { $rs =& $this->Execute(sprintf($this->metaColumnsSQL1, $table, $table, $schema)); } else { $rs =& $this->Execute(sprintf($this->metaColumnsSQL, $table, $table)); } if (isset($savem)) { $this->SetFetchMode($savem); } $ADODB_FETCH_MODE = $save; if ($rs === false) { return $false; } if (!empty($this->metaKeySQL)) { // If we want the primary keys, we have to issue a separate query // Of course, a modified version of the metaColumnsSQL query using a // LEFT JOIN would have been much more elegant, but postgres does // not support OUTER JOINS. So here is the clumsy way. $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $rskey = $this->Execute(sprintf($this->metaKeySQL, $table)); // fetch all result in once for performance. $keys =& $rskey->GetArray(); if (isset($savem)) { $this->SetFetchMode($savem); } $ADODB_FETCH_MODE = $save; $rskey->Close(); unset($rskey); } $rsdefa = array(); if (!empty($this->metaDefaultsSQL)) { $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $sql = sprintf($this->metaDefaultsSQL, $table); $rsdef = $this->Execute($sql); if (isset($savem)) { $this->SetFetchMode($savem); } $ADODB_FETCH_MODE = $save; if ($rsdef) { while (!$rsdef->EOF) { $num = $rsdef->fields['num']; $s = $rsdef->fields['def']; if (strpos($s, '::') === false && substr($s, 0, 1) == "'") { /* quoted strings hack... for now... fixme */ $s = substr($s, 1); $s = substr($s, 0, strlen($s) - 1); } $rsdefa[$num] = $s; $rsdef->MoveNext(); } } else { ADOConnection::outp("==> SQL => " . $sql); } unset($rsdef); } $retarr = array(); while (!$rs->EOF) { $fld = new ADOFieldObject(); $fld->name = $rs->fields[0]; $fld->type = $rs->fields[1]; $fld->max_length = $rs->fields[2]; $fld->attnum = $rs->fields[6]; if ($fld->max_length <= 0) { $fld->max_length = $rs->fields[3] - 4; } if ($fld->max_length <= 0) { $fld->max_length = -1; } if ($fld->type == 'numeric') { $fld->scale = $fld->max_length & 0xffff; $fld->max_length >>= 16; } // dannym // 5 hasdefault; 6 num-of-column $fld->has_default = $rs->fields[5] == 't'; if ($fld->has_default) { $fld->default_value = $rsdefa[$rs->fields[6]]; } //Freek $fld->not_null = $rs->fields[4] == 't'; // Freek if (is_array($keys)) { foreach ($keys as $key) { if ($fld->name == $key['column_name'] and $key['primary_key'] == 't') { $fld->primary_key = true; } if ($fld->name == $key['column_name'] and $key['unique_key'] == 't') { $fld->unique = true; } // What name is more compatible? } } if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) { $retarr[] = $fld; } else { $retarr[$normalize ? strtoupper($fld->name) : $fld->name] = $fld; } $rs->MoveNext(); } $rs->Close(); if (empty($retarr)) { return $false; } else { return $retarr; } }
function _CreateSuffix($fname, &$ftype, $fnotnull, $fdefault, $fautoinc, $fconstraint, $funsigned) { $suffix = ''; if ($fdefault == "''" && $fnotnull) { // this is null in oracle $fnotnull = false; if ($this->debug) { ADOConnection::outp("NOT NULL and DEFAULT='' illegal in Oracle"); } } if (strlen($fdefault)) { $suffix .= " DEFAULT {$fdefault}"; } if ($fnotnull) { $suffix .= ' NOT NULL'; } if ($fautoinc) { $this->seqField = $fname; } if ($fconstraint) { $suffix .= ' ' . $fconstraint; } return $suffix; }
/** * Begin a Transaction. Must be followed by CommitTrans() or RollbackTrans(). * * @return true if succeeded or false if database does not support transactions */ function BeginTrans() { if ($this->debug) { ADOConnection::outp("BeginTrans: Transactions not supported for this driver"); } return false; }
static function write($key, $oval) { global $ADODB_SESSION_READONLY; if (!empty($ADODB_SESSION_READONLY)) { return; } $clob = ADODB_Session::clob(); $conn = ADODB_Session::_conn(); $crc = ADODB_Session::_crc(); $debug = ADODB_Session::debug(); $driver = ADODB_Session::driver(); $expire_notify = ADODB_Session::expireNotify(); $filter = ADODB_Session::filter(); $lifetime = ADODB_Session::lifetime(); $table = ADODB_Session::table(); if (!$conn) { return false; } if ($debug) { $conn->debug = 1; } $sysTimeStamp = $conn->sysTimeStamp; //assert('$table'); $expiry = $conn->OffsetDate($lifetime / (24 * 3600), $sysTimeStamp); $binary = $conn->dataProvider === 'mysql' ? '/*! BINARY */' : ''; // crc32 optimization since adodb 2.1 // now we only update expiry date, thx to sebastian thom in adodb 2.32 if ($crc !== '00' && $crc !== false && $crc == strlen($oval) . crc32($oval)) { if ($debug) { echo '<p>Session: Only updating date - crc32 not changed</p>'; } $expirevar = ''; if ($expire_notify) { $var = reset($expire_notify); global ${$var}; if (isset(${$var})) { $expirevar = ${$var}; } } $sql = "UPDATE {$table} SET expiry = {$expiry} ,expireref=" . $conn->Param('0') . ", modified = {$sysTimeStamp} WHERE {$binary} sesskey = " . $conn->Param('1') . " AND expiry >= {$sysTimeStamp}"; $rs = $conn->Execute($sql, array($expirevar, $key)); return true; } $val = rawurlencode($oval); foreach ($filter as $f) { if (is_object($f)) { $val = $f->write($val, ADODB_Session::_sessionKey()); } } $expireref = ''; if ($expire_notify) { $var = reset($expire_notify); global ${$var}; if (isset(${$var})) { $expireref = ${$var}; } } if (!$clob) { // no lobs, simply use replace() $rs = $conn->Execute("SELECT COUNT(*) AS cnt FROM {$table} WHERE {$binary} sesskey = " . $conn->Param(0), array($key)); if ($rs) { $rs->Close(); } if ($rs && reset($rs->fields) > 0) { $sql = "UPDATE {$table} SET expiry={$expiry}, sessdata=" . $conn->Param(0) . ", expireref= " . $conn->Param(1) . ",modified={$sysTimeStamp} WHERE sesskey = " . $conn->Param(2); } else { $sql = "INSERT INTO {$table} (expiry, sessdata, expireref, sesskey, created, modified)\n\t\t\t\t\tVALUES ({$expiry}," . $conn->Param('0') . ", " . $conn->Param('1') . ", " . $conn->Param('2') . ", {$sysTimeStamp}, {$sysTimeStamp})"; } $rs = $conn->Execute($sql, array($val, $expireref, $key)); } else { // what value shall we insert/update for lob row? if (strncmp($driver, 'oci8', 4) == 0) { $lob_value = sprintf('empty_%s()', strtolower($clob)); } else { $lob_value = 'null'; } $conn->StartTrans(); $rs = $conn->Execute("SELECT COUNT(*) AS cnt FROM {$table} WHERE {$binary} sesskey = " . $conn->Param(0), array($key)); if ($rs && reset($rs->fields) > 0) { $sql = "UPDATE {$table} SET expiry={$expiry}, sessdata={$lob_value}, expireref= " . $conn->Param(0) . ",modified={$sysTimeStamp} WHERE sesskey = " . $conn->Param('1'); } else { $sql = "INSERT INTO {$table} (expiry, sessdata, expireref, sesskey, created, modified)\n\t\t\t\t\tVALUES ({$expiry},{$lob_value}, " . $conn->Param('0') . ", " . $conn->Param('1') . ", {$sysTimeStamp}, {$sysTimeStamp})"; } $rs = $conn->Execute($sql, array($expireref, $key)); $qkey = $conn->qstr($key); $rs2 = $conn->UpdateBlob($table, 'sessdata', $val, " sesskey={$qkey}", strtoupper($clob)); if ($debug) { echo "<hr>", htmlspecialchars($oval), "<hr>"; } $rs = @$conn->CompleteTrans(); } if (!$rs) { ADOConnection::outp('<p>Session Replace: ' . $conn->ErrorMsg() . '</p>', false); return false; } else { // bug in access driver (could be odbc?) means that info is not committed // properly unless select statement executed in Win2000 if ($conn->databaseType == 'access') { $sql = "SELECT sesskey FROM {$table} WHERE {$binary} sesskey = {$qkey}"; $rs = $conn->Execute($sql); ADODB_Session::_dumprs($rs); if ($rs) { $rs->Close(); } } } /* if (ADODB_Session::Lock()) { $conn->CommitTrans(); }*/ return $rs ? true : false; }