summaryrefslogtreecommitdiffstats
path: root/class/CommonTable.php
diff options
context:
space:
mode:
Diffstat (limited to 'class/CommonTable.php')
-rw-r--r--class/CommonTable.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/class/CommonTable.php b/class/CommonTable.php
index 1102c4d..e049188 100644
--- a/class/CommonTable.php
+++ b/class/CommonTable.php
@@ -81,7 +81,7 @@ abstract class CommonTable
$res = $this->db->exec($sql);
if ($res===false) {
$err = $this->db->errorInfo();
- throw new Exception($err[2]);
+ throw new Exception("\nSQL: $sql\nERROR: ".$err[2]."\nCODE:");
}
return $res;
}
@@ -197,7 +197,7 @@ abstract class CommonTable
*
* @return hashtable
*/
- public function getAllArray($fieldkey, $fieldvalue)
+ public function getHashtable($fieldkey, $fieldvalue)
{
$crit = array('FIELDS' => array($fieldkey, $fieldvalue),
'ORDER' => $fieldkey);
@@ -207,6 +207,22 @@ abstract class CommonTable
}
return $tab;
}
+
+ /**
+ * Retrieve a big array with all date from the table
+ *
+ * @param array|string $crit for the request
+ *
+ * @return array, index is rowid, value is a hastable
+ */
+ public function getArray($crit='')
+ {
+ $tab = array();
+ foreach ($this->request($crit) as $id => $data) {
+ $tab[$id] = $data;
+ }
+ return $tab;
+ }
}
?> \ No newline at end of file