|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25389 DB::Pear (sybase.php)
Submitted: 2003-09-06 01:12 UTC Modified: 2003-09-08 08:06 UTC
From: cesararnold at yahoo dot com dot br Assigned:
Status: Closed Package: PEAR related
PHP Version: 4.3.2 OS: Win2k
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: cesararnold at yahoo dot com dot br
New email:
PHP Version: OS:


 [2003-09-06 01:12 UTC] cesararnold at yahoo dot com dot br
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;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-07 06:55 UTC]
Fixed in CVS thanks, changes will be avaible in the next PEAR DB release.
 [2003-09-08 08:06 UTC] cesararnold at yahoo dot com dot br
Thanks to Cox and Php Development Group.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jan 26 23:03:47 2022 UTC