blob: aac606886f5eb63b0fd34f71be56ad2f6f6c7c69 [file] [log] [blame]
Andrey Andreevc5536aa2012-11-01 17:33:58 +02001<?php
Timothy Warren76e04352012-02-14 11:55:17 -05002/**
3 * CodeIgniter
4 *
Andrey Andreevfe9309d2015-01-09 17:48:58 +02005 * An open source application development framework for PHP
Timothy Warren76e04352012-02-14 11:55:17 -05006 *
Andrey Andreevbdb96ca2014-10-28 00:13:31 +02007 * This content is released under the MIT License (MIT)
Timothy Warren817af192012-02-16 08:28:00 -05008 *
Andrey Andreevfe9309d2015-01-09 17:48:58 +02009 * Copyright (c) 2014 - 2015, British Columbia Institute of Technology
Timothy Warren817af192012-02-16 08:28:00 -050010 *
Andrey Andreevbdb96ca2014-10-28 00:13:31 +020011 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
Timothy Warren76e04352012-02-14 11:55:17 -050017 *
Andrey Andreevbdb96ca2014-10-28 00:13:31 +020018 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 * THE SOFTWARE.
28 *
29 * @package CodeIgniter
30 * @author EllisLab Dev Team
darwinel871754a2014-02-11 17:34:57 +010031 * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
Andrey Andreevfe9309d2015-01-09 17:48:58 +020032 * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
Andrey Andreevbdb96ca2014-10-28 00:13:31 +020033 * @license http://opensource.org/licenses/MIT MIT License
34 * @link http://codeigniter.com
35 * @since Version 3.0.0
Timothy Warren7221f942012-02-14 15:02:33 -050036 * @filesource
Timothy Warren76e04352012-02-14 11:55:17 -050037 */
Andrey Andreevc5536aa2012-11-01 17:33:58 +020038defined('BASEPATH') OR exit('No direct script access allowed');
Timothy Warren76e04352012-02-14 11:55:17 -050039
Timothy Warren76e04352012-02-14 11:55:17 -050040/**
41 * Firebird/Interbase Database Adapter Class
42 *
43 * Note: _DB is an extender class that the app controller
Jamie Rumbelowffe7a0a2012-04-26 13:48:18 +010044 * creates dynamically based on whether the query builder
Timothy Warren76e04352012-02-14 11:55:17 -050045 * class is being used or not.
46 *
Timothy Warren7221f942012-02-14 15:02:33 -050047 * @package CodeIgniter
48 * @subpackage Drivers
49 * @category Database
50 * @author EllisLab Dev Team
51 * @link http://codeigniter.com/user_guide/database/
Timothy Warren76e04352012-02-14 11:55:17 -050052 */
Andrey Andreev26086872012-07-05 11:21:58 +030053class CI_DB_ibase_driver extends CI_DB {
Timothy Warren76e04352012-02-14 11:55:17 -050054
Andrey Andreeva24e52e2012-11-02 03:54:12 +020055 /**
56 * Database driver
57 *
58 * @var string
59 */
Andrey Andreev26086872012-07-05 11:21:58 +030060 public $dbdriver = 'ibase';
Timothy Warren76e04352012-02-14 11:55:17 -050061
Andrey Andreeva24e52e2012-11-02 03:54:12 +020062 // --------------------------------------------------------------------
Timothy Warren76e04352012-02-14 11:55:17 -050063
Andrey Andreeva24e52e2012-11-02 03:54:12 +020064 /**
65 * ORDER BY random keyword
66 *
Andrey Andreev98e46cf2012-11-13 03:01:42 +020067 * @var array
Andrey Andreeva24e52e2012-11-02 03:54:12 +020068 */
Andrey Andreev98e46cf2012-11-13 03:01:42 +020069 protected $_random_keyword = array('RAND()', 'RAND()');
Andrey Andreev00df2e32012-03-02 18:37:16 +020070
Andrey Andreeva24e52e2012-11-02 03:54:12 +020071 /**
72 * IBase Transaction status flag
73 *
74 * @var resource
75 */
76 protected $_ibase_trans;
77
78 // --------------------------------------------------------------------
Timothy Warren76e04352012-02-14 11:55:17 -050079
80 /**
81 * Non-persistent database connection
82 *
Andrey Andreev2e171022014-02-25 15:21:41 +020083 * @param bool $persistent
Timothy Warren7221f942012-02-14 15:02:33 -050084 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -050085 */
Andrey Andreev2e171022014-02-25 15:21:41 +020086 public function db_connect($persistent = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -050087 {
Andrey Andreev2e171022014-02-25 15:21:41 +020088 return ($persistent === TRUE)
Andrey Andreevf2818bd2014-02-25 15:26:20 +020089 ? ibase_pconnect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set)
90 : ibase_connect($this->hostname.':'.$this->database, $this->username, $this->password, $this->char_set);
Timothy Warren76e04352012-02-14 11:55:17 -050091 }
92
93 // --------------------------------------------------------------------
94
95 /**
Andrey Andreev08856b82012-03-03 03:19:28 +020096 * Database version number
Timothy Warren76e04352012-02-14 11:55:17 -050097 *
Timothy Warren7221f942012-02-14 15:02:33 -050098 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -050099 */
Andrey Andreev08856b82012-03-03 03:19:28 +0200100 public function version()
Timothy Warren76e04352012-02-14 11:55:17 -0500101 {
Andrey Andreev08856b82012-03-03 03:19:28 +0200102 if (isset($this->data_cache['version']))
103 {
104 return $this->data_cache['version'];
105 }
106
Timothy Warren3d985a12012-02-15 11:38:00 -0500107 if (($service = ibase_service_attach($this->hostname, $this->username, $this->password)))
108 {
Andrey Andreev08856b82012-03-03 03:19:28 +0200109 $this->data_cache['version'] = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
Andrey Andreev00df2e32012-03-02 18:37:16 +0200110
Timothy Warrenab189e12012-02-22 10:34:23 -0500111 // Don't keep the service open
112 ibase_service_detach($service);
Andrey Andreev08856b82012-03-03 03:19:28 +0200113 return $this->data_cache['version'];
Timothy Warren3d985a12012-02-15 11:38:00 -0500114 }
Andrey Andreev00df2e32012-03-02 18:37:16 +0200115
Timothy Warren3d985a12012-02-15 11:38:00 -0500116 return FALSE;
Timothy Warren76e04352012-02-14 11:55:17 -0500117 }
118
119 // --------------------------------------------------------------------
120
121 /**
122 * Execute the query
123 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200124 * @param string $sql an SQL query
Timothy Warren7221f942012-02-14 15:02:33 -0500125 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -0500126 */
Timothy Warren95562142012-02-20 17:37:21 -0500127 protected function _execute($sql)
Timothy Warren76e04352012-02-14 11:55:17 -0500128 {
Andrey Andreev2bbbd1a2014-05-09 10:24:14 +0300129 return ibase_query($this->conn_id, $sql);
Timothy Warren76e04352012-02-14 11:55:17 -0500130 }
131
132 // --------------------------------------------------------------------
133
134 /**
Timothy Warren76e04352012-02-14 11:55:17 -0500135 * Begin Transaction
136 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200137 * @param bool $test_mode
Timothy Warren7221f942012-02-14 15:02:33 -0500138 * @return bool
Timothy Warren76e04352012-02-14 11:55:17 -0500139 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500140 public function trans_begin($test_mode = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500141 {
Timothy Warren76e04352012-02-14 11:55:17 -0500142 // When transactions are nested we only begin/commit/rollback the outermost ones
Andrey Andreev131772c2012-03-20 23:35:03 +0200143 if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
Timothy Warren76e04352012-02-14 11:55:17 -0500144 {
145 return TRUE;
146 }
147
148 // Reset the transaction failure flag.
149 // If the $test_mode flag is set to TRUE transactions will be rolled back
150 // even if the queries produce a successful result.
Andrey Andreev131772c2012-03-20 23:35:03 +0200151 $this->_trans_failure = ($test_mode === TRUE);
Timothy Warren76e04352012-02-14 11:55:17 -0500152
Andrey Andreev2bbbd1a2014-05-09 10:24:14 +0300153 $this->_ibase_trans = ibase_trans($this->conn_id);
Andrey Andreev00df2e32012-03-02 18:37:16 +0200154
Timothy Warren76e04352012-02-14 11:55:17 -0500155 return TRUE;
156 }
157
158 // --------------------------------------------------------------------
159
160 /**
161 * Commit Transaction
162 *
Timothy Warren7221f942012-02-14 15:02:33 -0500163 * @return bool
Timothy Warren76e04352012-02-14 11:55:17 -0500164 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500165 public function trans_commit()
Timothy Warren76e04352012-02-14 11:55:17 -0500166 {
Timothy Warren76e04352012-02-14 11:55:17 -0500167 // When transactions are nested we only begin/commit/rollback the outermost ones
Andrey Andreev131772c2012-03-20 23:35:03 +0200168 if ( ! $this->trans_enabled OR $this->_trans->depth > 0)
Timothy Warren76e04352012-02-14 11:55:17 -0500169 {
170 return TRUE;
171 }
Andrey Andreev00df2e32012-03-02 18:37:16 +0200172
Andrey Andreev2bbbd1a2014-05-09 10:24:14 +0300173 return ibase_commit($this->_ibase_trans);
Timothy Warren76e04352012-02-14 11:55:17 -0500174 }
175
176 // --------------------------------------------------------------------
177
178 /**
179 * Rollback Transaction
180 *
Timothy Warren7221f942012-02-14 15:02:33 -0500181 * @return bool
Timothy Warren76e04352012-02-14 11:55:17 -0500182 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500183 public function trans_rollback()
Timothy Warren76e04352012-02-14 11:55:17 -0500184 {
Timothy Warren76e04352012-02-14 11:55:17 -0500185 // When transactions are nested we only begin/commit/rollback the outermost ones
Andrey Andreev131772c2012-03-20 23:35:03 +0200186 if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
Timothy Warren76e04352012-02-14 11:55:17 -0500187 {
188 return TRUE;
189 }
190
Andrey Andreev2bbbd1a2014-05-09 10:24:14 +0300191 return ibase_rollback($this->_ibase_trans);
Timothy Warren76e04352012-02-14 11:55:17 -0500192 }
193
194 // --------------------------------------------------------------------
195
196 /**
Timothy Warren76e04352012-02-14 11:55:17 -0500197 * Affected Rows
198 *
Andrey Andreev131772c2012-03-20 23:35:03 +0200199 * @return int
Timothy Warren76e04352012-02-14 11:55:17 -0500200 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500201 public function affected_rows()
Timothy Warren76e04352012-02-14 11:55:17 -0500202 {
Andrey Andreev2bbbd1a2014-05-09 10:24:14 +0300203 return ibase_affected_rows($this->conn_id);
Timothy Warren76e04352012-02-14 11:55:17 -0500204 }
205
206 // --------------------------------------------------------------------
207
208 /**
209 * Insert ID
210 *
Andrey Andreev131772c2012-03-20 23:35:03 +0200211 * @param string $generator_name
212 * @param int $inc_by
213 * @return int
Timothy Warren76e04352012-02-14 11:55:17 -0500214 */
Andrey Andreev5382b1b2012-06-25 01:26:48 +0300215 public function insert_id($generator_name, $inc_by = 0)
Timothy Warren76e04352012-02-14 11:55:17 -0500216 {
Timothy Warren07b660b2012-02-20 13:23:06 -0500217 //If a generator hasn't been used before it will return 0
Timothy Warrenfed2d1d2012-02-20 15:42:45 -0500218 return ibase_gen_id('"'.$generator_name.'"', $inc_by);
Timothy Warren76e04352012-02-14 11:55:17 -0500219 }
220
221 // --------------------------------------------------------------------
222
223 /**
Timothy Warren76e04352012-02-14 11:55:17 -0500224 * List table query
225 *
226 * Generates a platform-specific query string so that the table names can be fetched
227 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200228 * @param bool $prefix_limit
Timothy Warren7221f942012-02-14 15:02:33 -0500229 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500230 */
Timothy Warren95562142012-02-20 17:37:21 -0500231 protected function _list_tables($prefix_limit = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500232 {
hArpanet516f59c2014-08-26 09:46:52 +0100233 $sql = 'SELECT TRIM("RDB$RELATION_NAME") AS TABLE_NAME FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\'';
Timothy Warren76e04352012-02-14 11:55:17 -0500234
Alex Bilbie48a2baf2012-06-02 11:09:54 +0100235 if ($prefix_limit !== FALSE && $this->dbprefix !== '')
Timothy Warren76e04352012-02-14 11:55:17 -0500236 {
hArpanet516f59c2014-08-26 09:46:52 +0100237 return $sql.' AND TRIM("RDB$RELATION_NAME") AS TABLE_NAME LIKE \''.$this->escape_like_str($this->dbprefix)."%' "
Andrey Andreev5382b1b2012-06-25 01:26:48 +0300238 .sprintf($this->_like_escape_str, $this->_like_escape_chr);
Timothy Warren76e04352012-02-14 11:55:17 -0500239 }
Andrey Andreev131772c2012-03-20 23:35:03 +0200240
Timothy Warren76e04352012-02-14 11:55:17 -0500241 return $sql;
242 }
243
244 // --------------------------------------------------------------------
245
246 /**
247 * Show column query
248 *
249 * Generates a platform-specific query string so that the column names can be fetched
250 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200251 * @param string $table
Timothy Warren7221f942012-02-14 15:02:33 -0500252 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500253 */
Timothy Warren95562142012-02-20 17:37:21 -0500254 protected function _list_columns($table = '')
Timothy Warren76e04352012-02-14 11:55:17 -0500255 {
hArpanet516f59c2014-08-26 09:46:52 +0100256 return 'SELECT TRIM("RDB$FIELD_NAME") AS COLUMN_NAME FROM "RDB$RELATION_FIELDS" WHERE "RDB$RELATION_NAME" = '.$this->escape($table);
Timothy Warren76e04352012-02-14 11:55:17 -0500257 }
258
259 // --------------------------------------------------------------------
260
261 /**
Andrey Andreev02e7a9d2012-11-16 01:49:46 +0200262 * Returns an object with field data
Timothy Warren76e04352012-02-14 11:55:17 -0500263 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200264 * @param string $table
Andrey Andreev02e7a9d2012-11-16 01:49:46 +0200265 * @return array
Timothy Warren76e04352012-02-14 11:55:17 -0500266 */
Andrey Andreev02e7a9d2012-11-16 01:49:46 +0200267 public function field_data($table = '')
Timothy Warren76e04352012-02-14 11:55:17 -0500268 {
Andrey Andreev02e7a9d2012-11-16 01:49:46 +0200269 if ($table === '')
270 {
271 return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE;
272 }
273
274 $sql = 'SELECT "rfields"."RDB$FIELD_NAME" AS "name",
275 CASE "fields"."RDB$FIELD_TYPE"
276 WHEN 7 THEN \'SMALLINT\'
277 WHEN 8 THEN \'INTEGER\'
278 WHEN 9 THEN \'QUAD\'
279 WHEN 10 THEN \'FLOAT\'
280 WHEN 11 THEN \'DFLOAT\'
281 WHEN 12 THEN \'DATE\'
282 WHEN 13 THEN \'TIME\'
283 WHEN 14 THEN \'CHAR\'
284 WHEN 16 THEN \'INT64\'
285 WHEN 27 THEN \'DOUBLE\'
286 WHEN 35 THEN \'TIMESTAMP\'
287 WHEN 37 THEN \'VARCHAR\'
288 WHEN 40 THEN \'CSTRING\'
289 WHEN 261 THEN \'BLOB\'
290 ELSE NULL
291 END AS "type",
292 "fields"."RDB$FIELD_LENGTH" AS "max_length",
293 "rfields"."RDB$DEFAULT_VALUE" AS "default"
294 FROM "RDB$RELATION_FIELDS" "rfields"
295 JOIN "RDB$FIELDS" "fields" ON "rfields"."RDB$FIELD_SOURCE" = "fields"."RDB$FIELD_NAME"
296 WHERE "rfields"."RDB$RELATION_NAME" = '.$this->escape($table).'
297 ORDER BY "rfields"."RDB$FIELD_POSITION"';
298
299 return (($query = $this->query($sql)) !== FALSE)
300 ? $query->result_object()
301 : FALSE;
Timothy Warren76e04352012-02-14 11:55:17 -0500302 }
303
304 // --------------------------------------------------------------------
305
306 /**
Andrey Andreev00df2e32012-03-02 18:37:16 +0200307 * Error
Timothy Warren76e04352012-02-14 11:55:17 -0500308 *
Andrey Andreev00df2e32012-03-02 18:37:16 +0200309 * Returns an array containing code and message of the last
310 * database error that has occured.
Timothy Warren76e04352012-02-14 11:55:17 -0500311 *
Andrey Andreev00df2e32012-03-02 18:37:16 +0200312 * @return array
Timothy Warren76e04352012-02-14 11:55:17 -0500313 */
Andrey Andreev00df2e32012-03-02 18:37:16 +0200314 public function error()
Timothy Warren76e04352012-02-14 11:55:17 -0500315 {
Andrey Andreev00df2e32012-03-02 18:37:16 +0200316 return array('code' => ibase_errcode(), 'message' => ibase_errmsg());
Timothy Warren76e04352012-02-14 11:55:17 -0500317 }
318
319 // --------------------------------------------------------------------
320
321 /**
Timothy Warren76e04352012-02-14 11:55:17 -0500322 * Update statement
323 *
324 * Generates a platform-specific update string from the supplied data
325 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200326 * @param string $table
327 * @param array $values
Timothy Warren7221f942012-02-14 15:02:33 -0500328 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500329 */
Andrey Andreevb0478652012-07-18 15:34:46 +0300330 protected function _update($table, $values)
Timothy Warren76e04352012-02-14 11:55:17 -0500331 {
Andrey Andreevb0478652012-07-18 15:34:46 +0300332 $this->qb_limit = FALSE;
333 return parent::_update($table, $values);
Timothy Warren76e04352012-02-14 11:55:17 -0500334 }
335
Timothy Warren76e04352012-02-14 11:55:17 -0500336 // --------------------------------------------------------------------
337
338 /**
339 * Truncate statement
340 *
341 * Generates a platform-specific truncate string from the supplied data
Andrey Andreeva6fe36e2012-04-05 16:00:32 +0300342 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200343 * If the database does not support the TRUNCATE statement,
Andrey Andreeva6fe36e2012-04-05 16:00:32 +0300344 * then this method maps to 'DELETE FROM table'
Timothy Warren76e04352012-02-14 11:55:17 -0500345 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200346 * @param string $table
Timothy Warren7221f942012-02-14 15:02:33 -0500347 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500348 */
Timothy Warren95562142012-02-20 17:37:21 -0500349 protected function _truncate($table)
Timothy Warren76e04352012-02-14 11:55:17 -0500350 {
Andrey Andreeva6fe36e2012-04-05 16:00:32 +0300351 return 'DELETE FROM '.$table;
Timothy Warren76e04352012-02-14 11:55:17 -0500352 }
353
354 // --------------------------------------------------------------------
355
356 /**
357 * Delete statement
358 *
359 * Generates a platform-specific delete string from the supplied data
360 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200361 * @param string $table
Timothy Warren7221f942012-02-14 15:02:33 -0500362 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500363 */
Andrey Andreevb0478652012-07-18 15:34:46 +0300364 protected function _delete($table)
Timothy Warren76e04352012-02-14 11:55:17 -0500365 {
Andrey Andreevb0478652012-07-18 15:34:46 +0300366 $this->qb_limit = FALSE;
367 return parent::_delete($table);
Timothy Warren76e04352012-02-14 11:55:17 -0500368 }
369
370 // --------------------------------------------------------------------
371
372 /**
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200373 * LIMIT
Timothy Warren76e04352012-02-14 11:55:17 -0500374 *
375 * Generates a platform-specific LIMIT clause
376 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200377 * @param string $sql SQL Query
Timothy Warren7221f942012-02-14 15:02:33 -0500378 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500379 */
Andrey Andreevc9b924c2012-07-19 13:06:02 +0300380 protected function _limit($sql)
Timothy Warren76e04352012-02-14 11:55:17 -0500381 {
Timothy Warren56784f62012-02-29 11:58:20 -0500382 // Limit clause depends on if Interbase or Firebird
Andrey Andreev08856b82012-03-03 03:19:28 +0200383 if (stripos($this->version(), 'firebird') !== FALSE)
Timothy Warren56784f62012-02-29 11:58:20 -0500384 {
Andrey Andreevc9b924c2012-07-19 13:06:02 +0300385 $select = 'FIRST '.$this->qb_limit
386 .($this->qb_offset ? ' SKIP '.$this->qb_offset : '');
Timothy Warren56784f62012-02-29 11:58:20 -0500387 }
388 else
389 {
Andrey Andreev131772c2012-03-20 23:35:03 +0200390 $select = 'ROWS '
Andrey Andreevc9b924c2012-07-19 13:06:02 +0300391 .($this->qb_offset ? $this->qb_offset.' TO '.($this->qb_limit + $this->qb_offset) : $this->qb_limit);
Timothy Warren56784f62012-02-29 11:58:20 -0500392 }
Andrey Andreev00df2e32012-03-02 18:37:16 +0200393
Timothy Warrena5410872013-01-09 10:44:14 -0500394 return preg_replace('`SELECT`i', 'SELECT '.$select, $sql, 1);
Timothy Warren76e04352012-02-14 11:55:17 -0500395 }
396
397 // --------------------------------------------------------------------
398
399 /**
400 * Close DB Connection
401 *
Timothy Warren7221f942012-02-14 15:02:33 -0500402 * @return void
Timothy Warren76e04352012-02-14 11:55:17 -0500403 */
Andrey Andreev79922c02012-05-23 12:27:17 +0300404 protected function _close()
Timothy Warren76e04352012-02-14 11:55:17 -0500405 {
Andrey Andreev2bbbd1a2014-05-09 10:24:14 +0300406 ibase_close($this->conn_id);
Timothy Warren76e04352012-02-14 11:55:17 -0500407 }
Andrey Andreev00df2e32012-03-02 18:37:16 +0200408
Timothy Warren76e04352012-02-14 11:55:17 -0500409}
410
Andrey Andreev26086872012-07-05 11:21:58 +0300411/* End of file ibase_driver.php */
412/* Location: ./system/database/drivers/ibase/ibase_driver.php */