Skip to content

Commit

Permalink
namespace corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-older committed Nov 21, 2023
1 parent 3261c57 commit 0c9c0c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion last_commit.sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0e5dd0c88b655dc93d373e1e6c872b53147ba27b
3261c57eee9661df93556e044b64e942e84468a7
16 changes: 6 additions & 10 deletions src/Unidb/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function check()
}

try {
$this->db_link->query("SELECT 1");
$stmt = $this->db_link->query("SELECT 1");
return true;
}
catch(\PDOException $e) {
Expand All @@ -95,11 +95,7 @@ public function query($query, $paramsValues, $return_data = false)
$prefix = __FUNCTION__.": $query, ";

if(empty($this->db_link)) {
$this->error = "$prefix Bad or no PDO object given";
return false;
}

if(empty($this->status) && $this->connect() == false) {
$this->error = "$prefix bad or no PDO object given";
return false;
}

Expand All @@ -117,20 +113,20 @@ public function query($query, $paramsValues, $return_data = false)
if(!empty($paramsValues[0])) {
foreach($paramsValues as $key => $value) {
if($params_number == 0) {
$types = str_split($paramsValues[$key]);
$types = str_split($value); //str_split($paramsValues[$key]);
$params_number++;
continue;
}

if(empty($types)) {
$this->error = "$prefix No data types in request";
$this->error = "$prefix no data types in request";
return false;
}

$prefix.= " $key=>{$value} ";

if(empty($types[$params_number - 1])) {
$this->error = "$prefix Not enough data types for values";
$this->error = "$prefix not enough data types for values";
return false;
}

Expand All @@ -156,7 +152,7 @@ public function query($query, $paramsValues, $return_data = false)
$stmt->execute();
}
catch(\PDOException $e) {
$this->error = "$prefix Request to DB failed on `execute`: ".$e->getMessage();
$this->error = "$prefix request to DB failed on `execute`: ".$e->getMessage();
return false;
}

Expand Down

0 comments on commit 0c9c0c7

Please sign in to comment.