本文整理汇总了PHP中ibase_pconnect函数的典型用法代码示例。如果您正苦于以下问题:PHP ibase_pconnect函数的具体用法?PHP ibase_pconnect怎么用?PHP ibase_pconnect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ibase_pconnect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
public function connect($config = array())
{
$this->config = $config;
$this->connect = $this->config['pconnect'] === true ? @ibase_pconnect($this->config['host'] . ':' . $this->config['database'], $this->config['user'], $this->config['password'], $this->config['charset']) : @ibase_connect($this->config['host'] . ':' . $this->config['database'], $this->config['user'], $this->config['password'], $this->config['charset']);
if (empty($this->connect)) {
die(getErrorMessage('Database', 'mysqlConnectError'));
}
}
示例2: sql_connect
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 ? @ibase_pconnect($this->server . ':' . $this->dbname, $this->user, $sqlpassword, false, false, 3) : @ibase_connect($this->server . ':' . $this->dbname, $this->user, $sqlpassword, false, false, 3);
return $this->db_connect_id ? $this->db_connect_id : $this->sql_error('');
}
示例3: connect
protected function connect()
{
if ($this->lnk === null) {
$this->lnk = $this->settings->persist ? @\ibase_pconnect($this->settings->servername . $this->settings->database, $this->settings->username, $this->settings->password, strtoupper($this->settings->charset)) : @\ibase_connect($this->settings->servername . $this->settings->database, $this->settings->username, $this->settings->password, strtoupper($this->settings->charset));
if ($this->lnk === false) {
throw new DatabaseException('Connect error: ' . \ibase_errmsg());
}
}
}
示例4: sql_connect
/**
* 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;
$this->db_connect_id = $this->persistency ? @ibase_pconnect($this->server . ':' . $this->dbname, $this->user, $sqlpassword, false, false, 3) : @ibase_connect($this->server . ':' . $this->dbname, $this->user, $sqlpassword, false, false, 3);
$this->service_handle = function_exists('ibase_service_attach') ? @ibase_service_attach($this->server, $this->user, $sqlpassword) : false;
return $this->db_connect_id ? $this->db_connect_id : $this->sql_error('');
}
示例5: dbConnect
/** Métodos de Conexión y Consulta a la BD
*
*/
function dbConnect()
{
//C:\Archivos de programa\Archivos comunes\Aspel\Sistemas Aspel\CAJA3.50\Datos
$DB = "C:\\Archivos de programa\\Archivos comunes\\Aspel\\Sistemas Aspel\\CAJA3.50\\Ejemplos\\Ejemplos.FDB";
//Voy a utilizar el login y el password que trae Interbase por defecto.
$User = "sysdba";
$Pass = "masterkey";
//"Prueba de conexión a la bd";
$cxn = ibase_pconnect($DB, $User, $Pass) or die("Error al conectarse a la base de datos");
return $cxn;
}
示例6: connect
/**
* @see ILumine_Connection::connect()
*/
public function connect()
{
if ($this->conn_id && $this->state == self::OPEN) {
Lumine_Log::debug('Utilizando conexao cacheada com ' . $this->getDatabase());
return true;
}
$this->dispatchEvent(new Lumine_ConnectionEvent(Lumine_Event::PRE_CONNECT, $this));
$hostString = $this->getHost();
if ($this->getPort() != '') {
// nao colocamos a porta uma vez que a string de conexao
// nao suporta a informacao da porta
//$hostString .= ':' . $this->getPort();
}
$hostString = empty($hostString) ? $this->getDatabase() : $hostString . ':' . $this->getDatabase();
if (isset($this->options['socket']) && $this->options['socket'] != '') {
$hostString .= ':' . $this->options['socket'];
}
$flags = isset($this->options['flags']) ? $this->options['flags'] : null;
if (isset($this->options['persistent']) && $this->options['persistent'] == true) {
Lumine_Log::debug('Criando conexao persistente com ' . $this->getDatabase());
$this->conn_id = @ibase_pconnect($hostString, $this->getUser(), $this->getPassword());
} else {
Lumine_Log::debug('Criando conexao com ' . $this->getDatabase());
$this->conn_id = @ibase_connect($hostString, $this->getUser(), $this->getPassword());
}
if (!$this->conn_id) {
$this->state = self::CLOSED;
$msg = 'Nao foi possivel conectar no banco de dados: ' . $this->getDatabase() . ' - ' . $this->getErrorMsg();
Lumine_Log::error($msg);
$this->dispatchEvent(new Lumine_ConnectionEvent(Lumine_Event::CONNECTION_ERROR, $this, $msg));
throw new Exception($msg);
return false;
}
if (function_exists('ibase_timefmt')) {
ibase_timefmt($this->ibase_datefmt, IBASE_DATE);
if ($this->dialect == 1) {
ibase_timefmt($this->ibase_datefmt, IBASE_TIMESTAMP);
} else {
ibase_timefmt($this->ibase_timestampfmt, IBASE_TIMESTAMP);
}
ibase_timefmt($this->ibase_timefmt, IBASE_TIME);
} else {
ini_set("ibase.timestampformat", $this->ibase_timestampfmt);
ini_set("ibase.dateformat", $this->ibase_datefmt);
ini_set("ibase.timeformat", $this->ibase_timefmt);
}
$this->state = self::OPEN;
$this->dispatchEvent(new Lumine_ConnectionEvent(Lumine_Event::POS_CONNECT, $this));
$this->setCharset($this->getCharset());
return true;
}
示例7: dbQuery
function dbQuery($query, $show_errors = true, $all_results = true, $show_output = true)
{
if ($show_errors) {
error_reporting(E_ALL);
} else {
error_reporting(E_PARSE);
}
// Connect to the Firebird/Interbase Sybase database management system
$link = ibase_pconnect("/var/www/sqlmap/dbs/firebird/testdb.fdb", "SYSDBA", "testpass");
if (!$link) {
die(ibase_errmsg());
}
// Print results in HTML
print "<html><body>\n";
// Print SQL query to test sqlmap '--string' command line option
//print "<b>SQL query:</b> " . $query . "<br>\n";
// Perform SQL injection affected query
$result = ibase_query($link, $query);
if (!$result) {
if ($show_errors) {
print "<b>SQL error:</b> " . ibase_errmsg() . "<br>\n";
}
exit(1);
}
print "<b>SQL results:</b>\n";
print "<table border=\"1\">\n";
while ($line = ibase_fetch_assoc($result)) {
// This must stay here for Firebird
if (!$show_output) {
exit(1);
}
print "<tr>";
foreach ($line as $col_value) {
print "<td>" . $col_value . "</td>";
}
print "</tr>\n";
if (!$all_results) {
break;
}
}
print "</table>\n";
print "</body></html>";
}
示例8: connect
/**
* Connects to a database.
* @return void
* @throws Dibi\Exception
*/
public function connect(array &$config)
{
Dibi\Helpers::alias($config, 'database', 'db');
if (isset($config['resource'])) {
$this->connection = $config['resource'];
} else {
// default values
$config += ['username' => ini_get('ibase.default_password'), 'password' => ini_get('ibase.default_user'), 'database' => ini_get('ibase.default_db'), 'charset' => ini_get('ibase.default_charset'), 'buffers' => 0];
if (empty($config['persistent'])) {
$this->connection = @ibase_connect($config['database'], $config['username'], $config['password'], $config['charset'], $config['buffers']);
// intentionally @
} else {
$this->connection = @ibase_pconnect($config['database'], $config['username'], $config['password'], $config['charset'], $config['buffers']);
// intentionally @
}
if (!is_resource($this->connection)) {
throw new Dibi\DriverException(ibase_errmsg(), ibase_errcode());
}
}
}
示例9: sql_connect
/**
* 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 = str_replace('\\', '/', $database);
// There are three possibilities to connect to an interbase db
if (!$this->server) {
$use_database = $this->dbname;
} else {
if (strpos($this->server, '//') === 0) {
$use_database = $this->server . $this->dbname;
} else {
$use_database = $this->server . ':' . $this->dbname;
}
}
$this->db_connect_id = $this->persistency ? @ibase_pconnect($use_database, $this->user, $sqlpassword, false, false, 3) : @ibase_connect($use_database, $this->user, $sqlpassword, false, false, 3);
$this->service_handle = function_exists('ibase_service_attach') && $this->server ? @ibase_service_attach($this->server, $this->user, $sqlpassword) : false;
return $this->db_connect_id ? $this->db_connect_id : $this->sql_error('');
}
示例10: connect
/**
* Connect
*
* @param bool reconnect default FALSE
* @return bool success
* @throws rdbms.SQLConnectException
*/
public function connect($reconnect = FALSE)
{
if (is_resource($this->handle)) {
return TRUE;
}
// Already connected
if (!$reconnect && FALSE === $this->handle) {
return FALSE;
}
// Previously failed connecting
$db = $this->dsn->getHost() . ':' . $this->dsn->getDatabase();
if ($this->flags & DB_PERSISTENT) {
$this->handle = ibase_pconnect($db, $this->dsn->getUser(), $this->dsn->getPassword(), 'ISO8859_1');
} else {
$this->handle = ibase_connect($db, $this->dsn->getUser(), $this->dsn->getPassword(), 'ISO8859_1');
}
if (!is_resource($this->handle)) {
throw new SQLConnectException(trim(ibase_errmsg()), $this->dsn);
}
$this->_obs && $this->notifyObservers(new DBEvent(__FUNCTION__, $reconnect));
return TRUE;
}
示例11: connect
/**
* Connects to a database.
* @return void
* @throws DibiException
*/
public function connect(array &$config)
{
DibiConnection::alias($config, 'database', 'db');
if (isset($config['resource'])) {
$this->connection = $config['resource'];
} else {
// default values
if (!isset($config['username'])) {
$config['username'] = ini_get('ibase.default_password');
}
if (!isset($config['password'])) {
$config['password'] = ini_get('ibase.default_user');
}
if (!isset($config['database'])) {
$config['database'] = ini_get('ibase.default_db');
}
if (!isset($config['charset'])) {
$config['charset'] = ini_get('ibase.default_charset');
}
if (!isset($config['buffers'])) {
$config['buffers'] = 0;
}
DibiDriverException::tryError();
if (empty($config['persistent'])) {
$this->connection = ibase_connect($config['database'], $config['username'], $config['password'], $config['charset'], $config['buffers']);
// intentionally @
} else {
$this->connection = ibase_pconnect($config['database'], $config['username'], $config['password'], $config['charset'], $config['buffers']);
// intentionally @
}
if (DibiDriverException::catchError($msg)) {
throw new DibiDriverException($msg, ibase_errcode());
}
if (!is_resource($this->connection)) {
throw new DibiDriverException(ibase_errmsg(), ibase_errcode());
}
}
}
示例12: sql_connect
/**
* 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 = str_replace('\\', '/', $database);
// There are three possibilities to connect to an interbase db
if (!$this->server) {
$use_database = $this->dbname;
} else {
if (strpos($this->server, '//') === 0) {
$use_database = $this->server . $this->dbname;
} else {
$use_database = $this->server . ':' . $this->dbname;
}
}
if ($this->persistency) {
if (!function_exists('ibase_pconnect')) {
$this->connect_error = 'ibase_pconnect function does not exist, is interbase extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @ibase_pconnect($use_database, $this->user, $sqlpassword, false, false, 3);
} else {
if (!function_exists('ibase_connect')) {
$this->connect_error = 'ibase_connect function does not exist, is interbase extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @ibase_connect($use_database, $this->user, $sqlpassword, false, false, 3);
}
// Do not call ibase_service_attach if connection failed,
// otherwise error message from ibase_(p)connect call will be clobbered.
if ($this->db_connect_id && function_exists('ibase_service_attach') && $this->server) {
$this->service_handle = @ibase_service_attach($this->server, $this->user, $sqlpassword);
} else {
$this->service_handle = false;
}
return $this->db_connect_id ? $this->db_connect_id : $this->sql_error('');
}
示例13: Connect
function Connect()
{
if (!$this->intConn) {
if ($this->intDebug) {
echo "Establishing connection...\t\t\n";
}
if ($this->intUsePersistent) {
$this->intConn = @ibase_pconnect($this->strHost . ':' . $this->strDatabase, $this->strUser, $this->strPassword) or die("Error:" . ibase_errmsg() . "<br>\n");
} else {
$this->intConn = @ibase_connect($this->strHost . ':' . $this->strDatabase, $this->strUser, $this->strPassword) or die("Error:" . ibase_errmsg() . "<br>\n");
}
}
if (!$this->intConn) {
if ($this->intDebug) {
echo "Error establishing connection!\n";
}
} else {
if ($this->intDebug) {
echo "Connection established!<br>";
}
}
return $this->intConn;
}
示例14: connect
/**
* Connect
*
* @param bool reconnect default FALSE
* @return bool success
* @throws rdbms.SQLConnectException
*/
public function connect($reconnect = false)
{
if (is_resource($this->handle)) {
return true;
}
// Already connected
if (!$reconnect && false === $this->handle) {
return false;
}
// Previously failed connecting
$this->_obs && $this->notifyObservers(new \rdbms\DBEvent(\rdbms\DBEvent::CONNECT, $reconnect));
$db = $this->dsn->getHost() . ':' . $this->dsn->getDatabase();
if ($this->flags & DB_PERSISTENT) {
$this->handle = ibase_pconnect($db, $this->dsn->getUser(), $this->dsn->getPassword(), 'UTF_8');
} else {
$this->handle = ibase_connect($db, $this->dsn->getUser(), $this->dsn->getPassword(), 'UTF_8');
}
if (!is_resource($this->handle)) {
throw new \rdbms\SQLConnectException(trim(ibase_errmsg()), $this->dsn);
}
$this->_obs && $this->notifyObservers(new \rdbms\DBEvent(\rdbms\DBEvent::CONNECTED, $reconnect));
return true;
}
示例15: gcms_pconnect
function gcms_pconnect($server, $user, $password, $database)
{
global $fbdb;
$fbdb = ibase_pconnect("{$server}:{$database}", $user, $password, '', 0, 3);
return $fbdb;
}