- if ($this->mysqli) {
- if ($this->db->errno) {
- $this->error = $this->db->error;
- $this->errorno = $this->db->errno;
- }
- } elseif (mysql_errno($this->db)) {
- $this->error = mysql_error($this->db);
- $this->errorno = mysql_errno($this->db);
+ switch ($this->driver) {
+ case 'pdo':
+ $errorInfo = $this->db->errorInfo();
+ if ($errorInfo) {
+ $this->error = $errorInfo[2];
+ $this->errorno = $errorInfo[1];
+ }
+ break;
+ case 'mysqli':
+ if ($this->db->errno) {
+ $this->error = $this->db->error;
+ $this->errorno = $this->db->errno;
+ }
+ break;
+ case 'mysql':
+ if (mysql_errno($this->db)) {
+ $this->error = mysql_error($this->db);
+ $this->errorno = mysql_errno($this->db);
+ }
+ break;