blob: f75024799bb46247a0cb364113f8b9388daa3a62 [file] [log] [blame]
Andrey Andreeve6297342012-03-20 16:25:07 +02001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Alex Bilbie84445d02011-03-10 16:43:39 +00002/**
3 * CodeIgniter
4 *
Phil Sturgeon07c1ac82012-03-09 17:03:37 +00005 * An open source application development framework for PHP 5.2.4 or newer
Alex Bilbie84445d02011-03-10 16:43:39 +00006 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05007 * NOTICE OF LICENSE
Andrey Andreeve6297342012-03-20 16:25:07 +02008 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05009 * Licensed under the Open Software License version 3.0
Andrey Andreeve6297342012-03-20 16:25:07 +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 *
Alex Bilbie84445d02011-03-10 16:43:39 +000019 * @package CodeIgniter
Derek Jonesf4a4bd82011-10-20 12:18:42 -050020 * @author EllisLab Dev Team
Greg Aker0defe5d2012-01-01 18:46:41 -060021 * @copyright Copyright (c) 2008 - 2012, 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)
Alex Bilbie84445d02011-03-10 16:43:39 +000023 * @link http://codeigniter.com
24 * @since Version 1.0
25 * @filesource
26 */
27
Alex Bilbie84445d02011-03-10 16:43:39 +000028/**
Alex Bilbie01ab0042011-03-18 19:24:30 +000029 * SQLSRV Database Adapter Class
Alex Bilbie84445d02011-03-10 16:43:39 +000030 *
31 * Note: _DB is an extender class that the app controller
32 * creates dynamically based on whether the active record
33 * class is being used or not.
34 *
35 * @package CodeIgniter
36 * @subpackage Drivers
37 * @category Database
Derek Jonesf4a4bd82011-10-20 12:18:42 -050038 * @author EllisLab Dev Team
Alex Bilbie84445d02011-03-10 16:43:39 +000039 * @link http://codeigniter.com/user_guide/database/
40 */
Alex Bilbie01ab0042011-03-18 19:24:30 +000041class CI_DB_sqlsrv_driver extends CI_DB {
Alex Bilbie84445d02011-03-10 16:43:39 +000042
Andrey Andreeve6297342012-03-20 16:25:07 +020043 public $dbdriver = 'sqlsrv';
Alex Bilbie84445d02011-03-10 16:43:39 +000044
45 // The character used for escaping
Andrey Andreeve6297342012-03-20 16:25:07 +020046 protected $_escape_char = '';
Alex Bilbie84445d02011-03-10 16:43:39 +000047
48 // clause and character used for LIKE escape sequences
Andrey Andreeve6297342012-03-20 16:25:07 +020049 protected $_like_escape_str = " ESCAPE '%s' ";
50 protected $_like_escape_chr = '!';
Alex Bilbie84445d02011-03-10 16:43:39 +000051
52 /**
53 * The syntax to count rows is slightly different across different
54 * database engines, so this string appears in each driver and is
Timothy Warren0e20da12012-03-19 19:05:46 -040055 * used for the count_all() and count_all_results() functions.
Alex Bilbie84445d02011-03-10 16:43:39 +000056 */
Andrey Andreeve6297342012-03-20 16:25:07 +020057 protected $_count_string = 'SELECT COUNT(*) AS ';
Andrey Andreev3b2587e2012-03-28 13:39:34 +030058 protected $_random_keyword = ' NEWID()'; // not currently supported
Alex Bilbie84445d02011-03-10 16:43:39 +000059
60 /**
61 * Non-persistent database connection
62 *
Alex Bilbie84445d02011-03-10 16:43:39 +000063 * @return resource
64 */
Andrey Andreeve6297342012-03-20 16:25:07 +020065 public function db_connect($pooling = FALSE)
Alex Bilbie84445d02011-03-10 16:43:39 +000066 {
Alex Bilbie3a43c7a2011-03-18 19:48:04 +000067 // Check for a UTF-8 charset being passed as CI's default 'utf8'.
68 $character_set = (0 === strcasecmp('utf8', $this->char_set)) ? 'UTF-8' : $this->char_set;
69
70 $connection = array(
Andrey Andreev3b2587e2012-03-28 13:39:34 +030071 'UID' => empty($this->username) ? '' : $this->username,
72 'PWD' => empty($this->password) ? '' : $this->password,
73 'Database' => $this->database,
74 'ConnectionPooling' => $pooling ? 1 : 0,
Alex Bilbie3a43c7a2011-03-18 19:48:04 +000075 'CharacterSet' => $character_set,
Andrey Andreev3b2587e2012-03-28 13:39:34 +030076 'ReturnDatesAsStrings' => 1
Alex Bilbie3a43c7a2011-03-18 19:48:04 +000077 );
Andrey Andreeve6297342012-03-20 16:25:07 +020078
79 // If the username and password are both empty, assume this is a
Alex Bilbie3a43c7a2011-03-18 19:48:04 +000080 // 'Windows Authentication Mode' connection.
Andrey Andreeve6297342012-03-20 16:25:07 +020081 if (empty($connection['UID']) && empty($connection['PWD']))
82 {
Alex Bilbie3a43c7a2011-03-18 19:48:04 +000083 unset($connection['UID'], $connection['PWD']);
Alex Bilbie84445d02011-03-10 16:43:39 +000084 }
85
Alex Bilbie3a43c7a2011-03-18 19:48:04 +000086 return sqlsrv_connect($this->hostname, $connection);
Alex Bilbie84445d02011-03-10 16:43:39 +000087 }
88
89 // --------------------------------------------------------------------
90
91 /**
92 * Persistent database connection
93 *
Alex Bilbie84445d02011-03-10 16:43:39 +000094 * @return resource
95 */
Andrey Andreeve6297342012-03-20 16:25:07 +020096 public function db_pconnect()
Alex Bilbie84445d02011-03-10 16:43:39 +000097 {
Kyle Farris37e351f2011-09-07 11:14:46 -030098 return $this->db_connect(TRUE);
Alex Bilbie84445d02011-03-10 16:43:39 +000099 }
100
101 // --------------------------------------------------------------------
102
103 /**
Alex Bilbie84445d02011-03-10 16:43:39 +0000104 * Select the database
105 *
Andrey Andreev11454e02012-02-22 16:05:47 +0200106 * @param string database name
107 * @return bool
Alex Bilbie84445d02011-03-10 16:43:39 +0000108 */
Andrey Andreev11454e02012-02-22 16:05:47 +0200109 public function db_select($database = '')
Alex Bilbie84445d02011-03-10 16:43:39 +0000110 {
Andrey Andreev024ba2d2012-02-24 11:40:36 +0200111 if ($database === '')
112 {
113 $database = $this->database;
114 }
115
116 if ($this->_execute('USE '.$database))
117 {
118 $this->database = $database;
119 return TRUE;
120 }
121
122 return FALSE;
Alex Bilbie84445d02011-03-10 16:43:39 +0000123 }
124
125 // --------------------------------------------------------------------
126
127 /**
Alex Bilbie84445d02011-03-10 16:43:39 +0000128 * Execute the query
129 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000130 * @param string an SQL query
131 * @return resource
132 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200133 protected function _execute($sql)
Alex Bilbie84445d02011-03-10 16:43:39 +0000134 {
Andrey Andreeve6297342012-03-20 16:25:07 +0200135 return sqlsrv_query($this->conn_id,
136 $sql,
137 NULL,
138 array('Scrollable'=> SQLSRV_CURSOR_STATIC, 'SendStreamParamsAtExec' => TRUE)
139 );
Alex Bilbie84445d02011-03-10 16:43:39 +0000140 }
141
142 // --------------------------------------------------------------------
143
144 /**
Alex Bilbie84445d02011-03-10 16:43:39 +0000145 * Begin Transaction
146 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000147 * @return bool
148 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200149 public function trans_begin($test_mode = FALSE)
Alex Bilbie84445d02011-03-10 16:43:39 +0000150 {
151 if ( ! $this->trans_enabled)
152 {
153 return TRUE;
154 }
155
156 // When transactions are nested we only begin/commit/rollback the outermost ones
157 if ($this->_trans_depth > 0)
158 {
159 return TRUE;
160 }
161
162 // Reset the transaction failure flag.
163 // If the $test_mode flag is set to TRUE transactions will be rolled back
164 // even if the queries produce a successful result.
165 $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
166
Alex Bilbie3a43c7a2011-03-18 19:48:04 +0000167 return sqlsrv_begin_transaction($this->conn_id);
Alex Bilbie84445d02011-03-10 16:43:39 +0000168 }
169
170 // --------------------------------------------------------------------
171
172 /**
173 * Commit Transaction
174 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000175 * @return bool
176 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200177 public function trans_commit()
Alex Bilbie84445d02011-03-10 16:43:39 +0000178 {
179 if ( ! $this->trans_enabled)
180 {
181 return TRUE;
182 }
183
184 // When transactions are nested we only begin/commit/rollback the outermost ones
185 if ($this->_trans_depth > 0)
186 {
187 return TRUE;
188 }
189
Alex Bilbie3a43c7a2011-03-18 19:48:04 +0000190 return sqlsrv_commit($this->conn_id);
Alex Bilbie84445d02011-03-10 16:43:39 +0000191 }
192
193 // --------------------------------------------------------------------
194
195 /**
196 * Rollback Transaction
197 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000198 * @return bool
199 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200200 public function trans_rollback()
Alex Bilbie84445d02011-03-10 16:43:39 +0000201 {
202 if ( ! $this->trans_enabled)
203 {
204 return TRUE;
205 }
206
207 // When transactions are nested we only begin/commit/rollback the outermost ones
208 if ($this->_trans_depth > 0)
209 {
210 return TRUE;
211 }
212
Alex Bilbie3a43c7a2011-03-18 19:48:04 +0000213 return sqlsrv_rollback($this->conn_id);
Alex Bilbie84445d02011-03-10 16:43:39 +0000214 }
215
216 // --------------------------------------------------------------------
217
218 /**
219 * Escape String
220 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000221 * @param string
222 * @param bool whether or not the string will be used in a LIKE condition
223 * @return string
224 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200225 public function escape_str($str, $like = FALSE)
Alex Bilbie84445d02011-03-10 16:43:39 +0000226 {
Alex Bilbie84445d02011-03-10 16:43:39 +0000227 // Escape single quotes
Alex Bilbie3a43c7a2011-03-18 19:48:04 +0000228 return str_replace("'", "''", $str);
Alex Bilbie84445d02011-03-10 16:43:39 +0000229 }
230
231 // --------------------------------------------------------------------
232
233 /**
234 * Affected Rows
235 *
Andrey Andreeve6297342012-03-20 16:25:07 +0200236 * @return int
Alex Bilbie84445d02011-03-10 16:43:39 +0000237 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200238 public function affected_rows()
Alex Bilbie84445d02011-03-10 16:43:39 +0000239 {
Alex Bilbie56e20402011-03-12 23:43:54 +0000240 return @sqlrv_rows_affected($this->conn_id);
Alex Bilbie84445d02011-03-10 16:43:39 +0000241 }
242
243 // --------------------------------------------------------------------
244
245 /**
Andrey Andreeve6297342012-03-20 16:25:07 +0200246 * Insert ID
247 *
248 * Returns the last id created in the Identity column.
249 *
250 * @return string
251 */
252 public function insert_id()
Alex Bilbie84445d02011-03-10 16:43:39 +0000253 {
Andrey Andreeve6297342012-03-20 16:25:07 +0200254 $query = $this->query('SELECT @@IDENTITY AS insert_id');
255 $query = $query->row();
256 return $query->insert_id;
Alex Bilbie84445d02011-03-10 16:43:39 +0000257 }
258
259 // --------------------------------------------------------------------
260
261 /**
Andrey Andreev08856b82012-03-03 03:19:28 +0200262 * Database version number
263 *
264 * @return string
265 */
266 public function version()
Alex Bilbie84445d02011-03-10 16:43:39 +0000267 {
Andrey Andreev08856b82012-03-03 03:19:28 +0200268 if (isset($this->data_cache['version']))
269 {
270 return $this->data_cache['version'];
271 }
272
273 if (($info = sqlsrv_server_info($this->conn_id)) === FALSE)
274 {
275 return FALSE;
276 }
277
278 return $this->data_cache['version'] = $info['SQLServerVersion'];
Alex Bilbie84445d02011-03-10 16:43:39 +0000279 }
280
281 // --------------------------------------------------------------------
282
283 /**
284 * "Count All" query
285 *
286 * Generates a platform-specific query string that counts all records in
287 * the specified database
288 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000289 * @param string
Andrey Andreeve6297342012-03-20 16:25:07 +0200290 * @return int
Alex Bilbie84445d02011-03-10 16:43:39 +0000291 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200292 public function count_all($table = '')
Alex Bilbie84445d02011-03-10 16:43:39 +0000293 {
294 if ($table == '')
Andrey Andreeve6297342012-03-20 16:25:07 +0200295 {
296 return 0;
297 }
298
Alex Bilbie3a43c7a2011-03-18 19:48:04 +0000299 $query = $this->query("SELECT COUNT(*) AS numrows FROM " . $this->dbprefix . $table);
Alex Bilbie84445d02011-03-10 16:43:39 +0000300 if ($query->num_rows() == 0)
Andrey Andreeve6297342012-03-20 16:25:07 +0200301 {
302 return 0;
303 }
Alex Bilbie84445d02011-03-10 16:43:39 +0000304
305 $row = $query->row();
Greg Aker90248ab2011-08-20 14:23:14 -0500306 $this->_reset_select();
Andrey Andreeve6297342012-03-20 16:25:07 +0200307 return (int) $row->numrows;
Alex Bilbie84445d02011-03-10 16:43:39 +0000308 }
309
310 // --------------------------------------------------------------------
311
312 /**
313 * List table query
314 *
315 * Generates a platform-specific query string so that the table names can be fetched
316 *
Andrey Andreeve6297342012-03-20 16:25:07 +0200317 * @param bool
Alex Bilbie84445d02011-03-10 16:43:39 +0000318 * @return string
319 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200320 protected function _list_tables($prefix_limit = FALSE)
Alex Bilbie84445d02011-03-10 16:43:39 +0000321 {
Alex Bilbie3a43c7a2011-03-18 19:48:04 +0000322 return "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name";
Alex Bilbie84445d02011-03-10 16:43:39 +0000323 }
324
325 // --------------------------------------------------------------------
326
327 /**
328 * List column query
329 *
330 * Generates a platform-specific query string so that the column names can be fetched
331 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000332 * @param string the table name
333 * @return string
334 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200335 protected function _list_columns($table = '')
Alex Bilbie84445d02011-03-10 16:43:39 +0000336 {
Andrey Andreeve6297342012-03-20 16:25:07 +0200337 return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'";
Alex Bilbie84445d02011-03-10 16:43:39 +0000338 }
339
340 // --------------------------------------------------------------------
341
342 /**
343 * Field data query
344 *
345 * Generates a platform-specific query so that the column data can be retrieved
346 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000347 * @param string the table name
Andrey Andreeve6297342012-03-20 16:25:07 +0200348 * @return string
Alex Bilbie84445d02011-03-10 16:43:39 +0000349 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200350 protected function _field_data($table)
Alex Bilbie84445d02011-03-10 16:43:39 +0000351 {
Andrey Andreeve6297342012-03-20 16:25:07 +0200352 return 'SELECT TOP 1 * FROM '.$table;
Alex Bilbie84445d02011-03-10 16:43:39 +0000353 }
354
355 // --------------------------------------------------------------------
356
357 /**
Andrey Andreev4be5de12012-03-02 15:45:41 +0200358 * Error
Alex Bilbie84445d02011-03-10 16:43:39 +0000359 *
Andrey Andreev4be5de12012-03-02 15:45:41 +0200360 * Returns an array containing code and message of the last
361 * database error that has occured.
Alex Bilbie84445d02011-03-10 16:43:39 +0000362 *
Andrey Andreev4be5de12012-03-02 15:45:41 +0200363 * @return array
Alex Bilbie84445d02011-03-10 16:43:39 +0000364 */
Andrey Andreev4be5de12012-03-02 15:45:41 +0200365 public function error()
Alex Bilbie84445d02011-03-10 16:43:39 +0000366 {
Andrey Andreev4be5de12012-03-02 15:45:41 +0200367 $error = array('code' => '00000', 'message' => '');
368 $sqlsrv_errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
369
370 if ( ! is_array($sqlsrv_errors))
Andrey Andreev850f6012012-03-01 15:58:25 +0200371 {
Andrey Andreev4be5de12012-03-02 15:45:41 +0200372 return $error;
Andrey Andreev850f6012012-03-01 15:58:25 +0200373 }
374
Andrey Andreev4be5de12012-03-02 15:45:41 +0200375 $sqlsrv_error = array_shift($sqlsrv_errors);
376 if (isset($sqlsrv_error['SQLSTATE']))
377 {
378 $error['code'] = isset($sqlsrv_error['code']) ? $sqlsrv_error['SQLSTATE'].'/'.$sqlsrv_error['code'] : $sqlsrv_error['SQLSTATE'];
379 }
380 elseif (isset($sqlsrv_error['code']))
381 {
382 $error['code'] = $sqlsrv_error['code'];
383 }
384
385 if (isset($sqlsrv_error['message']))
386 {
387 $error['message'] = $sqlsrv_error['message'];
388 }
389
390 return $error;
Alex Bilbie84445d02011-03-10 16:43:39 +0000391 }
392
393 // --------------------------------------------------------------------
394
395 /**
396 * Escape the SQL Identifiers
397 *
Timothy Warren0e20da12012-03-19 19:05:46 -0400398 * This function escapes column and table names
Alex Bilbie84445d02011-03-10 16:43:39 +0000399 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000400 * @param string
401 * @return string
402 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200403 public function _escape_identifiers($item)
Alex Bilbie84445d02011-03-10 16:43:39 +0000404 {
Alex Bilbie3a43c7a2011-03-18 19:48:04 +0000405 return $item;
Alex Bilbie84445d02011-03-10 16:43:39 +0000406 }
407
Timothy Warren0e20da12012-03-19 19:05:46 -0400408 // --------------------------------------------------------------------
Alex Bilbie84445d02011-03-10 16:43:39 +0000409
410 /**
411 * From Tables
412 *
Timothy Warren0e20da12012-03-19 19:05:46 -0400413 * This function implicitly groups FROM tables so there is no confusion
Alex Bilbie84445d02011-03-10 16:43:39 +0000414 * about operator precedence in harmony with SQL standards
415 *
Andrey Andreeve6297342012-03-20 16:25:07 +0200416 * @param array
417 * @return string
Alex Bilbie84445d02011-03-10 16:43:39 +0000418 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200419 protected function _from_tables($tables)
Alex Bilbie84445d02011-03-10 16:43:39 +0000420 {
421 if ( ! is_array($tables))
422 {
423 $tables = array($tables);
424 }
425
426 return implode(', ', $tables);
427 }
428
429 // --------------------------------------------------------------------
430
431 /**
Alex Bilbie84445d02011-03-10 16:43:39 +0000432 * Update statement
433 *
434 * Generates a platform-specific update string from the supplied data
435 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000436 * @param string the table name
437 * @param array the update data
438 * @param array the where clause
439 * @param array the orderby clause
440 * @param array the limit clause
441 * @return string
442 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200443 protected function _update($table, $values, $where)
Alex Bilbie84445d02011-03-10 16:43:39 +0000444 {
Alex Bilbie3a43c7a2011-03-18 19:48:04 +0000445 foreach($values as $key => $val)
Alex Bilbie84445d02011-03-10 16:43:39 +0000446 {
447 $valstr[] = $key." = ".$val;
448 }
Andrey Andreeve6297342012-03-20 16:25:07 +0200449
450 return 'UPDATE '.$table.' SET '.implode(', ', $valstr).' WHERE '.implode(' ', $where);
Alex Bilbie84445d02011-03-10 16:43:39 +0000451 }
Andrey Andreeve6297342012-03-20 16:25:07 +0200452
Alex Bilbie84445d02011-03-10 16:43:39 +0000453 // --------------------------------------------------------------------
454
455 /**
Andrey Andreev6d83cde2012-04-05 16:20:50 +0300456 * Truncate statement
457 *
458 * Generates a platform-specific truncate string from the supplied data
459 *
460 * If the database does not support the truncate() command,
461 * then this method maps to 'DELETE FROM table'
462 *
463 * @param string the table name
464 * @return string
465 */
466 protected function _truncate($table)
467 {
468 return 'TRUNCATE TABLE '.$table;
469 }
470
471 // --------------------------------------------------------------------
472
473 /**
Alex Bilbie84445d02011-03-10 16:43:39 +0000474 * Delete statement
475 *
476 * Generates a platform-specific delete string from the supplied data
477 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000478 * @param string the table name
479 * @param array the where clause
480 * @param string the limit clause
481 * @return string
482 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200483 protected function _delete($table, $where)
Alex Bilbie84445d02011-03-10 16:43:39 +0000484 {
Andrey Andreeve6297342012-03-20 16:25:07 +0200485 return 'DELETE FROM '.$table.' WHERE '.implode(' ', $where);
Alex Bilbie84445d02011-03-10 16:43:39 +0000486 }
487
488 // --------------------------------------------------------------------
489
490 /**
491 * Limit string
492 *
493 * Generates a platform-specific LIMIT clause
494 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000495 * @param string the sql query string
Andrey Andreeve6297342012-03-20 16:25:07 +0200496 * @param int the number of rows to limit the query to
497 * @param int the offset value
Alex Bilbie84445d02011-03-10 16:43:39 +0000498 * @return string
499 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200500 protected function _limit($sql, $limit, $offset)
Alex Bilbie84445d02011-03-10 16:43:39 +0000501 {
Andrey Andreeve6297342012-03-20 16:25:07 +0200502 return preg_replace('/(^\SELECT (DISTINCT)?)/i','\\1 TOP '.($limit + $offset).' ', $sql);
Alex Bilbie84445d02011-03-10 16:43:39 +0000503 }
504
505 // --------------------------------------------------------------------
506
507 /**
508 * Close DB Connection
509 *
Alex Bilbie84445d02011-03-10 16:43:39 +0000510 * @param resource
511 * @return void
512 */
Andrey Andreeve6297342012-03-20 16:25:07 +0200513 protected function _close($conn_id)
Alex Bilbie84445d02011-03-10 16:43:39 +0000514 {
515 @sqlsrv_close($conn_id);
516 }
517
518}
519
Andrey Andreeve6297342012-03-20 16:25:07 +0200520/* End of file sqlsrv_driver.php */
521/* Location: ./system/database/drivers/sqlsrv/sqlsrv_driver.php */