Example #1
0
 public static function delete_recipes(array $recipe_ids)
 {
     //Smart quote each recipe id
     $recipe_ids = array_map(function ($element) {
         return MySQLConnection::smart_quote($element);
     }, $recipe_ids);
     $SQL = "DELETE FROM recipes\n\t\t\t              WHERE `id` IN (" . implode(',', $recipe_ids) . ")";
     MySQLConnection::query($SQL) or Error::db_halt(500, 'internal server error', 'Unable to execute request, SQL query error.', __FUNCTION__, MySQLConnection::error(), $SQL);
 }
Example #2
0
 public static function get_db_version()
 {
     $SQL = "SELECT `current`\n\t\t\t          FROM db_version";
     return MySQLConnection::query($SQL);
 }
 /**
  * Execute any statement
  *
  * @param   mixed* args
  * @return  rdbms.mysql.MySQLResultSet or FALSE to indicate failure
  * @throws  rdbms.SQLException
  */
 public function query()
 {
     $args = func_get_args();
     $sql = $this->_prepare($args);
     $res = parent::query($sql);
     if (TRUE !== $res || !$this->shadow) {
         return $res;
     }
     // Get the affected rows / insert_id of the query on the bugs db to check for
     // midway collisions. Otherwise you get the affected rows / insert_id of the
     // shadow db insert
     $this->_affected = mysql_affected_rows($this->handle);
     $this->_insert_id = mysql_insert_id($this->handle);
     // This was an SQL update, insert or delete, or: something that does
     // not return a resultset. Write it into the shadow log
     mysql_query($this->_prepare(array('insert into shadowlog (command) values (%s)', $sql)), $this->handle);
     return $res;
 }