"An error occurred while connecting to the database ". "'{$db}'. The error reported by the server was: ".$e->getMessage() ) ); exit(0); } return $pdo; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Protected methods */ protected function _prepare( $sql ) { $this->database()->debugInfo( $sql, $this->_bindings ); $resource = $this->database()->resource(); $this->_stmt = $resource->prepare( $sql ); // bind values for ( $i=0 ; $i_bindings) ; $i++ ) { $binding = $this->_bindings[$i]; $this->_stmt->bindValue( $binding['name'], $binding['value'], $binding['type'] ? $binding['type'] : \PDO::PARAM_STR ); } } protected function _exec() { try { $this->_stmt->execute(); } catch (PDOException $e) { throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); error_log( "An SQL error occurred: ".$e->getMessage() ); return false; } $resource = $this->database()->resource(); return new SqliteResult( $resource, $this->_stmt ); } }