selectArray() function missing in subsystems/database/mysql.php

Bug #719029 reported by sponge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Exponent Content Management System
Fix Committed
High
Unassigned

Bug Description

This kills all pure MySQL installations for no reason, simply add the following function to the file:

    /* exdoc
  * Select a record from the database as an array
  *
  * Selects a set of arrays from the database. Because of the way
  * Exponent handles objects and database tables, this is akin to
  * SELECTing a set of records from a database table. Returns an
  * array of arrays, in any random order.
  *
  * @param string $table The name of the table/object to look at
  * @param string $where Criteria used to narrow the result set. If this
  * is specified as null, then no criteria is applied, and all objects are
  * returned
  */
 function selectArray($table, $where = null, $orderby = null, $is_revisioned=false) {
  if ($where == null) $where = "1";
  if($is_revisioned) $where.= " AND revision_id=(SELECT MAX(revision_id) FROM `" . $this->prefix . "$table` WHERE $where)";
  $orderby = empty($orderby) ? '' : "ORDER BY " . $orderby;
      $arrays = array();
      $res = @mysql_query("SELECT * FROM `" . $this->prefix . "$table` WHERE $where $orderby",$this->connection);
  if ($res == null) return null;
  return mysql_fetch_assoc($res);
 }

Revision history for this message
sponge (imransomji) wrote :

Also the following functions are missing:

 function selectObjectBySql($sql) {
        $res = @mysql_query($this->connection,$sql);
        if ($res == null) return null;
        return mysql_fetch_object($res);
 }

 function selectObjectsBySql($sql) {
                $res = @mysql_query($sql, $this->connection);
                if ($res == null) return array();
                $objects = array();
                for ($i = 0; $i < mysql_num_rows($res); $i++) $objects[] = mysql_fetch_object($res);
                return $objects;
 }

 function queryRows($sql) {
        $res = @mysql_query($this->connection,$sql);
        return empty($res) ? 0 : mysql_num_rows($res);
 }

Changed in exponent-cms:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.