| | |
| | | | program/include/rcube_db.inc | |
| | | | | |
| | | | This file is part of the RoundCube Webmail client | |
| | | | Copyright (C) 2005, RoundCube Dev. - Switzerland | |
| | | | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | PURPOSE: | |
| | |
| | | $this->db_error = TRUE; |
| | | $this->db_error_msg = $dbh->getMessage(); |
| | | |
| | | raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, |
| | | raise_error(array('code' => 603, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, |
| | | 'message' => $this->db_error_msg), TRUE, FALSE); |
| | | |
| | | return FALSE; |
| | |
| | | { |
| | | case 'pgsql': |
| | | $result = &$this->db_handle->getOne("SELECT CURRVAL('$sequence')"); |
| | | |
| | | case 'mssql': |
| | | $result = &$this->db_handle->getOne("SELECT @@IDENTITY"); |
| | | |
| | | if (DB::isError($result)) |
| | | raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, |
| | | 'message' => $result->getMessage()), TRUE, FALSE); |
| | | return $result; |
| | | |
| | | case 'mssql': |
| | | $result = &$this->db_handle->getOne("SELECT @@IDENTITY"); |
| | | if (DB::isError($result)) |
| | | raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, |
| | | 'message' => $result->getMessage()), TRUE, FALSE); |
| | | return $result; |
| | | |
| | | case 'mysql': // This is unfortuneate |
| | |
| | | |
| | | case 'mysqli': |
| | | return mysqli_insert_id($this->db_handle->connection); |
| | | |
| | | |
| | | case 'sqlite': |
| | | return sqlite_last_insert_rowid($this->db_handle->connection); |
| | | |
| | |
| | | */ |
| | | function _fetch_row($result, $mode) |
| | | { |
| | | if (DB::isError($result)) |
| | | if (!$result || DB::isError($result)) |
| | | { |
| | | raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, |
| | | 'message' => $this->db_link->getMessage()), TRUE, FALSE); |
| | | return FALSE; |
| | | } |
| | | elseif (!is_object($result)) |
| | | return FALSE; |
| | | |
| | | return $result->fetchRow($mode); |
| | | } |