本文整理汇总了PHP中ibase_connect函数的典型用法代码示例。如果您正苦于以下问题:PHP ibase_connect函数的具体用法?PHP ibase_connect怎么用?PHP ibase_connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ibase_connect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
/**
*@package db_firebird
*@method connect()
*@desc Open a connection to a Firebird/Interbase DB
*@since v0.3.1
* */
public static function connect($p_host = NULL, $p_user = NULL, $p_pass = NULL, $p_db = NULL)
{
$H = isset($p_host) ? $p_host : self::$host;
$U = isset($p_user) ? $p_user : self::$user;
$P = isset($p_pass) ? $p_pass : self::$pass;
$D = isset($p_db) ? $p_db : self::$database;
$connection = @ibase_connect($H . ':' . $D, $U, $P);
if ($connection == FALSE) {
try {
throw new FkException("Error al conectar a la db ");
} catch (FkException $e) {
$e->description = 'Firebird/Interbase Respondió:' . ibase_errmsg() . '</b>';
$e->solution = 'Verifique la conexion, posiblemente el archivo /app/config/environment.ini no contiene los datos de conexion correctos. Vea ejemplo:';
$e->solution_code = fk_str_format('[development]
db_host = localhost
db_username = tester
db_password = test
db_name = freekore_dev
db_type = firebird', 'html');
$e->error_code = 'DB000002';
$e->show('code_help');
}
} else {
self::$is_connected = true;
}
}
示例2: connect
public function connect(array $params)
{
$host = $params["host"] . ":" . $params["database"];
$enc = isset($params["charset"]) ? $params["charset"] : null;
$conn = ibase_connect($host, $params["user"], $params["password"], $enc);
return $conn ? $conn : ibase_errmsg();
}
示例3: connect
public function connect($hostname, $database, $username, $password, $port = 3050)
{
$this->connection = ibase_connect($hostname . "/" . $port . ":" . $database, $username, $password);
if (!$this->connection) {
throw new Exception(ibase_errmsg());
}
}
示例4: Open
function Open()
{
$this->link_id = ibase_connect($this->Host, $this->UserName, $this->Password);
if (!$this->link_id) {
$this->ErrorCode = 1;
$this->ErrorMsg = "Host를 연결할 수가 없습니다.";
}
}
示例5: 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'));
}
}
示例6: connect
/**
* Connects to the database.
*
* This function connects to a ibase database
*
* @param string $host
* @param string $username
* @param string $password
* @param string $db_name
* @return boolean true, if connected, otherwise false
* @access public
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
* @since 2005-04-16
*/
function connect($host, $user, $passwd, $db)
{
$this->conn = ibase_connect($db, $user, $passwd);
if (false == $this->conn) {
PMF_Db::errorPage(ibase_errmsg());
die;
}
return true;
}
示例7: 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('');
}
示例8: 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());
}
}
}
示例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 = $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('');
}
示例10: Buscar
function Buscar($q)
{
$conn = ibase_connect($this->src, $this->user, $this->password);
$query = "SELECT INVE03.CVE_ART, INVE03.DESCR FROM inve03 where INVE03.DESCR LIKE '%" . $q . "%' AND INVE03.STATUS='A' OR INVE03.CVE_ART LIKE '%" . $q . "%' AND INVE03.STATUS='A' ORDER BY INVE03.CVE_ART";
$inv = ibase_query($conn, $query);
print "<table width='100%' border='0' cellspacing='0' cellpadding='0' style='font-family:Verdana; font-size:10; font-color:#CDCD'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td></td>\n\t\t\t\t</tr>";
while ($IN = ibase_fetch_row($inv)) {
print "<tr>" . "<td>" . $IN[1] . "</td>" . "<td><input style='border:0; background-color: #f9f9f9; font-family:Verdana; font-size:10; font-color:#CDCD; cursor:pointer' type='submit' id='valor2' value='" . $IN[0] . "' onClick='Resultado(\"" . $IN[0] . "\");'/></td>" . "</tr>";
}
print "</table>";
}
示例11: connect
function connect()
{
if ($this->linkId == 0) {
$this->linkId = ibase_connect($this->dbHost . ":" . $this->dbName, $this->dbUser, $this->dbPass, 'ISO8859_1', 0, 3);
if (!$this->linkId) {
$this->updateError('DB::connect()<br />ibase_pconnect');
return false;
}
}
return true;
}
示例12: DbSimple_Ibase
/**
* constructor(string $dsn)
* Connect to Interbase/Firebird.
*/
function DbSimple_Ibase($dsn)
{
$p = DbSimple_Generic::parseDSN($dsn);
if (!is_callable('ibase_connect')) {
return $this->_setLastError("-1", "Interbase/Firebird extension is not loaded", "ibase_connect");
}
$ok = $this->link = ibase_connect($p['host'] . (empty($p['port']) ? "" : ":" . $p['port']) . ':' . preg_replace('{^/}s', '', $p['path']), $p['user'], $p['pass'], isset($p['CHARSET']) ? $p['CHARSET'] : 'win1251', isset($p['BUFFERS']) ? $p['BUFFERS'] : 0, isset($p['DIALECT']) ? $p['DIALECT'] : 3, isset($p['ROLE']) ? $p['ROLE'] : '');
$this->_resetLastError();
if (!$ok) {
return $this->_setDbError('ibase_connect()');
}
}
示例13: __construct
/**
* Interbase constructor.
* @param null $database
* @param null $username
* @param null $password
* @param null $charset
* @param null $buffers
* @param null $dialect
* @param null $role
* @param null $sync
*/
public function __construct($database = null, $username = null, $password = null, $charset = null, $buffers = null, $dialect = null, $role = null, $sync = null)
{
$this->database = $database;
$this->username = $username;
$this->password = $password;
$this->charset = $charset;
$this->buffers = $buffers;
$this->dialect = $dialect;
$this->role = $role;
$this->sync = $sync;
$this->resource = ibase_connect($database, $username, $password, $charset, $buffers, $dialect, $role, $sync);
}
示例14: connect
function connect($server, $username, $password)
{
$this->_link = ibase_connect($server, $username, $password);
if ($this->_link) {
$url_parts = explode(':', $server);
$this->service_link = ibase_service_attach($url_parts[0], $username, $password);
$this->server_info = ibase_server_info($this->service_link, IBASE_SVC_SERVER_VERSION);
} else {
$this->errno = ibase_errcode();
$this->error = ibase_errmsg();
}
return (bool) $this->_link;
}
示例15: 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;
}