From 30bcbf3715e3b73768a50c6bcf1c97ab62ac8214 Mon Sep 17 00:00:00 2001 From: Anthony Gauthier Date: Mon, 1 Apr 2019 13:22:52 -0400 Subject: [PATCH] Added connect() and disconnect() in getKeys() --- src/MySimpleORM/Mapper/Database.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MySimpleORM/Mapper/Database.php b/src/MySimpleORM/Mapper/Database.php index 0c8f031..2cbbbba 100644 --- a/src/MySimpleORM/Mapper/Database.php +++ b/src/MySimpleORM/Mapper/Database.php @@ -105,6 +105,7 @@ public function select($table, $columns = null, $wheres = null, $joins = null, $ $return = array(); if ($table != "" || $table != null) { + echo "selecting!!\n"; //Open up connection $this->connect(); @@ -372,11 +373,14 @@ public function update($table, $columns, $values, $wheres = null) public function getKeys($table, $type = "primary") { + $this->connect(); + if ($type == "primary") { $this->Sql = "SHOW COLUMNS FROM " . $table . ";"; $results = $this->Instance->query($this->Sql); foreach ($results as $row) { if ($row["Key"] == "PRI") { + $this->disconnect(); return $row["Field"]; } } @@ -398,7 +402,7 @@ public function getKeys($table, $type = "primary") $return[] = array($column_name); } } - + $this->disconnect(); return $return; } }