blob: 20c5d9c571bc2a7b5c82d45e90897b6e21d080e0 [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 Andreev5350f052015-01-12 12:33:37 +0200267 public function field_data($table)
Timothy Warren76e04352012-02-14 11:55:17 -0500268 {
Andrey Andreev02e7a9d2012-11-16 01:49:46 +0200269 $sql = 'SELECT "rfields"."RDB$FIELD_NAME" AS "name",
270 CASE "fields"."RDB$FIELD_TYPE"
271 WHEN 7 THEN \'SMALLINT\'
272 WHEN 8 THEN \'INTEGER\'
273 WHEN 9 THEN \'QUAD\'
274 WHEN 10 THEN \'FLOAT\'
275 WHEN 11 THEN \'DFLOAT\'
276 WHEN 12 THEN \'DATE\'
277 WHEN 13 THEN \'TIME\'
278 WHEN 14 THEN \'CHAR\'
279 WHEN 16 THEN \'INT64\'
280 WHEN 27 THEN \'DOUBLE\'
281 WHEN 35 THEN \'TIMESTAMP\'
282 WHEN 37 THEN \'VARCHAR\'
283 WHEN 40 THEN \'CSTRING\'
284 WHEN 261 THEN \'BLOB\'
285 ELSE NULL
286 END AS "type",
287 "fields"."RDB$FIELD_LENGTH" AS "max_length",
288 "rfields"."RDB$DEFAULT_VALUE" AS "default"
289 FROM "RDB$RELATION_FIELDS" "rfields"
290 JOIN "RDB$FIELDS" "fields" ON "rfields"."RDB$FIELD_SOURCE" = "fields"."RDB$FIELD_NAME"
291 WHERE "rfields"."RDB$RELATION_NAME" = '.$this->escape($table).'
292 ORDER BY "rfields"."RDB$FIELD_POSITION"';
293
294 return (($query = $this->query($sql)) !== FALSE)
295 ? $query->result_object()
296 : FALSE;
Timothy Warren76e04352012-02-14 11:55:17 -0500297 }
298
299 // --------------------------------------------------------------------
300
301 /**
Andrey Andreev00df2e32012-03-02 18:37:16 +0200302 * Error
Timothy Warren76e04352012-02-14 11:55:17 -0500303 *
Andrey Andreev00df2e32012-03-02 18:37:16 +0200304 * Returns an array containing code and message of the last
305 * database error that has occured.
Timothy Warren76e04352012-02-14 11:55:17 -0500306 *
Andrey Andreev00df2e32012-03-02 18:37:16 +0200307 * @return array
Timothy Warren76e04352012-02-14 11:55:17 -0500308 */
Andrey Andreev00df2e32012-03-02 18:37:16 +0200309 public function error()
Timothy Warren76e04352012-02-14 11:55:17 -0500310 {
Andrey Andreev00df2e32012-03-02 18:37:16 +0200311 return array('code' => ibase_errcode(), 'message' => ibase_errmsg());
Timothy Warren76e04352012-02-14 11:55:17 -0500312 }
313
314 // --------------------------------------------------------------------
315
316 /**
Timothy Warren76e04352012-02-14 11:55:17 -0500317 * Update statement
318 *
319 * Generates a platform-specific update string from the supplied data
320 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200321 * @param string $table
322 * @param array $values
Timothy Warren7221f942012-02-14 15:02:33 -0500323 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500324 */
Andrey Andreevb0478652012-07-18 15:34:46 +0300325 protected function _update($table, $values)
Timothy Warren76e04352012-02-14 11:55:17 -0500326 {
Andrey Andreevb0478652012-07-18 15:34:46 +0300327 $this->qb_limit = FALSE;
328 return parent::_update($table, $values);
Timothy Warren76e04352012-02-14 11:55:17 -0500329 }
330
Timothy Warren76e04352012-02-14 11:55:17 -0500331 // --------------------------------------------------------------------
332
333 /**
334 * Truncate statement
335 *
336 * Generates a platform-specific truncate string from the supplied data
Andrey Andreeva6fe36e2012-04-05 16:00:32 +0300337 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200338 * If the database does not support the TRUNCATE statement,
Andrey Andreeva6fe36e2012-04-05 16:00:32 +0300339 * then this method maps to 'DELETE FROM table'
Timothy Warren76e04352012-02-14 11:55:17 -0500340 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200341 * @param string $table
Timothy Warren7221f942012-02-14 15:02:33 -0500342 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500343 */
Timothy Warren95562142012-02-20 17:37:21 -0500344 protected function _truncate($table)
Timothy Warren76e04352012-02-14 11:55:17 -0500345 {
Andrey Andreeva6fe36e2012-04-05 16:00:32 +0300346 return 'DELETE FROM '.$table;
Timothy Warren76e04352012-02-14 11:55:17 -0500347 }
348
349 // --------------------------------------------------------------------
350
351 /**
352 * Delete statement
353 *
354 * Generates a platform-specific delete string from the supplied data
355 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200356 * @param string $table
Timothy Warren7221f942012-02-14 15:02:33 -0500357 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500358 */
Andrey Andreevb0478652012-07-18 15:34:46 +0300359 protected function _delete($table)
Timothy Warren76e04352012-02-14 11:55:17 -0500360 {
Andrey Andreevb0478652012-07-18 15:34:46 +0300361 $this->qb_limit = FALSE;
362 return parent::_delete($table);
Timothy Warren76e04352012-02-14 11:55:17 -0500363 }
364
365 // --------------------------------------------------------------------
366
367 /**
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200368 * LIMIT
Timothy Warren76e04352012-02-14 11:55:17 -0500369 *
370 * Generates a platform-specific LIMIT clause
371 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200372 * @param string $sql SQL Query
Timothy Warren7221f942012-02-14 15:02:33 -0500373 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500374 */
Andrey Andreevc9b924c2012-07-19 13:06:02 +0300375 protected function _limit($sql)
Timothy Warren76e04352012-02-14 11:55:17 -0500376 {
Timothy Warren56784f62012-02-29 11:58:20 -0500377 // Limit clause depends on if Interbase or Firebird
Andrey Andreev08856b82012-03-03 03:19:28 +0200378 if (stripos($this->version(), 'firebird') !== FALSE)
Timothy Warren56784f62012-02-29 11:58:20 -0500379 {
Andrey Andreevc9b924c2012-07-19 13:06:02 +0300380 $select = 'FIRST '.$this->qb_limit
381 .($this->qb_offset ? ' SKIP '.$this->qb_offset : '');
Timothy Warren56784f62012-02-29 11:58:20 -0500382 }
383 else
384 {
Andrey Andreev131772c2012-03-20 23:35:03 +0200385 $select = 'ROWS '
Andrey Andreevc9b924c2012-07-19 13:06:02 +0300386 .($this->qb_offset ? $this->qb_offset.' TO '.($this->qb_limit + $this->qb_offset) : $this->qb_limit);
Timothy Warren56784f62012-02-29 11:58:20 -0500387 }
Andrey Andreev00df2e32012-03-02 18:37:16 +0200388
Timothy Warrena5410872013-01-09 10:44:14 -0500389 return preg_replace('`SELECT`i', 'SELECT '.$select, $sql, 1);
Timothy Warren76e04352012-02-14 11:55:17 -0500390 }
391
392 // --------------------------------------------------------------------
393
394 /**
395 * Close DB Connection
396 *
Timothy Warren7221f942012-02-14 15:02:33 -0500397 * @return void
Timothy Warren76e04352012-02-14 11:55:17 -0500398 */
Andrey Andreev79922c02012-05-23 12:27:17 +0300399 protected function _close()
Timothy Warren76e04352012-02-14 11:55:17 -0500400 {
Andrey Andreev2bbbd1a2014-05-09 10:24:14 +0300401 ibase_close($this->conn_id);
Timothy Warren76e04352012-02-14 11:55:17 -0500402 }
Andrey Andreev00df2e32012-03-02 18:37:16 +0200403
Timothy Warren76e04352012-02-14 11:55:17 -0500404}
405
Andrey Andreev26086872012-07-05 11:21:58 +0300406/* End of file ibase_driver.php */
407/* Location: ./system/database/drivers/ibase/ibase_driver.php */