blob: 525294db4875081960bd0936a036e50ff95452a3 [file] [log] [blame]
Timothy Warren76e04352012-02-14 11:55:17 -05001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2/**
3 * CodeIgniter
4 *
5 * An open source application development framework for PHP 5.1.6 or newer
6 *
7 * NOTICE OF LICENSE
8 *
9 * Licensed under the Open Software License version 3.0
10 *
11 * This source file is subject to the Open Software License (OSL 3.0) that is
12 * bundled with this package in the files license.txt / license.rst. It is
13 * also available through the world wide web at this URL:
14 * http://opensource.org/licenses/OSL-3.0
15 * If you did not receive a copy of the license and are unable to obtain it
16 * through the world wide web, please send an email to
Timothy Warren7221f942012-02-14 15:02:33 -050017 * licensing@ellislab.com so we can send you a copy immediately.
Timothy Warren76e04352012-02-14 11:55:17 -050018 *
Timothy Warren7221f942012-02-14 15:02:33 -050019 * @package CodeIgniter
20 * @author EllisLab Dev Team
21 * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
22 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
23 * @link http://codeigniter.com
24 * @since Version 3.0
25 * @filesource
Timothy Warren76e04352012-02-14 11:55:17 -050026 */
27
28// ------------------------------------------------------------------------
29
30
31
32/**
33 * Firebird/Interbase Database Adapter Class
34 *
35 * Note: _DB is an extender class that the app controller
36 * creates dynamically based on whether the active record
37 * class is being used or not.
38 *
Timothy Warren7221f942012-02-14 15:02:33 -050039 * @package CodeIgniter
40 * @subpackage Drivers
41 * @category Database
42 * @author EllisLab Dev Team
43 * @link http://codeigniter.com/user_guide/database/
Timothy Warren76e04352012-02-14 11:55:17 -050044 */
45class CI_DB_interbase_driver extends CI_DB {
46
47 public $dbdriver = 'interbase';
48
49 // The character used to escape with
50 public $_escape_char = '"';
51
52 // clause and character used for LIKE escape sequences
53 public $_like_escape_str = " ESCAPE '%s' ";
54 public $_like_escape_chr = '!';
55
56 /**
57 * The syntax to count rows is slightly different across different
58 * database engines, so this string appears in each driver and is
59 * used for the count_all() and count_all_results() functions.
60 */
61 public $_count_string = "SELECT COUNT(*) AS ";
62 public $_random_keyword = ' Random()'; // database specific random keyword
63
64 // Keeps track of the resource for the current transaction
65 protected $trans;
66
67 /**
68 * Non-persistent database connection
69 *
Timothy Warren7221f942012-02-14 15:02:33 -050070 * @access private called by the base class
71 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -050072 */
Timothy Warren4be822b2012-02-14 12:07:34 -050073 public function db_connect()
Timothy Warren76e04352012-02-14 11:55:17 -050074 {
Timothy Warren7221f942012-02-14 15:02:33 -050075 if ( ! $conn_id = @ibase_connect($this->database, $this->username, $this->password, $this->char_set))
Timothy Warren76e04352012-02-14 11:55:17 -050076 {
77 log_message('error', $error);
78
79 if ($this->db_debug)
80 {
81 $this->display_error($error, '', TRUE);
82 }
83
84 return FALSE;
85 }
86
87 return $conn_id;
88 }
89
90 // --------------------------------------------------------------------
91
92 /**
93 * Persistent database connection
94 *
Timothy Warren7221f942012-02-14 15:02:33 -050095 * @access private called by the base class
96 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -050097 */
Timothy Warren4be822b2012-02-14 12:07:34 -050098 public function db_pconnect()
Timothy Warren76e04352012-02-14 11:55:17 -050099 {
Timothy Warren7221f942012-02-14 15:02:33 -0500100 if ( ! $conn_id = @ibase_pconnect($this->database, $this->username, $this->password, $this->char_set))
Timothy Warren76e04352012-02-14 11:55:17 -0500101 {
102 log_message('error', $error);
103
104 if ($this->db_debug)
105 {
106 $this->display_error($error, '', TRUE);
107 }
108
109 return FALSE;
110 }
111
112 return $conn_id;
113 }
114
115 // --------------------------------------------------------------------
116
117 /**
118 * Reconnect
119 *
120 * Keep / reestablish the db connection if no queries have been
121 * sent for a length of time exceeding the server's idle timeout
122 *
Timothy Warren7221f942012-02-14 15:02:33 -0500123 * @access public
124 * @return void
Timothy Warren76e04352012-02-14 11:55:17 -0500125 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500126 public function reconnect()
Timothy Warren76e04352012-02-14 11:55:17 -0500127 {
128 // not implemented in Interbase/Firebird
129 }
130
131 // --------------------------------------------------------------------
132
133 /**
134 * Select the database
135 *
Timothy Warren7221f942012-02-14 15:02:33 -0500136 * @access private called by the base class
137 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -0500138 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500139 public function db_select()
Timothy Warren76e04352012-02-14 11:55:17 -0500140 {
141 // Connection selects the database
142 return TRUE;
143 }
144
145 // --------------------------------------------------------------------
146
147 /**
148 * Set client character set
149 *
Timothy Warren7221f942012-02-14 15:02:33 -0500150 * @access public
151 * @param string
152 * @param string
153 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -0500154 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500155 public function db_set_charset($charset, $collation)
Timothy Warren76e04352012-02-14 11:55:17 -0500156 {
Timothy Warren7221f942012-02-14 15:02:33 -0500157 // @todo - add support if needed
Timothy Warren76e04352012-02-14 11:55:17 -0500158 return TRUE;
159 }
160
161 // --------------------------------------------------------------------
162
163 /**
164 * Version number query string
165 *
Timothy Warren7221f942012-02-14 15:02:33 -0500166 * @access public
167 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500168 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500169 public function _version()
Timothy Warren76e04352012-02-14 11:55:17 -0500170 {
Timothy Warren7221f942012-02-14 15:02:33 -0500171 //@todo - add support if needed
Timothy Warren76e04352012-02-14 11:55:17 -0500172 return TRUE;
173 }
174
175 // --------------------------------------------------------------------
176
177 /**
178 * Execute the query
179 *
Timothy Warren7221f942012-02-14 15:02:33 -0500180 * @access private called by the base class
181 * @param string an SQL query
182 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -0500183 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500184 public function _execute($sql)
Timothy Warren76e04352012-02-14 11:55:17 -0500185 {
186 $sql = $this->_prep_query($sql);
Timothy Warren7221f942012-02-14 15:02:33 -0500187 return @ibase_query($this->conn_id, $sql);
Timothy Warren76e04352012-02-14 11:55:17 -0500188 }
189
190 // --------------------------------------------------------------------
191
192 /**
193 * Prep the query
194 *
195 * If needed, each database adapter can prep the query string
196 *
Timothy Warren7221f942012-02-14 15:02:33 -0500197 * @access private called by execute()
198 * @param string an SQL query
199 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500200 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500201 public function _prep_query($sql)
Timothy Warren76e04352012-02-14 11:55:17 -0500202 {
203 return $sql;
204 }
205
206 // --------------------------------------------------------------------
207
208 /**
209 * Begin Transaction
210 *
Timothy Warren7221f942012-02-14 15:02:33 -0500211 * @access public
212 * @return bool
Timothy Warren76e04352012-02-14 11:55:17 -0500213 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500214 public function trans_begin($test_mode = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500215 {
216 if ( ! $this->trans_enabled)
217 {
218 return TRUE;
219 }
220
221 // When transactions are nested we only begin/commit/rollback the outermost ones
222 if ($this->_trans_depth > 0)
223 {
224 return TRUE;
225 }
226
227 // Reset the transaction failure flag.
228 // If the $test_mode flag is set to TRUE transactions will be rolled back
229 // even if the queries produce a successful result.
230 $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
231
Timothy Warren7221f942012-02-14 15:02:33 -0500232 $this->trans = @ibase_trans($this->conn_id);
Timothy Warren76e04352012-02-14 11:55:17 -0500233
234 return TRUE;
235 }
236
237 // --------------------------------------------------------------------
238
239 /**
240 * Commit Transaction
241 *
Timothy Warren7221f942012-02-14 15:02:33 -0500242 * @access public
243 * @return bool
Timothy Warren76e04352012-02-14 11:55:17 -0500244 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500245 public function trans_commit()
Timothy Warren76e04352012-02-14 11:55:17 -0500246 {
247 if ( ! $this->trans_enabled)
248 {
249 return TRUE;
250 }
251
252 // When transactions are nested we only begin/commit/rollback the outermost ones
253 if ($this->_trans_depth > 0)
254 {
255 return TRUE;
256 }
257
Timothy Warren7221f942012-02-14 15:02:33 -0500258 @ibase_commit($this->trans);
Timothy Warren76e04352012-02-14 11:55:17 -0500259
260 return TRUE;
261 }
262
263 // --------------------------------------------------------------------
264
265 /**
266 * Rollback Transaction
267 *
Timothy Warren7221f942012-02-14 15:02:33 -0500268 * @access public
269 * @return bool
Timothy Warren76e04352012-02-14 11:55:17 -0500270 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500271 public function trans_rollback()
Timothy Warren76e04352012-02-14 11:55:17 -0500272 {
273 if ( ! $this->trans_enabled)
274 {
275 return TRUE;
276 }
277
278 // When transactions are nested we only begin/commit/rollback the outermost ones
279 if ($this->_trans_depth > 0)
280 {
281 return TRUE;
282 }
283
Timothy Warren7221f942012-02-14 15:02:33 -0500284 @ibase_rollback($this->trans);
Timothy Warren76e04352012-02-14 11:55:17 -0500285
286 return TRUE;
287 }
288
289 // --------------------------------------------------------------------
290
291 /**
292 * Escape String
293 *
Timothy Warren7221f942012-02-14 15:02:33 -0500294 * @access public
295 * @param string
296 * @param bool whether or not the string will be used in a LIKE condition
297 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500298 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500299 public function escape_str($str, $like = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500300 {
301 if (is_array($str))
302 {
303 foreach ($str as $key => $val)
304 {
305 $str[$key] = $this->escape_str($val, $like);
306 }
307
308 return $str;
309 }
310
311 // escape LIKE condition wildcards
312 if ($like === TRUE)
313 {
314 $str = str_replace( array('%', '_', $this->_like_escape_chr),
315 array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
316 $str);
317 }
318
319 return $str;
320 }
321
322 // --------------------------------------------------------------------
323
324 /**
325 * Affected Rows
326 *
Timothy Warren7221f942012-02-14 15:02:33 -0500327 * @access public
328 * @return integer
Timothy Warren76e04352012-02-14 11:55:17 -0500329 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500330 public function affected_rows()
Timothy Warren76e04352012-02-14 11:55:17 -0500331 {
Timothy Warren7221f942012-02-14 15:02:33 -0500332 return @ibase_affected_rows($this->conn_id);
Timothy Warren76e04352012-02-14 11:55:17 -0500333 }
334
335 // --------------------------------------------------------------------
336
337 /**
338 * Insert ID
339 *
Timothy Warren7221f942012-02-14 15:02:33 -0500340 * @access public
341 * @return integer
Timothy Warren76e04352012-02-14 11:55:17 -0500342 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500343 public function insert_id()
Timothy Warren76e04352012-02-14 11:55:17 -0500344 {
Timothy Warren7221f942012-02-14 15:02:33 -0500345 //@todo Implement manually
Timothy Warren76e04352012-02-14 11:55:17 -0500346 return 0;
347 }
348
349 // --------------------------------------------------------------------
350
351 /**
352 * "Count All" query
353 *
354 * Generates a platform-specific query string that counts all records in
355 * the specified database
356 *
Timothy Warren7221f942012-02-14 15:02:33 -0500357 * @access public
358 * @param string
359 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500360 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500361 public function count_all($table = '')
Timothy Warren76e04352012-02-14 11:55:17 -0500362 {
363 if ($table == '')
364 {
365 return 0;
366 }
367
368 $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
369
370 if ($query->num_rows() == 0)
371 {
372 return 0;
373 }
374
375 $row = $query->row();
376 $this->_reset_select();
377 return (int) $row->numrows;
378 }
379
380 // --------------------------------------------------------------------
381
382 /**
383 * List table query
384 *
385 * Generates a platform-specific query string so that the table names can be fetched
386 *
Timothy Warren7221f942012-02-14 15:02:33 -0500387 * @access private
388 * @param boolean
389 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500390 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500391 public function _list_tables($prefix_limit = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500392 {
393 $sql = <<<SQL
394 SELECT "RDB\$RELATION_NAME" FROM "RDB\$RELATIONS"
395 WHERE "RDB\$RELATION_NAME" NOT LIKE 'RDB$%'
396 AND "RDB\$RELATION_NAME" NOT LIKE 'MON$%'
397SQL;
398
399 if ($prefix_limit !== FALSE AND $this->dbprefix != '')
400 {
401 $sql .= " AND 'name' LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
402 }
403 return $sql;
404 }
405
406 // --------------------------------------------------------------------
407
408 /**
409 * Show column query
410 *
411 * Generates a platform-specific query string so that the column names can be fetched
412 *
Timothy Warren7221f942012-02-14 15:02:33 -0500413 * @access public
414 * @param string the table name
415 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500416 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500417 public function _list_columns($table = '')
Timothy Warren76e04352012-02-14 11:55:17 -0500418 {
419 // Not supported
420 return FALSE;
421 }
422
423 // --------------------------------------------------------------------
424
425 /**
426 * Field data query
427 *
428 * Generates a platform-specific query so that the column data can be retrieved
429 *
Timothy Warren7221f942012-02-14 15:02:33 -0500430 * @access public
431 * @param string the table name
432 * @return object
Timothy Warren76e04352012-02-14 11:55:17 -0500433 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500434 public function _field_data($table)
Timothy Warren76e04352012-02-14 11:55:17 -0500435 {
436 return "SELECT * FROM ".$table." LIMIT 1";
437 }
438
439 // --------------------------------------------------------------------
440
441 /**
442 * The error message string
443 *
Timothy Warren7221f942012-02-14 15:02:33 -0500444 * @access private
445 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500446 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500447 public function _error_message()
Timothy Warren76e04352012-02-14 11:55:17 -0500448 {
449 return ibase_errmsg();
450 }
451
452 // --------------------------------------------------------------------
453
454 /**
455 * The error message number
456 *
Timothy Warren7221f942012-02-14 15:02:33 -0500457 * @access private
458 * @return integer
Timothy Warren76e04352012-02-14 11:55:17 -0500459 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500460 public function _error_number()
Timothy Warren76e04352012-02-14 11:55:17 -0500461 {
462 return ibase_errcode();
463 }
464
465 // --------------------------------------------------------------------
466
467 /**
468 * Escape the SQL Identifiers
469 *
Timothy Warren4be822b2012-02-14 12:07:34 -0500470 * This public function escapes column and table names
Timothy Warren76e04352012-02-14 11:55:17 -0500471 *
Timothy Warren7221f942012-02-14 15:02:33 -0500472 * @access private
473 * @param string
474 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500475 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500476 public function _escape_identifiers($item)
Timothy Warren76e04352012-02-14 11:55:17 -0500477 {
478 foreach ($this->_reserved_identifiers as $id)
479 {
480 if (strpos($item, '.'.$id) !== FALSE)
481 {
482 $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
483
484 // remove duplicates if the user already included the escape
485 return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
486 }
487 }
488
489 if (strpos($item, '.') !== FALSE)
490 {
491 $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
492 }
493 else
494 {
495 $str = $this->_escape_char.$item.$this->_escape_char;
496 }
497
498 // remove duplicates if the user already included the escape
Timothy Warren2d6ae792012-02-14 15:00:52 -0500499 return strtoupper(preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str));
Timothy Warren76e04352012-02-14 11:55:17 -0500500 }
501
502 // --------------------------------------------------------------------
503
504 /**
505 * From Tables
506 *
Timothy Warren4be822b2012-02-14 12:07:34 -0500507 * This public function implicitly groups FROM tables so there is no confusion
Timothy Warren76e04352012-02-14 11:55:17 -0500508 * about operator precedence in harmony with SQL standards
509 *
Timothy Warren7221f942012-02-14 15:02:33 -0500510 * @access public
511 * @param type
512 * @return type
Timothy Warren76e04352012-02-14 11:55:17 -0500513 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500514 public function _from_tables($tables)
Timothy Warren76e04352012-02-14 11:55:17 -0500515 {
516 if ( ! is_array($tables))
517 {
518 $tables = array($tables);
519 }
520
Timothy Warren2d6ae792012-02-14 15:00:52 -0500521 return strtolower(implode(', ', $tables));
Timothy Warren76e04352012-02-14 11:55:17 -0500522 }
523
524 // --------------------------------------------------------------------
525
526 /**
527 * Insert statement
528 *
529 * Generates a platform-specific insert string from the supplied data
530 *
Timothy Warren7221f942012-02-14 15:02:33 -0500531 * @access public
532 * @param string the table name
533 * @param array the insert keys
534 * @param array the insert values
535 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500536 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500537 public function _insert($table, $keys, $values)
Timothy Warren76e04352012-02-14 11:55:17 -0500538 {
Timothy Warren2d6ae792012-02-14 15:00:52 -0500539 return "INSERT INTO ".strtolower($table)." (".strtoupper(implode(', ', $keys)).") VALUES (".implode(', ', $values).")";
Timothy Warren76e04352012-02-14 11:55:17 -0500540 }
541
542 // --------------------------------------------------------------------
543
544 /**
545 * Update statement
546 *
547 * Generates a platform-specific update string from the supplied data
548 *
Timothy Warren7221f942012-02-14 15:02:33 -0500549 * @access public
550 * @param string the table name
551 * @param array the update data
552 * @param array the where clause
553 * @param array the orderby clause
554 * @param array the limit clause
555 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500556 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500557 public function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500558 {
Timothy Warren2d6ae792012-02-14 15:00:52 -0500559 $table = strtolower($table);
560
Timothy Warren76e04352012-02-14 11:55:17 -0500561 foreach ($values as $key => $val)
562 {
563 $valstr[] = $key." = ".$val;
564 }
565
566 $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
567
568 $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
569
570 $sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
571
572 $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
573
574 $sql .= $orderby.$limit;
575
576 return $sql;
577 }
578
579
580 // --------------------------------------------------------------------
581
582 /**
583 * Truncate statement
584 *
585 * Generates a platform-specific truncate string from the supplied data
586 * If the database does not support the truncate() command
Timothy Warren4be822b2012-02-14 12:07:34 -0500587 * This public function maps to "DELETE FROM table"
Timothy Warren76e04352012-02-14 11:55:17 -0500588 *
Timothy Warren7221f942012-02-14 15:02:33 -0500589 * @access public
590 * @param string the table name
591 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500592 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500593 public function _truncate($table)
Timothy Warren76e04352012-02-14 11:55:17 -0500594 {
595 return $this->_delete($table);
596 }
597
598 // --------------------------------------------------------------------
599
600 /**
601 * Delete statement
602 *
603 * Generates a platform-specific delete string from the supplied data
604 *
Timothy Warren7221f942012-02-14 15:02:33 -0500605 * @access public
606 * @param string the table name
607 * @param array the where clause
608 * @param string the limit clause
609 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500610 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500611 public function _delete($table, $where = array(), $like = array(), $limit = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500612 {
Timothy Warren2d6ae792012-02-14 15:00:52 -0500613 $table = strtolower($table);
614
Timothy Warren76e04352012-02-14 11:55:17 -0500615 $conditions = '';
616
617 if (count($where) > 0 OR count($like) > 0)
618 {
619 $conditions = "\nWHERE ";
620 $conditions .= implode("\n", $this->ar_where);
621
622 if (count($where) > 0 && count($like) > 0)
623 {
624 $conditions .= " AND ";
625 }
626 $conditions .= implode("\n", $like);
627 }
628
629 $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
630
631 return "DELETE FROM ".$table.$conditions.$limit;
632 }
633
634 // --------------------------------------------------------------------
635
636 /**
637 * Limit string
638 *
639 * Generates a platform-specific LIMIT clause
640 *
Timothy Warren7221f942012-02-14 15:02:33 -0500641 * @access public
642 * @param string the sql query string
643 * @param integer the number of rows to limit the query to
644 * @param integer the offset value
645 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500646 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500647 public function _limit($sql, $limit, $offset)
Timothy Warren76e04352012-02-14 11:55:17 -0500648 {
649 if ($offset == 0)
650 {
651 $offset = '';
652 }
653 else
654 {
655 $offset .= ", ";
656 }
657
658 return $sql."LIMIT ".$offset.$limit;
659 }
660
661 // --------------------------------------------------------------------
662
663 /**
664 * Close DB Connection
665 *
Timothy Warren7221f942012-02-14 15:02:33 -0500666 * @access public
667 * @param resource
668 * @return void
Timothy Warren76e04352012-02-14 11:55:17 -0500669 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500670 public function _close($conn_id)
Timothy Warren76e04352012-02-14 11:55:17 -0500671 {
Timothy Warren7221f942012-02-14 15:02:33 -0500672 @ibase_close($conn_id);
Timothy Warren76e04352012-02-14 11:55:17 -0500673 }
Timothy Warren76e04352012-02-14 11:55:17 -0500674}
675
676
677/* End of file interbase_driver.php */
678/* Location: ./system/database/drivers/interbase/interbase_driver.php */