39                           'persistent' => 
false);
 
   76         $this->_id = md5(microtime());
 
   77         $this->_table = $name;
 
   78         $this->_ident = $ident;
 
   81         if (is_array($conf)) {
 
   82             foreach ($conf as $k => $opt) {
 
   83                 $this->_options[$k] = $opt;
 
   88             $this->_existingConnection = 
true;
 
  101         if (is_resource($this->_db)) {
 
  102             $this->_opened = 
true;
 
  106             if (empty($this->_options[
'persistent'])) {
 
  107                 $connectFunction = 
'sqlite_open';
 
  109                 $connectFunction = 
'sqlite_popen';
 
  113             if ($this->_db = $connectFunction($this->_options[
'filename'],
 
  114                                               (
int)$this->_options[
'mode'],
 
  116                 $this->_opened = 
true;
 
  135         if ($this->_existingConnection) {
 
  139         if ($this->_opened) {
 
  140             $this->_opened = 
false;
 
  141             sqlite_close($this->_db);
 
  144         return ($this->_opened === 
false);
 
  160     function log($message, $priority = null)
 
  163         if ($priority === null) {
 
  173         if (!$this->_opened && !$this->
open()) {
 
  181         $q = sprintf(
'INSERT INTO [%s] (logtime, ident, priority, message) ' .
 
  182                      "VALUES ('%s', '%s', %d, '%s')",
 
  184                      strftime(
'%Y-%m-%d %H:%M:%S', time()),
 
  185                      sqlite_escape_string($this->_ident),
 
  187                      sqlite_escape_string($message));
 
  188         if (!(
$res = @sqlite_unbuffered_query($this->_db, $q))) {
 
  191         $this->
_announce(array(
'priority' => $priority, 
'message' => $message));
 
  204         $q = 
"SELECT name FROM sqlite_master WHERE name='" . $this->_table .
 
  205              "' AND type='table'";
 
  207         $res = sqlite_query($this->_db, $q);
 
  209         if (sqlite_num_rows(
$res) == 0) {
 
  210             $q = 
'CREATE TABLE [' . $this->_table . 
'] (' .
 
  211                  'id INTEGER PRIMARY KEY NOT NULL, ' .
 
  212                  'logtime NOT NULL, ' .
 
  213                  'ident CHAR(16) NOT NULL, ' .
 
  214                  'priority INT NOT NULL, ' .
 
  217             if (!(
$res = sqlite_unbuffered_query($this->_db, $q))) {