cvs: pear /MDB2/MDB2/Driver sqlite.php

From: Date: Sat, 25 Mar 2006 10:38:22 +0000
Subject: cvs: pear /MDB2/MDB2/Driver sqlite.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-39306@lists.php.net to get a copy of this message
lsmith Sat Mar 25 10:38:22 2006 UTC Modified files: /pear/MDB2/MDB2/Driver sqlite.php Log: - added 'server_version' option - use connected_server_info in getServerVersion() as a cache cache - use parent::disconnect() in disconnect() http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/sqlite.php?r1=1.102&r2=1.103&diff_format=u Index: pear/MDB2/MDB2/Driver/sqlite.php diff -u pear/MDB2/MDB2/Driver/sqlite.php:1.102 pear/MDB2/MDB2/Driver/sqlite.php:1.103 --- pear/MDB2/MDB2/Driver/sqlite.php:1.102 Fri Mar 17 08:47:21 2006 +++ pear/MDB2/MDB2/Driver/sqlite.php Sat Mar 25 10:38:22 2006 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.102 2006/03/17 08:47:21 lsmith Exp $ +// $Id: sqlite.php,v 1.103 2006/03/25 10:38:22 lsmith Exp $ // /** @@ -94,6 +94,7 @@ $this->options['fixed_float'] = 0; $this->options['database_path'] = ''; $this->options['database_extension'] = ''; + $this->options['server_version'] = ''; } // }}} @@ -353,10 +354,8 @@ if (!$this->opened_persistent || $force) { @sqlite_close($this->connection); } - $this->connection = 0; - $this->in_transaction = false; } - return MDB2_OK; + return parent::disconnect($force); } // }}} @@ -498,10 +497,20 @@ */ function getServerVersion($native = false) { - if (!function_exists('sqlite_libversion')) { - return parent::getServerVersion($native); + $server_info = false; + if ($this->connected_server_info) { + $server_info = $this->connected_server_info; + } elseif ($this->options['server_version']) { + $server_info = $this->options['server_version']; + } elseif (function_exists('sqlite_libversion')) { + $server_info = @sqlite_libversion(); + } + if (!$server_info) { + return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'getServerVersion: Requires either the "server_version" option or the sqlite_libversion() function'); } - $server_info = sqlite_libversion(); + // cache server_info + $this->connected_server_info = $server_info; if (!$native) { $tmp = explode('.', $server_info, 3); $server_info = array(

« previous php.pear.cvs (#39306) next »