Ejemplo n.º 1
0
 /**
  * Method to quote and optionally escape a string to database requirements for insertion into the database.
  *
  * This method is provided for use where the query object is passed to a function for modification.
  * If you have direct access to the database object, it is recommended you use the quote method directly.
  *
  * Note that 'q' is an alias for this method as it is in DatabaseDriver.
  *
  * Usage:
  * $query->quote('fulltext');
  * $query->q('fulltext');
  * $query->q(array('option', 'fulltext'));
  *
  * @param   array|string  $text    A string or an array of strings to quote.
  * @param   boolean       $escape  True (default) to escape the string, false to leave it unchanged.
  *
  * @return  string  The quoted input string.
  *
  * @since   1.0
  * @throws  \RuntimeException if the internal db property is not a valid object.
  */
 public function quote($text, $escape = true)
 {
     if (!$this->db instanceof DatabaseDriver) {
         throw new \RuntimeException('JLIB_DATABASE_ERROR_INVALID_DB_OBJECT');
     }
     return $this->db->quote($text, $escape);
 }