cvs: pear /MDB2/MDB2/Driver ibase.php
| From: | Lukas Smith | Date: | Fri, 17 Mar 2006 16:11:31 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver ibase.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39155@lists.php.net to get a copy of this message | ||
lsmith Fri Mar 17 16:11:31 2006 UTC
Modified files:
/pear/MDB2/MDB2/Driver ibase.php
Log:
- allow explicit definition of server_version
http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/ibase.php?r1=1.142&r2=1.143&diff_format=u
Index: pear/MDB2/MDB2/Driver/ibase.php
diff -u pear/MDB2/MDB2/Driver/ibase.php:1.142 pear/MDB2/MDB2/Driver/ibase.php:1.143
--- pear/MDB2/MDB2/Driver/ibase.php:1.142 Fri Mar 17 08:47:21 2006
+++ pear/MDB2/MDB2/Driver/ibase.php Fri Mar 17 16:11:31 2006
@@ -43,7 +43,7 @@
// | Author: Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
-// $Id: ibase.php,v 1.142 2006/03/17 08:47:21 lsmith Exp $
+// $Id: ibase.php,v 1.143 2006/03/17 16:11:31 lsmith Exp $
/**
* MDB2 FireBird/InterBase driver
@@ -96,6 +96,7 @@
$this->options['database_path'] = '';
$this->options['database_extension'] = '.gdb';
$this->options['default_text_field_length'] = 4096;
+ $this->options['server_version'] = '';
}
// }}}
@@ -559,14 +560,23 @@
*/
function getServerVersion($native = false)
{
- $ibserv = @ibase_service_attach($this->dsn['hostspec'],
$this->options['DBA_username'], $this->options['DBA_password']);
- $server_info = @ibase_server_info($ibserv, IBASE_SVC_SERVER_VERSION);
- @ibase_service_detach($ibserv);
+ $server_info = false;
+ if ($this->options['server_version']) {
+ $server_info = $this->options['server_version'];
+ } elseif ($this->options['DBA_username']) {
+ $ibserv = @ibase_service_attach($this->dsn['hostspec'],
$this->options['DBA_username'], $this->options['DBA_password']);
+ $server_info = @ibase_server_info($ibserv, IBASE_SVC_SERVER_VERSION);
+ @ibase_service_detach($ibserv);
+ }
+ if (!$server_info) {
+ return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
+ 'getServerVersion: Requires either "server_version" or
"DBA_username"/"DBA_password" option');
+ }
if (!$native) {
//WI-V1.5.3.4854 Firebird 1.5
if (!preg_match('/-V([\d\.]*)/', $server_info, $matches)) {
return $this->raiseError(MDB2_ERROR, null, null,
- 'Could not parse version information:'.$server_info);
+ 'getServerVersion: Could not parse version
information:'.$server_info);
}
$tmp = explode('.', $matches[1], 4);
$server_info = array(