| | |
| | | |
| | | var $a_query_results = array('dummy'); |
| | | var $last_res_id = 0; |
| | | |
| | | private $tables; |
| | | |
| | | |
| | | /** |
| | |
| | | $this->db_error_msg = $q->userinfo; |
| | | |
| | | raise_error(array('code' => 500, 'type' => 'db', |
| | | 'line' => __LINE__, 'file' => __FILE__, |
| | | 'line' => __LINE__, 'file' => __FILE__, |
| | | 'message' => $this->db_error_msg), TRUE, TRUE); |
| | | } |
| | | else |
| | |
| | | if (!$this->db_handle || $this->db_mode=='r') |
| | | return FALSE; |
| | | |
| | | // find sequence name |
| | | if ($table && $this->db_provider == 'pgsql') |
| | | $table = get_sequence_name($table); |
| | | |
| | | if ($table) { |
| | | if ($this->db_provider == 'pgsql') |
| | | // find sequence name |
| | | $table = get_sequence_name($table); |
| | | else |
| | | // resolve table name |
| | | $table = get_table_name($table); |
| | | } |
| | | |
| | | $id = $this->db_handle->lastInsertID($table); |
| | | |
| | | return $this->db_handle->isError($id) ? null : $id; |
| | |
| | | |
| | | return $result->fetchRow($mode); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Wrapper for the SHOW TABLES command |
| | | * |
| | | * @return array List of all tables of the current database |
| | | */ |
| | | function list_tables() |
| | | { |
| | | // get tables if not cached |
| | | if (!$this->tables) { |
| | | $this->db_handle->loadModule('Manager'); |
| | | if (!PEAR::isError($result = $this->db_handle->listTables())) |
| | | $this->tables = $result; |
| | | else |
| | | $this->tables = array(); |
| | | } |
| | | |
| | | return $this->tables; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | { |
| | | if ($scope != 'prepare') |
| | | { |
| | | $debug_output = $scope . '('.$db->db_index.'): '; |
| | | $debug_output .= $message . $db->getOption('log_line_break'); |
| | | $debug_output = $scope . '('.$db->db_index.'): ' . $message; |
| | | write_log('sql', $debug_output); |
| | | } |
| | | } |