/**
  * Database object constructor
  *
  * @param   array  $options  List of options used to configure the connection
  *
  * @since	12.1
  */
 public function __construct($options)
 {
     $options['host'] = isset($options['host']) ? $options['host'] : 'localhost';
     $options['user'] = isset($options['user']) ? $options['user'] : '';
     $options['password'] = isset($options['password']) ? $options['password'] : '';
     $options['database'] = isset($options['database']) ? $options['database'] : '';
     // Finalize initialization
     parent::__construct($options);
 }
 /**
  * Constructor.
  *
  * @param   array  $options  List of options used to configure the connection
  *
  * @since   12.1
  */
 public function __construct($options)
 {
     // Get some basic values from the options.
     $options['host'] = isset($options['host']) ? $options['host'] : 'localhost';
     $options['user'] = isset($options['user']) ? $options['user'] : '';
     $options['password'] = isset($options['password']) ? $options['password'] : '';
     $options['database'] = isset($options['database']) ? $options['database'] : '';
     $options['select'] = isset($options['select']) ? (bool) $options['select'] : true;
     // Finalize initialisation
     parent::__construct($options);
 }
 /**
  * Sets the SQL statement string for later execution.
  *
  * @param   mixed    $query          The SQL statement to set either as a FOFDatabaseQuery object or a string.
  * @param   integer  $offset         The affected row offset to set.
  * @param   integer  $limit          The maximum affected rows to set.
  * @param   array    $driverOptions  The optional PDO driver options.
  *
  * @return  FOFDatabaseDriver  This object to support method chaining.
  *
  * @since   12.1
  */
 public function setQuery($query, $offset = null, $limit = null, $driverOptions = array())
 {
     $this->connect();
     $this->freeResult();
     if (is_string($query)) {
         // Allows taking advantage of bound variables in a direct query:
         $query = $this->getQuery(true)->setQuery($query);
     }
     if ($query instanceof FOFDatabaseQueryLimitable && !is_null($offset) && !is_null($limit)) {
         $query = $query->processLimit($query, $limit, $offset);
     }
     // Create a stringified version of the query (with prefixes replaced):
     $sql = $this->replacePrefix((string) $query);
     // Use the stringified version in the prepare call:
     $this->prepared = $this->connection->prepare($sql, $driverOptions);
     // Store reference to the original FOFDatabaseQuery instance within the class.
     // This is important since binding variables depends on it within execute():
     parent::setQuery($query, $offset, $limit);
     return $this;
 }
 /**
  * Method to unlock the database table for writing.
  *
  * @return  boolean  True on success.
  */
 protected function _unlock()
 {
     $this->_db->unlockTables();
     $this->_locked = false;
     return true;
 }
 /**
  * Splits a string of multiple queries into an array of individual queries.
  *
  * @param   string  $query  Input SQL string with which to split into individual queries.
  *
  * @return  array  The queries from the input string separated into an array.
  *
  * @since   11.1
  * @deprecated  13.1 (Platform) & 4.0 (CMS)
  */
 public static function splitSql($query)
 {
     if (class_exists('JLog')) {
         JLog::add('FOFDatabase::splitSql() is deprecated, use FOFDatabaseDriver::splitSql() instead.', JLog::WARNING, 'deprecated');
     }
     return FOFDatabaseDriver::splitSql($query);
 }