blob: 36ef42ef3629a513d93220c9b2484de90b0bd79c [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
Timothy Warren76e04352012-02-14 11:55:17 -050030/**
31 * Firebird/Interbase Database Adapter Class
32 *
33 * Note: _DB is an extender class that the app controller
34 * creates dynamically based on whether the active record
35 * class is being used or not.
36 *
Timothy Warren7221f942012-02-14 15:02:33 -050037 * @package CodeIgniter
38 * @subpackage Drivers
39 * @category Database
40 * @author EllisLab Dev Team
41 * @link http://codeigniter.com/user_guide/database/
Timothy Warren76e04352012-02-14 11:55:17 -050042 */
43class CI_DB_interbase_driver extends CI_DB {
44
45 public $dbdriver = 'interbase';
46
47 // The character used to escape with
48 public $_escape_char = '"';
49
50 // clause and character used for LIKE escape sequences
51 public $_like_escape_str = " ESCAPE '%s' ";
52 public $_like_escape_chr = '!';
53
54 /**
55 * The syntax to count rows is slightly different across different
56 * database engines, so this string appears in each driver and is
57 * used for the count_all() and count_all_results() functions.
58 */
59 public $_count_string = "SELECT COUNT(*) AS ";
60 public $_random_keyword = ' Random()'; // database specific random keyword
61
62 // Keeps track of the resource for the current transaction
63 protected $trans;
64
65 /**
66 * Non-persistent database connection
67 *
Timothy Warren7221f942012-02-14 15:02:33 -050068 * @access private called by the base class
69 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -050070 */
Timothy Warren4be822b2012-02-14 12:07:34 -050071 public function db_connect()
Timothy Warren76e04352012-02-14 11:55:17 -050072 {
Timothy Warren7221f942012-02-14 15:02:33 -050073 if ( ! $conn_id = @ibase_connect($this->database, $this->username, $this->password, $this->char_set))
Timothy Warren76e04352012-02-14 11:55:17 -050074 {
Timothy Warrend19e47a2012-02-14 23:40:40 -050075 log_message('error', $this->_error_message());
Timothy Warren76e04352012-02-14 11:55:17 -050076
77 if ($this->db_debug)
78 {
Timothy Warrend19e47a2012-02-14 23:40:40 -050079 $this->display_error($this->_error_message(), '', TRUE);
Timothy Warren76e04352012-02-14 11:55:17 -050080 }
81
82 return FALSE;
83 }
84
85 return $conn_id;
86 }
87
88 // --------------------------------------------------------------------
89
90 /**
91 * Persistent database connection
92 *
Timothy Warren7221f942012-02-14 15:02:33 -050093 * @access private called by the base class
94 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -050095 */
Timothy Warren4be822b2012-02-14 12:07:34 -050096 public function db_pconnect()
Timothy Warren76e04352012-02-14 11:55:17 -050097 {
Timothy Warren7221f942012-02-14 15:02:33 -050098 if ( ! $conn_id = @ibase_pconnect($this->database, $this->username, $this->password, $this->char_set))
Timothy Warren76e04352012-02-14 11:55:17 -050099 {
Timothy Warrend19e47a2012-02-14 23:40:40 -0500100 log_message('error', $this->_error_message());
Timothy Warren76e04352012-02-14 11:55:17 -0500101
102 if ($this->db_debug)
103 {
Timothy Warrend19e47a2012-02-14 23:40:40 -0500104 $this->display_error($this->_error_message(), '', TRUE);
Timothy Warren76e04352012-02-14 11:55:17 -0500105 }
106
107 return FALSE;
108 }
109
110 return $conn_id;
111 }
112
113 // --------------------------------------------------------------------
114
115 /**
116 * Reconnect
117 *
118 * Keep / reestablish the db connection if no queries have been
119 * sent for a length of time exceeding the server's idle timeout
120 *
Timothy Warren7221f942012-02-14 15:02:33 -0500121 * @access public
122 * @return void
Timothy Warren76e04352012-02-14 11:55:17 -0500123 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500124 public function reconnect()
Timothy Warren76e04352012-02-14 11:55:17 -0500125 {
126 // not implemented in Interbase/Firebird
127 }
128
129 // --------------------------------------------------------------------
130
131 /**
132 * Select the database
133 *
Timothy Warren7221f942012-02-14 15:02:33 -0500134 * @access private called by the base class
135 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -0500136 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500137 public function db_select()
Timothy Warren76e04352012-02-14 11:55:17 -0500138 {
139 // Connection selects the database
140 return TRUE;
141 }
142
143 // --------------------------------------------------------------------
144
145 /**
146 * Set client character set
147 *
Timothy Warren7221f942012-02-14 15:02:33 -0500148 * @access public
149 * @param string
150 * @param string
151 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -0500152 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500153 public function db_set_charset($charset, $collation)
Timothy Warren76e04352012-02-14 11:55:17 -0500154 {
Timothy Warren3d985a12012-02-15 11:38:00 -0500155 // Must be determined at connection
Timothy Warren76e04352012-02-14 11:55:17 -0500156 return TRUE;
157 }
158
159 // --------------------------------------------------------------------
160
161 /**
162 * Version number query string
163 *
Timothy Warren7221f942012-02-14 15:02:33 -0500164 * @access public
165 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500166 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500167 public function _version()
Timothy Warren76e04352012-02-14 11:55:17 -0500168 {
Timothy Warren3d985a12012-02-15 11:38:00 -0500169 if (($service = ibase_service_attach($this->hostname, $this->username, $this->password)))
170 {
171 $version = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
172 return $version;
173 }
174
175 return FALSE;
Timothy Warren76e04352012-02-14 11:55:17 -0500176 }
177
178 // --------------------------------------------------------------------
179
180 /**
181 * Execute the query
182 *
Timothy Warren7221f942012-02-14 15:02:33 -0500183 * @access private called by the base class
184 * @param string an SQL query
185 * @return resource
Timothy Warren76e04352012-02-14 11:55:17 -0500186 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500187 public function _execute($sql)
Timothy Warren76e04352012-02-14 11:55:17 -0500188 {
189 $sql = $this->_prep_query($sql);
Timothy Warren7221f942012-02-14 15:02:33 -0500190 return @ibase_query($this->conn_id, $sql);
Timothy Warren76e04352012-02-14 11:55:17 -0500191 }
192
193 // --------------------------------------------------------------------
194
195 /**
196 * Prep the query
197 *
198 * If needed, each database adapter can prep the query string
199 *
Timothy Warren7221f942012-02-14 15:02:33 -0500200 * @access private called by execute()
201 * @param string an SQL query
202 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500203 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500204 public function _prep_query($sql)
Timothy Warren76e04352012-02-14 11:55:17 -0500205 {
206 return $sql;
207 }
208
209 // --------------------------------------------------------------------
210
211 /**
212 * Begin Transaction
213 *
Timothy Warren7221f942012-02-14 15:02:33 -0500214 * @access public
215 * @return bool
Timothy Warren76e04352012-02-14 11:55:17 -0500216 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500217 public function trans_begin($test_mode = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500218 {
219 if ( ! $this->trans_enabled)
220 {
221 return TRUE;
222 }
223
224 // When transactions are nested we only begin/commit/rollback the outermost ones
225 if ($this->_trans_depth > 0)
226 {
227 return TRUE;
228 }
229
230 // Reset the transaction failure flag.
231 // If the $test_mode flag is set to TRUE transactions will be rolled back
232 // even if the queries produce a successful result.
233 $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
234
Timothy Warren7221f942012-02-14 15:02:33 -0500235 $this->trans = @ibase_trans($this->conn_id);
Timothy Warren76e04352012-02-14 11:55:17 -0500236
237 return TRUE;
238 }
239
240 // --------------------------------------------------------------------
241
242 /**
243 * Commit Transaction
244 *
Timothy Warren7221f942012-02-14 15:02:33 -0500245 * @access public
246 * @return bool
Timothy Warren76e04352012-02-14 11:55:17 -0500247 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500248 public function trans_commit()
Timothy Warren76e04352012-02-14 11:55:17 -0500249 {
250 if ( ! $this->trans_enabled)
251 {
252 return TRUE;
253 }
254
255 // When transactions are nested we only begin/commit/rollback the outermost ones
256 if ($this->_trans_depth > 0)
257 {
258 return TRUE;
259 }
260
Timothy Warren7221f942012-02-14 15:02:33 -0500261 @ibase_commit($this->trans);
Timothy Warren76e04352012-02-14 11:55:17 -0500262
263 return TRUE;
264 }
265
266 // --------------------------------------------------------------------
267
268 /**
269 * Rollback Transaction
270 *
Timothy Warren7221f942012-02-14 15:02:33 -0500271 * @access public
272 * @return bool
Timothy Warren76e04352012-02-14 11:55:17 -0500273 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500274 public function trans_rollback()
Timothy Warren76e04352012-02-14 11:55:17 -0500275 {
276 if ( ! $this->trans_enabled)
277 {
278 return TRUE;
279 }
280
281 // When transactions are nested we only begin/commit/rollback the outermost ones
282 if ($this->_trans_depth > 0)
283 {
284 return TRUE;
285 }
286
Timothy Warren7221f942012-02-14 15:02:33 -0500287 @ibase_rollback($this->trans);
Timothy Warren76e04352012-02-14 11:55:17 -0500288
289 return TRUE;
290 }
291
292 // --------------------------------------------------------------------
293
294 /**
295 * Escape String
296 *
Timothy Warren7221f942012-02-14 15:02:33 -0500297 * @access public
298 * @param string
299 * @param bool whether or not the string will be used in a LIKE condition
300 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500301 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500302 public function escape_str($str, $like = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500303 {
304 if (is_array($str))
305 {
306 foreach ($str as $key => $val)
307 {
308 $str[$key] = $this->escape_str($val, $like);
309 }
310
311 return $str;
312 }
313
314 // escape LIKE condition wildcards
315 if ($like === TRUE)
316 {
317 $str = str_replace( array('%', '_', $this->_like_escape_chr),
318 array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
319 $str);
320 }
321
322 return $str;
323 }
324
325 // --------------------------------------------------------------------
326
327 /**
328 * Affected Rows
329 *
Timothy Warren7221f942012-02-14 15:02:33 -0500330 * @access public
331 * @return integer
Timothy Warren76e04352012-02-14 11:55:17 -0500332 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500333 public function affected_rows()
Timothy Warren76e04352012-02-14 11:55:17 -0500334 {
Timothy Warren7221f942012-02-14 15:02:33 -0500335 return @ibase_affected_rows($this->conn_id);
Timothy Warren76e04352012-02-14 11:55:17 -0500336 }
337
338 // --------------------------------------------------------------------
339
340 /**
341 * Insert ID
342 *
Timothy Warren7221f942012-02-14 15:02:33 -0500343 * @access public
344 * @return integer
Timothy Warren76e04352012-02-14 11:55:17 -0500345 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500346 public function insert_id()
Timothy Warren76e04352012-02-14 11:55:17 -0500347 {
Timothy Warren7221f942012-02-14 15:02:33 -0500348 //@todo Implement manually
Timothy Warren76e04352012-02-14 11:55:17 -0500349 return 0;
350 }
351
352 // --------------------------------------------------------------------
353
354 /**
355 * "Count All" query
356 *
357 * Generates a platform-specific query string that counts all records in
358 * the specified database
359 *
Timothy Warren7221f942012-02-14 15:02:33 -0500360 * @access public
361 * @param string
362 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500363 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500364 public function count_all($table = '')
Timothy Warren76e04352012-02-14 11:55:17 -0500365 {
366 if ($table == '')
367 {
368 return 0;
369 }
370
371 $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
372
373 if ($query->num_rows() == 0)
374 {
375 return 0;
376 }
377
378 $row = $query->row();
379 $this->_reset_select();
380 return (int) $row->numrows;
381 }
382
383 // --------------------------------------------------------------------
384
385 /**
386 * List table query
387 *
388 * Generates a platform-specific query string so that the table names can be fetched
389 *
Timothy Warren7221f942012-02-14 15:02:33 -0500390 * @access private
391 * @param boolean
392 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500393 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500394 public function _list_tables($prefix_limit = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500395 {
396 $sql = <<<SQL
397 SELECT "RDB\$RELATION_NAME" FROM "RDB\$RELATIONS"
398 WHERE "RDB\$RELATION_NAME" NOT LIKE 'RDB$%'
399 AND "RDB\$RELATION_NAME" NOT LIKE 'MON$%'
400SQL;
401
402 if ($prefix_limit !== FALSE AND $this->dbprefix != '')
403 {
Timothy Warren3d985a12012-02-15 11:38:00 -0500404 $sql .= ' AND "RDB$RELATION_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
Timothy Warren76e04352012-02-14 11:55:17 -0500405 }
406 return $sql;
407 }
408
409 // --------------------------------------------------------------------
410
411 /**
412 * Show column query
413 *
414 * Generates a platform-specific query string so that the column names can be fetched
415 *
Timothy Warren7221f942012-02-14 15:02:33 -0500416 * @access public
417 * @param string the table name
418 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500419 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500420 public function _list_columns($table = '')
Timothy Warren76e04352012-02-14 11:55:17 -0500421 {
422 // Not supported
423 return FALSE;
424 }
425
426 // --------------------------------------------------------------------
427
428 /**
429 * Field data query
430 *
431 * Generates a platform-specific query so that the column data can be retrieved
432 *
Timothy Warren7221f942012-02-14 15:02:33 -0500433 * @access public
434 * @param string the table name
435 * @return object
Timothy Warren76e04352012-02-14 11:55:17 -0500436 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500437 public function _field_data($table)
Timothy Warren76e04352012-02-14 11:55:17 -0500438 {
439 return "SELECT * FROM ".$table." LIMIT 1";
440 }
441
442 // --------------------------------------------------------------------
443
444 /**
445 * The error message string
446 *
Timothy Warren7221f942012-02-14 15:02:33 -0500447 * @access private
448 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500449 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500450 public function _error_message()
Timothy Warren76e04352012-02-14 11:55:17 -0500451 {
452 return ibase_errmsg();
453 }
454
455 // --------------------------------------------------------------------
456
457 /**
458 * The error message number
459 *
Timothy Warren7221f942012-02-14 15:02:33 -0500460 * @access private
461 * @return integer
Timothy Warren76e04352012-02-14 11:55:17 -0500462 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500463 public function _error_number()
Timothy Warren76e04352012-02-14 11:55:17 -0500464 {
465 return ibase_errcode();
466 }
467
468 // --------------------------------------------------------------------
469
470 /**
471 * Escape the SQL Identifiers
472 *
Timothy Warren4be822b2012-02-14 12:07:34 -0500473 * This public function escapes column and table names
Timothy Warren76e04352012-02-14 11:55:17 -0500474 *
Timothy Warren7221f942012-02-14 15:02:33 -0500475 * @access private
476 * @param string
477 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500478 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500479 public function _escape_identifiers($item)
Timothy Warren76e04352012-02-14 11:55:17 -0500480 {
481 foreach ($this->_reserved_identifiers as $id)
482 {
483 if (strpos($item, '.'.$id) !== FALSE)
484 {
485 $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
486
487 // remove duplicates if the user already included the escape
488 return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
489 }
490 }
491
492 if (strpos($item, '.') !== FALSE)
493 {
494 $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
495 }
496 else
497 {
498 $str = $this->_escape_char.$item.$this->_escape_char;
499 }
500
501 // remove duplicates if the user already included the escape
Timothy Warrend19e47a2012-02-14 23:40:40 -0500502 return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
Timothy Warren76e04352012-02-14 11:55:17 -0500503 }
504
505 // --------------------------------------------------------------------
506
507 /**
508 * From Tables
509 *
Timothy Warren4be822b2012-02-14 12:07:34 -0500510 * This public function implicitly groups FROM tables so there is no confusion
Timothy Warren76e04352012-02-14 11:55:17 -0500511 * about operator precedence in harmony with SQL standards
512 *
Timothy Warren7221f942012-02-14 15:02:33 -0500513 * @access public
514 * @param type
515 * @return type
Timothy Warren76e04352012-02-14 11:55:17 -0500516 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500517 public function _from_tables($tables)
Timothy Warren76e04352012-02-14 11:55:17 -0500518 {
519 if ( ! is_array($tables))
520 {
521 $tables = array($tables);
522 }
523
Timothy Warrend19e47a2012-02-14 23:40:40 -0500524 return implode(', ', $tables);
Timothy Warren76e04352012-02-14 11:55:17 -0500525 }
526
527 // --------------------------------------------------------------------
528
529 /**
530 * Insert statement
531 *
532 * Generates a platform-specific insert string from the supplied data
533 *
Timothy Warren7221f942012-02-14 15:02:33 -0500534 * @access public
535 * @param string the table name
536 * @param array the insert keys
537 * @param array the insert values
538 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500539 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500540 public function _insert($table, $keys, $values)
Timothy Warren76e04352012-02-14 11:55:17 -0500541 {
Timothy Warrend19e47a2012-02-14 23:40:40 -0500542 return "INSERT INTO {$table} (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
Timothy Warren76e04352012-02-14 11:55:17 -0500543 }
544
545 // --------------------------------------------------------------------
546
547 /**
548 * Update statement
549 *
550 * Generates a platform-specific update string from the supplied data
551 *
Timothy Warren7221f942012-02-14 15:02:33 -0500552 * @access public
553 * @param string the table name
554 * @param array the update data
555 * @param array the where clause
556 * @param array the orderby clause
557 * @param array the limit clause
558 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500559 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500560 public function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500561 {
562 foreach ($values as $key => $val)
563 {
564 $valstr[] = $key." = ".$val;
565 }
566
567 $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
568
569 $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
570
571 $sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
572
573 $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
574
575 $sql .= $orderby.$limit;
576
577 return $sql;
578 }
579
580
581 // --------------------------------------------------------------------
582
583 /**
584 * Truncate statement
585 *
586 * Generates a platform-specific truncate string from the supplied data
587 * If the database does not support the truncate() command
Timothy Warren4be822b2012-02-14 12:07:34 -0500588 * This public function maps to "DELETE FROM table"
Timothy Warren76e04352012-02-14 11:55:17 -0500589 *
Timothy Warren7221f942012-02-14 15:02:33 -0500590 * @access public
591 * @param string the table name
592 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500593 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500594 public function _truncate($table)
Timothy Warren76e04352012-02-14 11:55:17 -0500595 {
596 return $this->_delete($table);
597 }
598
599 // --------------------------------------------------------------------
600
601 /**
602 * Delete statement
603 *
604 * Generates a platform-specific delete string from the supplied data
605 *
Timothy Warren7221f942012-02-14 15:02:33 -0500606 * @access public
607 * @param string the table name
608 * @param array the where clause
609 * @param string the limit clause
610 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500611 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500612 public function _delete($table, $where = array(), $like = array(), $limit = FALSE)
Timothy Warren76e04352012-02-14 11:55:17 -0500613 {
614 $conditions = '';
615
616 if (count($where) > 0 OR count($like) > 0)
617 {
618 $conditions = "\nWHERE ";
619 $conditions .= implode("\n", $this->ar_where);
620
621 if (count($where) > 0 && count($like) > 0)
622 {
623 $conditions .= " AND ";
624 }
625 $conditions .= implode("\n", $like);
626 }
627
Timothy Warren3d985a12012-02-15 11:38:00 -0500628 //$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
Timothy Warren76e04352012-02-14 11:55:17 -0500629
630 return "DELETE FROM ".$table.$conditions.$limit;
631 }
632
633 // --------------------------------------------------------------------
634
635 /**
636 * Limit string
637 *
638 * Generates a platform-specific LIMIT clause
639 *
Timothy Warren7221f942012-02-14 15:02:33 -0500640 * @access public
641 * @param string the sql query string
642 * @param integer the number of rows to limit the query to
643 * @param integer the offset value
644 * @return string
Timothy Warren76e04352012-02-14 11:55:17 -0500645 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500646 public function _limit($sql, $limit, $offset)
Timothy Warren76e04352012-02-14 11:55:17 -0500647 {
Timothy Warren3d985a12012-02-15 11:38:00 -0500648 //There doesn't seem to be a limit clause?
649 return $sql;
Timothy Warren76e04352012-02-14 11:55:17 -0500650 }
651
652 // --------------------------------------------------------------------
653
654 /**
655 * Close DB Connection
656 *
Timothy Warren7221f942012-02-14 15:02:33 -0500657 * @access public
658 * @param resource
659 * @return void
Timothy Warren76e04352012-02-14 11:55:17 -0500660 */
Timothy Warren4be822b2012-02-14 12:07:34 -0500661 public function _close($conn_id)
Timothy Warren76e04352012-02-14 11:55:17 -0500662 {
Timothy Warren7221f942012-02-14 15:02:33 -0500663 @ibase_close($conn_id);
Timothy Warren76e04352012-02-14 11:55:17 -0500664 }
Timothy Warren76e04352012-02-14 11:55:17 -0500665}
666
667
668/* End of file interbase_driver.php */
669/* Location: ./system/database/drivers/interbase/interbase_driver.php */