Skip to content

Commit

Permalink
pdo try catch issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AbmSourav committed Aug 8, 2023
1 parent 12a154d commit f7bf2cf
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "codesvault/howdy-qb",
"description": "Mysql Query Builder for WordPress",
"version": "1.5.2",
"version": "1.5.3",
"minimum-stability": "stable",
"scripts": {
"test": "phpunit",
Expand Down
12 changes: 6 additions & 6 deletions src/Statement/Alter.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,11 @@ private function driver_exicute($sql)
return $driver->query($sql);
}

return $driver->exec($sql);
try {
return $driver->exec($sql);
} catch (\PDOException $exception) {
Utilities::throughException($exception);
}
}

public function execute()
Expand All @@ -234,10 +238,6 @@ public function execute()
return;
}

try {
$this->driver_exicute($query);
} catch (\PDOException $exception) {
Utilities::throughException($exception);
}
$this->driver_exicute($query);
}
}
12 changes: 6 additions & 6 deletions src/Statement/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ private function driver_exicute($sql)
return $driver->query($sql);
}

return $driver->exec($sql);
try {
return $driver->exec($sql);
} catch (\PDOException $exception) {
Utilities::throughException($exception);
}
}

public function execute()
Expand All @@ -180,10 +184,6 @@ public function execute()
$query = SqlGenerator::create($this->sql);
// return dump($query);

try {
$this->driver_exicute($query);
} catch (\PDOException $exception) {
Utilities::throughException($exception);
}
$this->driver_exicute($query);
}
}
12 changes: 6 additions & 6 deletions src/Statement/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ private function driver_exicute($sql)
}

$data = $driver->prepare($sql);
return $data->execute($this->params);
try {
return $data->execute($this->params);
} catch (\PDOException $exception) {
Utilities::throughException($exception);
}
}

private function delete_data()
{
$query = SqlGenerator::delete($this->sql);

try {
return $this->driver_exicute($query);
} catch (\Exception $exception) {
Utilities::throughException($exception);
}
return $this->driver_exicute($query);
}

// get only sql query string
Expand Down
12 changes: 6 additions & 6 deletions src/Statement/Drop.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ private function driver_exicute($sql)
}

$data = $driver->prepare($sql);
return $data->execute($this->params);
try {
return $data->execute($this->params);
} catch (\Exception $exception) {
Utilities::throughException($exception);
}
}

private function drop_table()
{
$query = trim($this->sql['drop']);

try {
$this->driver_exicute($query);
} catch (\Exception $exception) {
Utilities::throughException($exception);
}
$this->driver_exicute($query);
}
}
12 changes: 6 additions & 6 deletions src/Statement/Insert.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ private function insert_data()
{
$query = SqlGenerator::insert($this->sql);

try {
$this->driver_exicute($query);
} catch (\Exception $exception) {
Utilities::throughException($exception);
}
$this->driver_exicute($query);
}

private function driver_exicute($sql)
Expand All @@ -50,7 +46,11 @@ private function driver_exicute($sql)
}

$data = $driver->prepare($sql);
return $data->execute($this->params);
try {
return $data->execute($this->params);
} catch (\Exception $exception) {
Utilities::throughException($exception);
}
}

private function start()
Expand Down
12 changes: 6 additions & 6 deletions src/Statement/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ private function driver_exicute($sql)
}

$data = $driver->prepare($sql);
return $data->execute($this->params);
try {
return $data->execute($this->params);
} catch (\Exception $exception) {
Utilities::throughException($exception);
}
}

private function update_data()
{
$query = SqlGenerator::update($this->sql);

try {
$this->driver_exicute($query);
} catch (\Exception $exception) {
Utilities::throughException($exception);
}
$this->driver_exicute($query);
}

public function execute()
Expand Down

0 comments on commit f7bf2cf

Please sign in to comment.