本文整理汇总了PHP中ibase_service_detach函数的典型用法代码示例。如果您正苦于以下问题:PHP ibase_service_detach函数的具体用法?PHP ibase_service_detach怎么用?PHP ibase_service_detach使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ibase_service_detach函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
/**
+----------------------------------------------------------
* 连接数据库方法
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function connect($config = '', $linkNum = 0)
{
if (!isset($this->linkID[$linkNum])) {
if (empty($config)) {
$config = $this->config;
}
$conn = $this->pconnect ? 'ibase_pconnect' : 'ibase_connect';
$this->linkID[$linkNum] = $conn($config['hostname'] . '/' . $config['hostport'] . ':' . $config['database'], $config['username'], $config['password']);
if (!$this->linkID[$linkNum]) {
throw_exception(ibase_errmsg());
return False;
}
//剑雷 2007.12.28
if (($svc = ibase_service_attach($config['hostname'], $config['username'], $config['password'])) != FALSE) {
$ibase_info = ibase_server_info($svc, IBASE_SVC_SERVER_VERSION) . '/' . ibase_server_info($svc, IBASE_SVC_IMPLEMENTATION);
ibase_service_detach($svc);
} else {
$ibase_info = 'Unable to Determine';
}
$this->dbVersion = $ibase_info;
// 标记连接成功
$this->connected = true;
// 注销数据库连接配置信息
if (1 != C('DB_DEPLOY_TYPE')) {
unset($this->config);
}
}
return $this->linkID[$linkNum];
}
示例2: _backup
/**
* Export
*
* @param string $filename
* @return mixed
*/
protected function _backup($filename)
{
if ($service = ibase_service_attach($this->db->hostname, $this->db->username, $this->db->password)) {
$res = ibase_backup($service, $this->db->database, $filename . '.fbk');
// Close the service connection
ibase_service_detach($service);
return $res;
}
return FALSE;
}
示例3: version
/**
* Database version number
*
* @return string
*/
public function version()
{
if (isset($this->data_cache['version'])) {
return $this->data_cache['version'];
}
if ($service = ibase_service_attach($this->hostname, $this->username, $this->password)) {
$this->data_cache['version'] = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
// Don't keep the service open
ibase_service_detach($service);
return $this->data_cache['version'];
}
return FALSE;
}
示例4: _sql_close
/**
* Close sql connection
* @access private
*/
function _sql_close()
{
if ($this->service_handle !== false) {
@ibase_service_detach($this->service_handle);
}
return @ibase_close($this->db_connect_id);
}
示例5: _connect
/**
* @brief DB 접속
**/
function _connect()
{
// db 정보가 없으면 무시
if (!$this->hostname || !$this->port || !$this->userid || !$this->password || !$this->database) {
return;
}
//if(strpos($this->hostname, ':')===false && $this->port) $this->hostname .= ':'.$this->port;
// 접속시도
$host = $this->hostname . "/" . $this->port . ":" . $this->database;
$this->fd = @ibase_connect($host, $this->userid, $this->password);
if (ibase_errmsg()) {
$this->setError(ibase_errcode(), ibase_errmsg());
return $this->is_connected = false;
}
// Firebird 버전 확인후 2.0 이하면 오류 표시
if (($service = ibase_service_attach($this->hostname, $this->userid, $this->password)) != FALSE) {
// get server version and implementation strings
$server_info = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
ibase_service_detach($service);
} else {
$this->setError(ibase_errcode(), ibase_errmsg());
@ibase_close($this->fd);
return $this->is_connected = false;
}
$pos = strpos($server_info, "Firebird");
if ($pos !== false) {
$ver = substr($server_info, $pos + strlen("Firebird"));
$ver = trim($ver);
}
if ($ver < "2.0") {
$this->setError(-1, "XE cannot be installed under the version of firebird 2.0. Current firebird version is " . $ver);
@ibase_close($this->fd);
return $this->is_connected = false;
}
// 접속체크
$this->is_connected = true;
}
示例6: getServerVersion
/**
* return version information about the server
*
* @param bool $native determines if the raw version string should be returned
* @return mixed array/string with version information or MDB2 error object
* @access public
*/
function getServerVersion($native = false)
{
$server_info = false;
if ($this->connected_server_info) {
$server_info = $this->connected_server_info;
} elseif ($this->options['server_version']) {
$server_info = $this->options['server_version'];
} else {
$username = $this->options['DBA_username'] ? $this->options['DBA_username'] : $this->dsn['username'];
$password = $this->options['DBA_password'] ? $this->options['DBA_password'] : $this->dsn['password'];
$ibserv = @ibase_service_attach($this->dsn['hostspec'], $username, $password);
$server_info = @ibase_server_info($ibserv, IBASE_SVC_SERVER_VERSION);
@ibase_service_detach($ibserv);
}
if (!$server_info) {
return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'Requires either "server_version" or "DBA_username"/"DBA_password" option', __FUNCTION__);
}
// cache server_info
$this->connected_server_info = $server_info;
if (!$native) {
//WI-V1.5.3.4854 Firebird 1.5
//WI-T2.1.0.16780 Firebird 2.1 Beta 2
if (!preg_match('/-[VT]([\\d\\.]*)/', $server_info, $matches)) {
return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'Could not parse version information:' . $server_info, __FUNCTION__);
}
$tmp = explode('.', $matches[1], 4);
$server_info = array('major' => isset($tmp[0]) ? $tmp[0] : null, 'minor' => isset($tmp[1]) ? $tmp[1] : null, 'patch' => isset($tmp[2]) ? $tmp[2] : null, 'extra' => isset($tmp[3]) ? $tmp[3] : null, 'native' => $server_info);
}
return $server_info;
}
示例7: _version
/**
* Version number query string
*
* @access public
* @return string
*/
function _version()
{
if (($svc = ibase_service_attach($this->hostname, $this->username, $this->password)) != FALSE) {
$ibase_info = ibase_server_info($svc, IBASE_SVC_SERVER_VERSION) . '/' . ibase_server_info($svc, IBASE_SVC_IMPLEMENTATION);
ibase_service_detach($svc);
} else {
$ibase_info = 'Unable to Determine';
}
return $ibase_info;
}
示例8: getServerVersion
/**
* Retrieve server version in PHP style
*
* @return string
*/
public function getServerVersion()
{
$this->_connect();
$service = ibase_service_attach($this->_formatDbConnString($this->_config['host'], $this->_config['port'], ''), $this->_config['username'], $this->_config['password']);
if ($service != FALSE) {
$server_info = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
ibase_service_detach($service);
$matches = null;
if (preg_match('/((?:[0-9]{1,2}\\.){1,3}[0-9]{1,2})/', $server_info, $matches)) {
return $matches[1];
} else {
return null;
}
} else {
return null;
}
}
示例9: backup
public function backup($filename = '')
{
if ($service = ibase_service_attach($this->config['host'], $this->config['user'], $this->config['password'])) {
$backup = ibase_backup($service, $this->config['database'], $filename . '.fbk');
ibase_service_detach($service);
return $backup;
}
return false;
}