Skip to content

Commit ec1fa4c

Browse files
committed
#5 - added hasError() method
1 parent 4f8e508 commit ec1fa4c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/TgDatabase/Database.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ public function error() {
174174
return $this->con->error;
175175
}
176176

177+
/**
178+
* Return TRUE when the database had a problem with the last task.
179+
* @return boolean - TRUE when connection failed or last SQL command failed.
180+
*/
181+
public function hasError() {
182+
return $this->con->connect_errno || $this->con->errno;
183+
}
184+
177185
/**
178186
* Inserts a new row into a table.
179187
* <p>All fields (for objects) or keys (for arrays) are used as column names.</p>

0 commit comments

Comments
 (0)