本文整理汇总了PHP中fbsql_select_db函数的典型用法代码示例。如果您正苦于以下问题:PHP fbsql_select_db函数的具体用法?PHP fbsql_select_db怎么用?PHP fbsql_select_db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fbsql_select_db函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: connect
public function connect($config = array())
{
$this->config = $config;
$this->connect = $this->config['pconnect'] === true ? @fbsql_pconnect($this->config['host'], $this->config['user'], $this->config['password']) : @fbsql_connect($this->config['host'], $this->config['user'], $this->config['password']);
if (empty($this->connect)) {
die(getErrorMessage('Database', 'mysqlConnectError'));
}
fbsql_select_db($this->config['database'], $this->connect);
}
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:9,代码来源:FbsqlDriver.php
示例2: SelectDB
function SelectDB($dbName)
{
$this->databaseName = $dbName;
if ($this->_connectionID) {
return @fbsql_select_db($dbName, $this->_connectionID);
} else {
return false;
}
}
开发者ID:BackupTheBerlios,项目名称:facturaphp-svn,代码行数:9,代码来源:adodb-fbsql.inc.php
示例3: connect
/**
* Connect to the database server, log in and open the database
*
* Don't call this method directly. Use DB::connect() instead.
*
* @param array $dsn the data source name
* @param bool $persistent should the connection be persistent?
*
* @return int DB_OK on success. A DB_Error object on failure.
*/
function connect($dsn, $persistent = false)
{
if (!PEAR::loadExtension('fbsql')) {
return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
}
$this->dsn = $dsn;
if ($dsn['dbsyntax']) {
$this->dbsyntax = $dsn['dbsyntax'];
}
$params = array($dsn['hostspec'] ? $dsn['hostspec'] : 'localhost', $dsn['username'] ? $dsn['username'] : null, $dsn['password'] ? $dsn['password'] : null);
$connect_function = $persistent ? 'fbsql_pconnect' : 'fbsql_connect';
$ini = ini_get('track_errors');
$php_errormsg = '';
if ($ini) {
$this->connection = @call_user_func_array($connect_function, $params);
} else {
@ini_set('track_errors', 1);
$this->connection = @call_user_func_array($connect_function, $params);
@ini_set('track_errors', $ini);
}
if (!$this->connection) {
return $this->raiseError(DB_ERROR_CONNECT_FAILED, null, null, null, $php_errormsg);
}
if ($dsn['database']) {
if (!@fbsql_select_db($dsn['database'], $this->connection)) {
return $this->fbsqlRaiseError();
}
}
return DB_OK;
}
开发者ID:roojs,项目名称:pear,代码行数:40,代码来源:fbsql.php
示例4: connect
/**
* Connect to a database and log in as the specified user.
*
* @param $dsn the data source name (see DB::parseDSN for syntax)
* @param $persistent (optional) whether the connection should
* be persistent
* @access public
* @return int DB_OK on success, a DB error on failure
*/
function connect($dsninfo, $persistent = false)
{
if (!DB::assertExtension('fbsql')) {
return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
}
$this->dsn = $dsninfo;
$dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost';
$php_errormsg = '';
$connect_function = $persistent ? 'fbsql_pconnect' : 'fbsql_connect';
if ($dbhost && $dsninfo['username'] && $dsninfo['password']) {
$conn = @$connect_function($dbhost, $dsninfo['username'], $dsninfo['password']);
} elseif ($dbhost && $dsninfo['username']) {
$conn = @$connect_function($dbhost, $dsninfo['username']);
} elseif ($dbhost) {
$conn = @$connect_function($dbhost);
} else {
$conn = false;
}
if (!$conn) {
if (empty($php_errormsg)) {
return $this->raiseError(DB_ERROR_CONNECT_FAILED);
} else {
return $this->raiseError(DB_ERROR_CONNECT_FAILED, null, null, null, $php_errormsg);
}
}
if ($dsninfo['database']) {
if (!fbsql_select_db($dsninfo['database'], $conn)) {
return $this->fbsqlRaiseError();
}
}
$this->connection = $conn;
return DB_OK;
}
开发者ID:ronaldoof,项目名称:geocloud2,代码行数:42,代码来源:fbsql.php
示例5: query
/**
* Send a query to the database and return any results
*
* @access public
*
* @param string $query the SQL query
* @param mixed $types array that contains the types of the columns in
* the result set
*
* @return mixed a result handle or MDB_OK on success, a MDB error on failure
*/
function query($query, $types = NULL)
{
$this->debug("Query: {$query}");
$ismanip = MDB::isManip($query);
$this->last_query = $query;
$first = $this->first_selected_row;
$limit = $this->selected_row_limit;
$this->first_selected_row = $this->selected_row_limit = 0;
$result = $this->connect();
if (MDB::isError($result)) {
return $result;
}
if ($limit > 0) {
if (!$ismanip) {
$query = str_replace('SELECT', "SELECT TOP({$first},{$limit})", $query);
}
}
if ($this->database_name != '') {
if (!@fbsql_select_db($this->database_name, $this->connection)) {
return $this->fbsqlRaiseError();
}
}
// Add ; to the end of the query. This is required by FrontBase
$query .= ';';
if ($result = @fbsql_query($query, $this->connection)) {
if ($ismanip) {
$this->affected_rows = @fbsql_affected_rows($this->connection);
return MDB_OK;
} else {
$result_value = intval($result);
$this->highest_fetched_row[$result_value] = -1;
if ($types != NULL) {
if (!is_array($types)) {
$types = array($types);
}
if (MDB::isError($err = $this->setResultTypes($result, $types))) {
$this->freeResult($result);
return $err;
}
}
return $result;
}
}
return $this->fbsqlRaiseError();
}
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:56,代码来源:fbsql.php
示例6: connect_fbql
function connect_fbql($host, $user, $pass, $db)
{
$this->fbsql_link = fbsql_pconnect($host, $user, $pass);
if ($this->fbsql_link == 0) {
return false;
}
if (!fbsql_select_db($db, $this->fbsql_link)) {
print "Database Error " . msql_error() . "\n";
return false;
}
return $this->fbsql_link;
}
开发者ID:laiello,项目名称:cartonbank,代码行数:12,代码来源:phpMM_V_23_08_2007.php
示例7: array
/**
* Execute a query
* @param string $query query
* @param boolean $is_manip if the query is a manipulation query
* @param resource $connection
* @param string $database_name
* @return result or error object
* @access protected
*/
function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
if ($result) {
if (MDB2::isError($result)) {
return $result;
}
$query = $result;
}
if ($this->options['disable_query']) {
$result = $is_manip ? 0 : null;
return $result;
}
if (null === $connection) {
$connection = $this->getConnection();
if (MDB2::isError($connection)) {
return $connection;
}
}
if (null === $database_name) {
$database_name = $this->database_name;
}
if ($database_name) {
if ($database_name != $this->connected_database_name) {
if (!@fbsql_select_db($database_name, $connection)) {
$err = $this->raiseError(null, null, null, 'Could not select the database: ' . $database_name, __FUNCTION__);
return $err;
}
$this->connected_database_name = $database_name;
}
}
$result = @fbsql_query($query, $connection);
if (!$result) {
$err =& $this->raiseError(null, null, null, 'Could not execute statement', __FUNCTION__);
return $err;
}
$this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'post', 'result' => $result));
return $result;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:49,代码来源:fbsql.php
示例8: _doQuery
/**
* Execute a query
* @param string $query query
* @param boolean $is_manip if the query is a manipulation query
* @param resource $connection
* @param string $database_name
* @return result or error object
* @access protected
*/
function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$this->debug($query, 'query', $is_manip);
if ($this->options['disable_query']) {
if ($is_manip) {
return 0;
}
return null;
}
if (is_null($connection)) {
$connection = $this->getConnection();
if (PEAR::isError($connection)) {
return $connection;
}
}
if (is_null($database_name)) {
$database_name = $this->database_name;
}
if ($database_name) {
if ($database_name != $this->connected_database_name) {
if (!@fbsql_select_db($database_name, $connection)) {
return $this->raiseError();
}
$this->connected_database_name = $database_name;
}
}
$result = @fbsql_query($query, $connection);
if (!$result) {
return $this->raiseError();
}
return $result;
}
开发者ID:ajisantoso,项目名称:kateglo,代码行数:42,代码来源:fbsql.php
注:本文中的fbsql_select_db函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论