php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
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;
    }




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-07 06:55 UTC] cox@php.net
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-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 20:03:34 2021 UTC