Tested the three new method mysql needed an adjustment.

This commit is contained in:
Mark Crane 2012-07-22 06:35:00 +00:00
parent 16c6a7fb91
commit a68501772f
1 changed files with 13 additions and 3 deletions

View File

@ -216,8 +216,16 @@ include "root.php";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$tmp = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($tmp as &$row) {
$result['name'][] = $row['name'];
if ($this->type == "pgsql" || $this->type == "sqlite") {
foreach ($tmp as &$row) {
$result['name'][] = $row['name'];
}
}
if ($this->type == "mysql") {
foreach ($tmp as &$row) {
$table_array = array_values($row);
$result['name'][] = $table_array[0];
}
}
return $result;
}
@ -267,6 +275,7 @@ include "root.php";
//get the table info
$table_info = $this->table_info();
//set the list of fields
if ($this->type == "sqlite") {
foreach($table_info as $row) {
@ -280,9 +289,10 @@ include "root.php";
}
if ($this->type == "mysql") {
foreach($table_info as $row) {
$result['name'][] = $row['name'];
$result['name'][] = $row['Field'];
}
}
//return the result array
return $result;
}