blob: 6663868bd9e366c6acab1f94b8a9ba64e19777d9 [file] [log] [blame]
Andrey Andreevc5536aa2012-11-01 17:33:58 +02001<?php
Esen Sagynov2e087942011-08-09 23:35:01 -07002/**
3 * CodeIgniter
4 *
Phil Sturgeon07c1ac82012-03-09 17:03:37 +00005 * An open source application development framework for PHP 5.2.4 or newer
Esen Sagynov2e087942011-08-09 23:35:01 -07006 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05007 * NOTICE OF LICENSE
Andrey Andreev592f4ec2012-03-20 15:10:08 +02008 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05009 * Licensed under the Open Software License version 3.0
Andrey Andreev592f4ec2012-03-20 15:10:08 +020010 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -050011 * 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
17 * licensing@ellislab.com so we can send you a copy immediately.
18 *
Esen Sagynov2e087942011-08-09 23:35:01 -070019 * @package CodeIgniter
Derek Jonesf4a4bd82011-10-20 12:18:42 -050020 * @author EllisLab Dev Team
Andrey Andreev80500af2013-01-01 08:16:53 +020021 * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/)
Derek Jonesf4a4bd82011-10-20 12:18:42 -050022 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
Esen Sagynov2e087942011-08-09 23:35:01 -070023 * @link http://codeigniter.com
Andrey Andreevcf631202012-02-16 11:36:28 +020024 * @since Version 2.1
Esen Sagynov2e087942011-08-09 23:35:01 -070025 * @filesource
26 */
Andrey Andreevc5536aa2012-11-01 17:33:58 +020027defined('BASEPATH') OR exit('No direct script access allowed');
Esen Sagynov2e087942011-08-09 23:35:01 -070028
Esen Sagynov2e087942011-08-09 23:35:01 -070029/**
30 * CUBRID Database Adapter Class
31 *
32 * Note: _DB is an extender class that the app controller
Jamie Rumbelow7efad202012-02-19 12:37:00 +000033 * creates dynamically based on whether the query builder
Esen Sagynov2e087942011-08-09 23:35:01 -070034 * class is being used or not.
35 *
36 * @package CodeIgniter
37 * @subpackage Drivers
38 * @category Database
Esen Sagynov2ab2b1e2011-08-11 00:41:16 -070039 * @author Esen Sagynov
Esen Sagynov2e087942011-08-09 23:35:01 -070040 * @link http://codeigniter.com/user_guide/database/
41 */
Esen Sagynov2ab2b1e2011-08-11 00:41:16 -070042class CI_DB_cubrid_driver extends CI_DB {
43
Andrey Andreeva24e52e2012-11-02 03:54:12 +020044 /**
45 * Database driver
46 *
47 * @var string
48 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +020049 public $dbdriver = 'cubrid';
Esen Sagynov2e087942011-08-09 23:35:01 -070050
Andrey Andreeva24e52e2012-11-02 03:54:12 +020051 /**
52 * Auto-commit flag
53 *
54 * @var bool
55 */
Andrey Andreeva00e5042012-03-26 12:23:13 +030056 public $auto_commit = TRUE;
57
Andrey Andreeva24e52e2012-11-02 03:54:12 +020058 // --------------------------------------------------------------------
59
Andrey Andreev5fd3ae82012-10-24 14:55:35 +030060 /**
Andrey Andreeva24e52e2012-11-02 03:54:12 +020061 * Identifier escape character
62 *
63 * @var string
64 */
65 protected $_escape_char = '`';
66
Andrey Andreev98e46cf2012-11-13 03:01:42 +020067 /**
68 * ORDER BY random keyword
69 *
70 * @var array
71 */
72 protected $_random_keyword = array('RANDOM()', 'RANDOM(%d)');
73
Andrey Andreeva24e52e2012-11-02 03:54:12 +020074 // --------------------------------------------------------------------
75
76 /**
77 * Class constructor
Andrey Andreev5fd3ae82012-10-24 14:55:35 +030078 *
79 * @param array $params
80 * @return void
81 */
Andrey Andreeva00e5042012-03-26 12:23:13 +030082 public function __construct($params)
83 {
84 parent::__construct($params);
85
86 if (preg_match('/^CUBRID:[^:]+(:[0-9][1-9]{0,4})?:[^:]+:[^:]*:[^:]*:(\?.+)?$/', $this->dsn, $matches))
87 {
88 if (stripos($matches[2], 'autocommit=off') !== FALSE)
89 {
90 $this->auto_commit = FALSE;
91 }
92 }
93 else
94 {
95 // If no port is defined by the user, use the default value
Andrey Andreeve4c30192012-06-04 15:08:24 +030096 empty($this->port) OR $this->port = 33000;
Andrey Andreeva00e5042012-03-26 12:23:13 +030097 }
98 }
Esen Sagynov2e087942011-08-09 23:35:01 -070099
Andrey Andreev2ea33c32012-10-04 12:37:51 +0300100 // --------------------------------------------------------------------
101
Esen Sagynov2e087942011-08-09 23:35:01 -0700102 /**
103 * Non-persistent database connection
104 *
Esen Sagynov2e087942011-08-09 23:35:01 -0700105 * @return resource
106 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200107 public function db_connect()
Esen Sagynov2e087942011-08-09 23:35:01 -0700108 {
Andrey Andreeva00e5042012-03-26 12:23:13 +0300109 return $this->_cubrid_connect();
Esen Sagynov2e087942011-08-09 23:35:01 -0700110 }
111
112 // --------------------------------------------------------------------
113
114 /**
115 * Persistent database connection
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200116 *
Esen Sagynov2e087942011-08-09 23:35:01 -0700117 * In CUBRID persistent DB connection is supported natively in CUBRID
118 * engine which can be configured in the CUBRID Broker configuration
119 * file by setting the CCI_PCONNECT parameter to ON. In that case, all
120 * connections established between the client application and the
Andrey Andreeva00e5042012-03-26 12:23:13 +0300121 * server will become persistent.
Esen Sagynov2e087942011-08-09 23:35:01 -0700122 *
Esen Sagynov2e087942011-08-09 23:35:01 -0700123 * @return resource
124 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200125 public function db_pconnect()
Esen Sagynov2e087942011-08-09 23:35:01 -0700126 {
Andrey Andreeva00e5042012-03-26 12:23:13 +0300127 return $this->_cubrid_connect(TRUE);
128 }
129
130 // --------------------------------------------------------------------
131
132 /**
133 * CUBRID connection
134 *
135 * A CUBRID-specific method to create a connection to the database.
136 * Except for determining if a persistent connection should be used,
137 * the rest of the logic is the same for db_connect() and db_pconnect().
138 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200139 * @param bool $persistent
Andrey Andreeva00e5042012-03-26 12:23:13 +0300140 * @return resource
141 */
142 protected function _cubrid_connect($persistent = FALSE)
143 {
144 if (preg_match('/^CUBRID:[^:]+(:[0-9][1-9]{0,4})?:[^:]+:([^:]*):([^:]*):(\?.+)?$/', $this->dsn, $matches))
145 {
146 $_temp = ($persistent !== TRUE) ? 'cubrid_connect_with_url' : 'cubrid_pconnect_with_url';
147 $conn_id = ($matches[2] === '' && $matches[3] === '' && $this->username !== '' && $this->password !== '')
148 ? $_temp($this->dsn, $this->username, $this->password)
149 : $_temp($this->dsn);
150 }
151 else
152 {
153 $_temp = ($persistent !== TRUE) ? 'cubrid_connect' : 'cubrid_pconnect';
154 $conn_id = ($this->username !== '')
155 ? $_temp($this->hostname, $this->port, $this->database, $this->username, $this->password)
156 : $_temp($this->hostname, $this->port, $this->database);
157 }
158
159 return $conn_id;
Esen Sagynov2e087942011-08-09 23:35:01 -0700160 }
161
162 // --------------------------------------------------------------------
163
164 /**
165 * Reconnect
166 *
167 * Keep / reestablish the db connection if no queries have been
168 * sent for a length of time exceeding the server's idle timeout
169 *
Esen Sagynov2e087942011-08-09 23:35:01 -0700170 * @return void
171 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200172 public function reconnect()
Esen Sagynov2e087942011-08-09 23:35:01 -0700173 {
174 if (cubrid_ping($this->conn_id) === FALSE)
175 {
176 $this->conn_id = FALSE;
177 }
178 }
179
180 // --------------------------------------------------------------------
181
182 /**
Andrey Andreev08856b82012-03-03 03:19:28 +0200183 * Database version number
Esen Sagynov2e087942011-08-09 23:35:01 -0700184 *
Esen Sagynov2e087942011-08-09 23:35:01 -0700185 * @return string
186 */
Andrey Andreev08856b82012-03-03 03:19:28 +0200187 public function version()
Esen Sagynov2e087942011-08-09 23:35:01 -0700188 {
Andrey Andreev2b730372012-11-05 17:01:11 +0200189 if (isset($this->data_cache['version']))
190 {
191 return $this->data_cache['version'];
192 }
193 elseif ( ! $this->conn_id)
194 {
195 $this->initialize();
196 }
197
198 return ( ! $this->conn_id OR ($version = cubrid_get_server_info($this->conn_id)) === FALSE)
199 ? FALSE
200 : $this->data_cache['version'] = $version;
Esen Sagynov2e087942011-08-09 23:35:01 -0700201 }
202
203 // --------------------------------------------------------------------
204
205 /**
206 * Execute the query
207 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200208 * @param string $sql an SQL query
Esen Sagynov2e087942011-08-09 23:35:01 -0700209 * @return resource
210 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200211 protected function _execute($sql)
Esen Sagynov2e087942011-08-09 23:35:01 -0700212 {
Esen Sagynov2e087942011-08-09 23:35:01 -0700213 return @cubrid_query($sql, $this->conn_id);
214 }
215
216 // --------------------------------------------------------------------
217
218 /**
Esen Sagynov2e087942011-08-09 23:35:01 -0700219 * Begin Transaction
220 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200221 * @param bool $test_mode
Esen Sagynov2e087942011-08-09 23:35:01 -0700222 * @return bool
223 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200224 public function trans_begin($test_mode = FALSE)
Esen Sagynov2e087942011-08-09 23:35:01 -0700225 {
Esen Sagynov2e087942011-08-09 23:35:01 -0700226 // When transactions are nested we only begin/commit/rollback the outermost ones
Andrey Andreev7f55d612012-01-26 13:44:28 +0200227 if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
Esen Sagynov2e087942011-08-09 23:35:01 -0700228 {
229 return TRUE;
230 }
231
232 // Reset the transaction failure flag.
233 // If the $test_mode flag is set to TRUE transactions will be rolled back
234 // even if the queries produce a successful result.
Andrey Andreev7f55d612012-01-26 13:44:28 +0200235 $this->_trans_failure = ($test_mode === TRUE);
Esen Sagynov2e087942011-08-09 23:35:01 -0700236
Esen Sagynov2ab2b1e2011-08-11 00:41:16 -0700237 if (cubrid_get_autocommit($this->conn_id))
238 {
239 cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_FALSE);
240 }
Esen Sagynov2e087942011-08-09 23:35:01 -0700241
242 return TRUE;
243 }
244
245 // --------------------------------------------------------------------
246
247 /**
248 * Commit Transaction
249 *
Esen Sagynov2e087942011-08-09 23:35:01 -0700250 * @return bool
251 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200252 public function trans_commit()
Esen Sagynov2e087942011-08-09 23:35:01 -0700253 {
Esen Sagynov2e087942011-08-09 23:35:01 -0700254 // When transactions are nested we only begin/commit/rollback the outermost ones
Andrey Andreev7f55d612012-01-26 13:44:28 +0200255 if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
Esen Sagynov2e087942011-08-09 23:35:01 -0700256 {
257 return TRUE;
258 }
259
260 cubrid_commit($this->conn_id);
261
Esen Sagynov2ab2b1e2011-08-11 00:41:16 -0700262 if ($this->auto_commit && ! cubrid_get_autocommit($this->conn_id))
263 {
264 cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE);
265 }
266
Esen Sagynov2e087942011-08-09 23:35:01 -0700267 return TRUE;
268 }
269
270 // --------------------------------------------------------------------
271
272 /**
273 * Rollback Transaction
274 *
Esen Sagynov2e087942011-08-09 23:35:01 -0700275 * @return bool
276 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200277 public function trans_rollback()
Esen Sagynov2e087942011-08-09 23:35:01 -0700278 {
Esen Sagynov2e087942011-08-09 23:35:01 -0700279 // When transactions are nested we only begin/commit/rollback the outermost ones
Andrey Andreev7f55d612012-01-26 13:44:28 +0200280 if ( ! $this->trans_enabled OR $this->_trans_depth > 0)
Esen Sagynov2e087942011-08-09 23:35:01 -0700281 {
282 return TRUE;
283 }
284
285 cubrid_rollback($this->conn_id);
286
Esen Sagynov2ab2b1e2011-08-11 00:41:16 -0700287 if ($this->auto_commit && ! cubrid_get_autocommit($this->conn_id))
288 {
289 cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE);
290 }
291
Esen Sagynov2e087942011-08-09 23:35:01 -0700292 return TRUE;
293 }
294
295 // --------------------------------------------------------------------
296
297 /**
Andrey Andreev0b6a4922013-01-10 16:53:44 +0200298 * Platform-dependant string escape
Esen Sagynov2e087942011-08-09 23:35:01 -0700299 *
Andrey Andreev0b6a4922013-01-10 16:53:44 +0200300 * @param string
Esen Sagynov2e087942011-08-09 23:35:01 -0700301 * @return string
302 */
Andrey Andreev0b6a4922013-01-10 16:53:44 +0200303 protected function _escape_str($str)
Esen Sagynov2e087942011-08-09 23:35:01 -0700304 {
Andrey Andreev394a3f12012-02-15 14:35:11 +0200305 if (function_exists('cubrid_real_escape_string') &&
306 (is_resource($this->conn_id)
307 OR (get_resource_type($this->conn_id) === 'Unknown' && preg_match('/Resource id #/', strval($this->conn_id)))))
Esen Sagynov2e087942011-08-09 23:35:01 -0700308 {
Andrey Andreev0b6a4922013-01-10 16:53:44 +0200309 return cubrid_real_escape_string($str, $this->conn_id);
Esen Sagynov2e087942011-08-09 23:35:01 -0700310 }
311
Andrey Andreev0b6a4922013-01-10 16:53:44 +0200312 return addslashes($str);
Esen Sagynov2e087942011-08-09 23:35:01 -0700313 }
314
315 // --------------------------------------------------------------------
316
317 /**
318 * Affected Rows
319 *
Andrey Andreevea3eec92012-03-01 19:16:23 +0200320 * @return int
Esen Sagynov2e087942011-08-09 23:35:01 -0700321 */
Andrey Andreevea3eec92012-03-01 19:16:23 +0200322 public function affected_rows()
Esen Sagynov2e087942011-08-09 23:35:01 -0700323 {
Andrey Andreevea3eec92012-03-01 19:16:23 +0200324 return @cubrid_affected_rows();
Esen Sagynov2e087942011-08-09 23:35:01 -0700325 }
326
327 // --------------------------------------------------------------------
328
329 /**
330 * Insert ID
331 *
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200332 * @return int
Esen Sagynov2e087942011-08-09 23:35:01 -0700333 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200334 public function insert_id()
Esen Sagynov2e087942011-08-09 23:35:01 -0700335 {
336 return @cubrid_insert_id($this->conn_id);
337 }
338
339 // --------------------------------------------------------------------
340
341 /**
Esen Sagynov2e087942011-08-09 23:35:01 -0700342 * List table query
343 *
344 * Generates a platform-specific query string so that the table names can be fetched
345 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200346 * @param bool $prefix_limit
Esen Sagynov2e087942011-08-09 23:35:01 -0700347 * @return string
348 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200349 protected function _list_tables($prefix_limit = FALSE)
Esen Sagynov2e087942011-08-09 23:35:01 -0700350 {
Andrey Andreev7f55d612012-01-26 13:44:28 +0200351 $sql = 'SHOW TABLES';
Esen Sagynov2e087942011-08-09 23:35:01 -0700352
Alex Bilbie48a2baf2012-06-02 11:09:54 +0100353 if ($prefix_limit !== FALSE && $this->dbprefix !== '')
Esen Sagynov2e087942011-08-09 23:35:01 -0700354 {
Andrey Andreev7f55d612012-01-26 13:44:28 +0200355 return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'";
Esen Sagynov2e087942011-08-09 23:35:01 -0700356 }
357
358 return $sql;
359 }
360
361 // --------------------------------------------------------------------
362
363 /**
364 * Show column query
365 *
366 * Generates a platform-specific query string so that the column names can be fetched
367 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200368 * @param string $table
Esen Sagynov2e087942011-08-09 23:35:01 -0700369 * @return string
370 */
Andrey Andreev592f4ec2012-03-20 15:10:08 +0200371 protected function _list_columns($table = '')
Esen Sagynov2e087942011-08-09 23:35:01 -0700372 {
Andrey Andreev032e7ea2012-03-06 19:48:35 +0200373 return 'SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE);
Esen Sagynov2e087942011-08-09 23:35:01 -0700374 }
375
376 // --------------------------------------------------------------------
377
378 /**
Andrey Andreev10ecc842012-11-16 01:06:20 +0200379 * Returns an object with field data
Esen Sagynov2e087942011-08-09 23:35:01 -0700380 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200381 * @param string $table
Andrey Andreev10ecc842012-11-16 01:06:20 +0200382 * @return array
Esen Sagynov2e087942011-08-09 23:35:01 -0700383 */
Andrey Andreev10ecc842012-11-16 01:06:20 +0200384 public function field_data($table = '')
Esen Sagynov2e087942011-08-09 23:35:01 -0700385 {
Andrey Andreev10ecc842012-11-16 01:06:20 +0200386 if ($table === '')
387 {
388 return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE;
389 }
390
391 if (($query = $this->query('SHOW COLUMNS FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE))) === FALSE)
392 {
393 return FALSE;
394 }
395 $query = $query->result_object();
396
397 $retval = array();
398 for ($i = 0, $c = count($query); $i < $c; $i++)
399 {
400 $retval[$i] = new stdClass();
401 $retval[$i]->name = $query[$i]->Field;
402
403 sscanf($query[$i]->Type, '%[a-z](%d)',
404 $retval[$i]->type,
405 $retval[$i]->max_length
406 );
407
408 $retval[$i]->default = $query[$i]->Default;
409 $retval[$i]->primary_key = (int) ($query[$i]->Key === 'PRI');
410 }
411
412 return $retval;
Esen Sagynov2e087942011-08-09 23:35:01 -0700413 }
414
415 // --------------------------------------------------------------------
416
417 /**
Andrey Andreev4be5de12012-03-02 15:45:41 +0200418 * Error
Esen Sagynov2e087942011-08-09 23:35:01 -0700419 *
Andrey Andreev4be5de12012-03-02 15:45:41 +0200420 * Returns an array containing code and message of the last
421 * database error that has occured.
Esen Sagynov2e087942011-08-09 23:35:01 -0700422 *
Andrey Andreev4be5de12012-03-02 15:45:41 +0200423 * @return array
Esen Sagynov2e087942011-08-09 23:35:01 -0700424 */
Andrey Andreev4be5de12012-03-02 15:45:41 +0200425 public function error()
Esen Sagynov2e087942011-08-09 23:35:01 -0700426 {
Andrey Andreev4be5de12012-03-02 15:45:41 +0200427 return array('code' => cubrid_errno($this->conn_id), 'message' => cubrid_error($this->conn_id));
Esen Sagynov2e087942011-08-09 23:35:01 -0700428 }
429
Esen Sagynov2e087942011-08-09 23:35:01 -0700430 // --------------------------------------------------------------------
431
432 /**
Esen Sagynov2e087942011-08-09 23:35:01 -0700433 * Update_Batch statement
434 *
435 * Generates a platform-specific batch update string from the supplied data
436 *
Andrey Andreeva24e52e2012-11-02 03:54:12 +0200437 * @param string $table Table name
438 * @param array $values Update data
439 * @param string $index WHERE key
Esen Sagynov2e087942011-08-09 23:35:01 -0700440 * @return string
441 */
Andrey Andreevb0478652012-07-18 15:34:46 +0300442 protected function _update_batch($table, $values, $index)
Esen Sagynov2e087942011-08-09 23:35:01 -0700443 {
444 $ids = array();
Esen Sagynov2e087942011-08-09 23:35:01 -0700445 foreach ($values as $key => $val)
446 {
447 $ids[] = $val[$index];
448
449 foreach (array_keys($val) as $field)
450 {
Alex Bilbie48a2baf2012-06-02 11:09:54 +0100451 if ($field !== $index)
Esen Sagynov2e087942011-08-09 23:35:01 -0700452 {
Esen Sagynov2ab2b1e2011-08-11 00:41:16 -0700453 $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
Esen Sagynov2e087942011-08-09 23:35:01 -0700454 }
455 }
456 }
457
Esen Sagynov2e087942011-08-09 23:35:01 -0700458 $cases = '';
Esen Sagynov2e087942011-08-09 23:35:01 -0700459 foreach ($final as $k => $v)
460 {
Andrey Andreev7f55d612012-01-26 13:44:28 +0200461 $cases .= $k." = CASE \n"
462 .implode("\n", $v)
463 .'ELSE '.$k.' END, ';
Esen Sagynov2e087942011-08-09 23:35:01 -0700464 }
465
Andrey Andreevb0478652012-07-18 15:34:46 +0300466 $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
467
Andrey Andreevd40459d2012-07-18 16:46:39 +0300468 return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
Esen Sagynov2e087942011-08-09 23:35:01 -0700469 }
470
471 // --------------------------------------------------------------------
Andrey Andreev79922c02012-05-23 12:27:17 +0300472
Esen Sagynov2e087942011-08-09 23:35:01 -0700473 /**
Andrey Andreev7eaa14f2012-10-09 11:34:01 +0300474 * FROM tables
475 *
476 * Groups tables in FROM clauses if needed, so there is no confusion
477 * about operator precedence.
478 *
479 * @return string
480 */
481 protected function _from_tables()
482 {
Andrey Andreevfce9abe2012-10-09 11:37:00 +0300483 if ( ! empty($this->qb_join) && count($this->qb_from) > 1)
Andrey Andreev7eaa14f2012-10-09 11:34:01 +0300484 {
485 return '('.implode(', ', $this->qb_from).')';
486 }
487
488 return implode(', ', $this->qb_from);
489 }
490
491 // --------------------------------------------------------------------
492
493 /**
Esen Sagynov2e087942011-08-09 23:35:01 -0700494 * Close DB Connection
495 *
Esen Sagynov2e087942011-08-09 23:35:01 -0700496 * @return void
497 */
Andrey Andreev79922c02012-05-23 12:27:17 +0300498 protected function _close()
Esen Sagynov2e087942011-08-09 23:35:01 -0700499 {
Andrey Andreev79922c02012-05-23 12:27:17 +0300500 @cubrid_close($this->conn_id);
Esen Sagynov2e087942011-08-09 23:35:01 -0700501 }
502
503}
504
Esen Sagynov2e087942011-08-09 23:35:01 -0700505/* End of file cubrid_driver.php */
Andrey Andreev79922c02012-05-23 12:27:17 +0300506/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */