#2 ✓resolved
Maurits Lamers

Improvement in OrionDB_DB_MySQL.php

Reported by Maurits Lamers | March 10th, 2010 @ 11:20 AM

Currently the runquery function only allows a query to be run on the database if a proper tablename is provided. This is not always useful, especially when running queries that take information from many tables. As the tablename is only used to format an error message, it is better to adjust the error message depending on what information is in the $tablename parameter. The body of the function then becomes this:

if($query == "") return false;
if($tablename == ""){
 $tablename = $this->get_tablename_in_proper_case($this->cleansql($tablename));
   $errormessage = "Error while retrieving a collection from table " . $tablename;        
}
else {
   $errormessage = "Error while executing an multi-table query.";
}

$result = mysql_query($query) or fataldberror($query, $errormessage . ": " . mysql_error());
$numrows = mysql_num_rows($result);
if($numrows > 0){
  $returnarray = array();
  for($index=0;$index<$numrows;$index++){
    $returnarray[] =  mysql_fetch_array($result);
  }
  return $returnarray;
} 
else return false;

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A generic PHP database front end for the Sproutcore RestServer server communication object.

People watching this ticket

Pages