#25389 [Csd]: DB::Pear (sybase.php)
| From: | cesararnold at yahoo dot com dot br | Date: | Mon, 08 Sep 2003 12:06:36 +0000 |
| Subject: | #25389 [Csd]: DB::Pear (sybase.php) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-21177@lists.php.net to get a copy of this message | ||
ID: 25389
User updated by: cesararnold at yahoo dot com dot br
Reported By: cesararnold at yahoo dot com dot br
Status: Closed
Bug Type: PEAR related
Operating System: Win2k
PHP Version: 4.3.2
New Comment:
Thanks to Cox and Php Development Group.
Previous Comments:
------------------------------------------------------------------------
[2003-09-07 06:55:30] cox@php.net
Fixed in CVS thanks, changes will be avaible in the next PEAR DB
release.
------------------------------------------------------------------------
[2003-09-06 01:12:41] cesararnold at yahoo dot com dot br
Description:
------------
I would like to ask you to increase the below lines of code into
sybase.php file from Pear::DB, if possible of course, because when I
try to connect using a DSN including the database name, sybase.php
"connect" function does change to the database informed and I need to
do it calling @sybase_select_db(). the code could be added at
"connect".
A similar code exists on mssql.php class at "connect" function.
So, all times when I update my pear package I need to include it into
sybase.php again.
The code is below:
Thanks for your help.
// }}}
// {{{ 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('sybase') &&
!DB::assertExtension('sybase_ct'))
return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
$this->dsn = $dsninfo;
$user = $dsninfo['username'];
$pw = $dsninfo['password'];
$interface = $dsninfo['hostspec'] ? $dsninfo['hostspec'] :
'localhost';
$connect_function = $persistent ? 'sybase_pconnect' :
'sybase_connect';
if ($interface && $user && $pw) {
$conn = $connect_function($interface, $user, $pw);
} else {
$conn = FALSE;
}
if (!$conn) {
return $this->raiseError(DB_ERROR_CONNECT_FAILED);
}
/////////////// INCLUDE HERE !!! PLEASE /////////////////
if ($dsninfo['database']) {
if (!@sybase_select_db($dsninfo['database'], $conn)) {
return $this->raiseError(DB_ERROR_NODBSELECTED, null,
null, null, sybase_get_last_message());
}
$this->_db = $dsninfo['database'];
}
/////////////// INCLUDE HERE !!! THANKS /////////////////
$this->connection = $conn;
return DB_OK;
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25389&edit=1