本文整理汇总了PHP中ADOConnection::outp方法的典型用法代码示例。如果您正苦于以下问题:PHP ADOConnection::outp方法的具体用法?PHP ADOConnection::outp怎么用?PHP ADOConnection::outp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADOConnection
的用法示例。
在下文中一共展示了ADOConnection::outp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _pconnect
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;
}
示例2: _connect
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;
}
示例3: DropColumnSQL
public function DropColumnSQL($tabname, $flds, $tableflds = '', $tableoptions = '')
{
if ($this->debug) {
ADOConnection::outp("DropColumnSQL not supported");
}
return array();
}
示例4: _connect
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;
}
示例5: DropColumnSQL
function DropColumnSQL($tabname, $flds)
{
if ($this->debug) {
ADOConnection::outp("DropColumnSQL not supported");
}
return array();
}
示例6: PrepareSP
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);
}
示例7: _connect
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 = 'anonymous';
$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;
}
示例8: _connect
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 = 'anonymous';
$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;
}
示例9: optimizeTable
/**
* @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;
}
示例10: gc
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" <gamr@outworld.cx>
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;
}
示例11: flushmemcache
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;
}
示例12: _rs2serialize
/**
* 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;
}
示例13: adodb_sess_gc
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" <gamr@outworld.cx>
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;
}
示例14: _adodb_debug_execute
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;
}
示例15: optimizeTable
/**
* @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;
}