|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-09-07 06:55 UTC] cox@php.net
[2003-09-08 08:06 UTC] cesararnold at yahoo dot com dot br
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
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; }