/** * Connect to server */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) { $this->persistency = $persistency; $this->user = $sqluser; $this->server = $sqlserver . ($port ? ':' . $port : ''); $this->dbname = $database; $this->db_connect_id = $this->persistency ? @ociplogon($this->user, $sqlpassword, $this->server) : @ocinlogon($this->user, $sqlpassword, $this->server); return $this->db_connect_id ? $this->db_connect_id : $this->sql_error(''); }
function numRows() { if ($tmpdb = ocinlogon($this->DBUser, $this->DBPassword, $this->DBHost)) { $res = ociparse($tmpdb, $this->lastQuery); ociexecute($res); $cnt = ocifetchstatement($res, $temp); ocilogoff($tmpdb); } else { $cnt = FALSE; } return $cnt; }
/** * Connect to server */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { $this->persistency = $persistency; $this->user = $sqluser; $this->server = $sqlserver . ($port ? ':' . $port : ''); $this->dbname = $database; $connect = $database; // support for "easy connect naming" if ($sqlserver !== '' && $sqlserver !== '/') { if (substr($sqlserver, -1, 1) == '/') { $sqlserver == substr($sqlserver, 0, -1); } $connect = $sqlserver . ($port ? ':' . $port : '') . '/' . $database; } $this->db_connect_id = $new_link ? @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8') : ($this->persistency ? @ociplogon($this->user, $sqlpassword, $connect, 'UTF8') : @ocilogon($this->user, $sqlpassword, $connect, 'UTF8')); return $this->db_connect_id ? $this->db_connect_id : $this->sql_error(''); }
/** * {@inheritDoc} */ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) { $this->persistency = $persistency; $this->user = $sqluser; $this->server = $sqlserver . ($port ? ':' . $port : ''); $this->dbname = $database; $connect = $database; // support for "easy connect naming" if ($sqlserver !== '' && $sqlserver !== '/') { if (substr($sqlserver, -1, 1) == '/') { $sqlserver == substr($sqlserver, 0, -1); } $connect = $sqlserver . ($port ? ':' . $port : '') . '/' . $database; } if ($new_link) { if (!function_exists('ocinlogon')) { $this->connect_error = 'ocinlogon function does not exist, is oci extension installed?'; return $this->sql_error(''); } $this->db_connect_id = @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8'); } else { if ($this->persistency) { if (!function_exists('ociplogon')) { $this->connect_error = 'ociplogon function does not exist, is oci extension installed?'; return $this->sql_error(''); } $this->db_connect_id = @ociplogon($this->user, $sqlpassword, $connect, 'UTF8'); } else { if (!function_exists('ocilogon')) { $this->connect_error = 'ocilogon function does not exist, is oci extension installed?'; return $this->sql_error(''); } $this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'); } } return $this->db_connect_id ? $this->db_connect_id : $this->sql_error(''); }
private function _connect($sHost, $sUser, $sPass, $sPort = false, $sPersistent = false) { if ($sPort) { $sHost = $sHost . ':' . $sPort; } if ($hLink = $sPersistent ? @ociplogon($sUser, $sPass, $sHost) : @ocinlogon($sUser, $sPass, $sHost)) { return $hLink; } return false; }
/** * @desc 连接数据库 * @author * @since 2012-06-20 18:30:44 * @throws 注意:无DB异常处理 */ function _ocilogon($DB) { if (!$DB) { return null; } $oracleDB_config = new oracleDB_config(); $dbconfig = $oracleDB_config->dbconfig; $DBS = explode('|', $DB); $DB = $DBS[time() % count($DBS)]; $dbconfiginterface = $dbconfig[$DB]; if (!$dbconfiginterface) { _status(1, VHOST . '(BUG错误)', "SQL错误", "未定义数据库:" . $DB, GET_INCLUDED_FILES, VIP); return null; } $tt1 = microtime(true); $conn_db = ocinlogon($dbconfiginterface['user_name'], $dbconfiginterface['password'], $dbconfiginterface['TNS']); $diff_time = sprintf('%.5f', microtime(true) - $tt1); if (!is_resource($conn_db)) { $err = ocierror(); _status(1, VHOST . '(BUG错误)', "SQL错误", $DB . '@' . $err['message'], GET_INCLUDED_FILES, VIP, $diff_time); return null; } $_SERVER['last_oci_link'][$conn_db] = $DB; return $conn_db; }
ocidefinebyname(); ocierror(); ociexecute(); ocifetch(); ocifetchinto(); ocifetchstatement(); ocifreecollection(); ocifreecursor(); ocifreedesc(); ocifreestatement(); ociinternaldebug(); ociloadlob(); ocilogoff(); ocilogon(); ocinewcollection(); ocinewcursor(); ocinewdescriptor(); ocinlogon(); ocinumcols(); ociparse(); ociplogon(); ociresult(); ocirollback(); ocirowcount(); ocisavelob(); ocisavelobfile(); ociserverversion(); ocisetprefetch(); ocistatementtype(); ociwritelobtofile(); ociwritetemporarylob();