summaryrefslogtreecommitdiffstats
path: root/codebase
diff options
context:
space:
mode:
Diffstat (limited to 'codebase')
-rw-r--r--codebase/db_pdo.php25
-rw-r--r--codebase/db_phpcake.php2
-rw-r--r--codebase/db_phpyii.php2
-rw-r--r--codebase/gantt_connector.php10
4 files changed, 32 insertions, 7 deletions
diff --git a/codebase/db_pdo.php b/codebase/db_pdo.php
index d1ad4d8..1417462 100644
--- a/codebase/db_pdo.php
+++ b/codebase/db_pdo.php
@@ -39,6 +39,31 @@ class PDODBDataWrapper extends DBDataWrapper{
return $sql;
}
+ public function tables_list() {
+ $result = $this->query("SHOW TABLES");
+ if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection));
+
+ $tables = array();
+ while ($table = $result->next()) {
+ $tables[] = $table[0];
+ }
+ return $tables;
+ }
+
+ public function fields_list($table) {
+ $result = $this->query("SHOW COLUMNS FROM `".$table."`");
+ if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection));
+
+ $fields = array();
+ $id = "";
+ while ($field = $result->next()) {
+ if ($field['Key'] == "PRI")
+ $id = $field["Field"];
+ else
+ $fields[] = $field["Field"];
+ }
+ return array("fields" => $fields, "key" => $id );
+ }
public function get_next($res){
$data = $res->next();
diff --git a/codebase/db_phpcake.php b/codebase/db_phpcake.php
index 97d94eb..4df0289 100644
--- a/codebase/db_phpcake.php
+++ b/codebase/db_phpcake.php
@@ -19,9 +19,9 @@ class PHPCakeDBDataWrapper extends ArrayDBDataWrapper{
else
$res = $this->connection->find("all");
+ $temp = array();
if (sizeof($res)){
$name = get_class($this->connection);
- $temp = array();
for ($i=sizeof($res)-1; $i>=0; $i--)
$temp[]=&$res[$i][$name];
}
diff --git a/codebase/db_phpyii.php b/codebase/db_phpyii.php
index f71d61a..616d7f3 100644
--- a/codebase/db_phpyii.php
+++ b/codebase/db_phpyii.php
@@ -13,8 +13,8 @@ class PHPYiiDBDataWrapper extends ArrayDBDataWrapper{
else
$res = $this->connection->findAll();
+ $temp = array();
if (sizeof($res)){
- $temp = array();
foreach ($res as $obj)
$temp[]=$obj->getAttributes();
}
diff --git a/codebase/gantt_connector.php b/codebase/gantt_connector.php
index 74b8636..3577835 100644
--- a/codebase/gantt_connector.php
+++ b/codebase/gantt_connector.php
@@ -131,15 +131,15 @@ class GanttConnector extends Connector{
class GanttDataProcessor extends DataProcessor{
function name_data($data){
if ($data=="start_date")
- return $this->config->text[0]["db_name"];
+ return $this->config->text[0]["name"];
if ($data=="id")
- return $this->config->id["db_name"];
+ return $this->config->id["name"];
if ($data=="duration" && $this->config->text[1]["name"] == "duration")
- return $this->config->text[1]["db_name"];
+ return $this->config->text[1]["name"];
if ($data=="end_date" && $this->config->text[1]["name"] == "end_date")
- return $this->config->text[1]["db_name"];
+ return $this->config->text[1]["name"];
if ($data=="text")
- return $this->config->text[2]["db_name"];
+ return $this->config->text[2]["name"];
return $data;
}