@@ -66,8 +66,8 @@ function db_connect($pooling = false)
66
66
'CharacterSet ' => $ character_set ,
67
67
'ReturnDatesAsStrings ' => 1
68
68
);
69
-
70
- // If the username and password are both empty, assume this is a
69
+
70
+ // If the username and password are both empty, assume this is a
71
71
// 'Windows Authentication Mode' connection.
72
72
if (empty ($ connection ['UID ' ]) && empty ($ connection ['PWD ' ])) {
73
73
unset($ connection ['UID ' ], $ connection ['PWD ' ]);
@@ -336,16 +336,20 @@ function _version()
336
336
function count_all ($ table = '' )
337
337
{
338
338
if ($ table == '' )
339
- return '0 ' ;
340
-
341
- $ query = $ this ->query ("SELECT COUNT(*) AS numrows FROM " . $ this ->dbprefix . $ table );
342
-
339
+ {
340
+ return 0 ;
341
+ }
342
+
343
+ $ query = $ this ->query ($ this ->_count_string . $ this ->_protect_identifiers ('numrows ' ) . " FROM " . $ this ->_protect_identifiers ($ table , TRUE , NULL , FALSE ));
344
+
343
345
if ($ query ->num_rows () == 0 )
344
- return '0 ' ;
346
+ {
347
+ return 0 ;
348
+ }
345
349
346
350
$ row = $ query ->row ();
347
351
$ this ->_reset_select ();
348
- return $ row ->numrows ;
352
+ return ( int ) $ row ->numrows ;
349
353
}
350
354
351
355
// --------------------------------------------------------------------
@@ -393,7 +397,7 @@ function _list_columns($table = '')
393
397
*/
394
398
function _field_data ($ table )
395
399
{
396
- return "SELECT TOP 1 * FROM " . $ this ->_escape_table ($ table );
400
+ return "SELECT TOP 1 * FROM " . $ this ->_escape_table ($ table );
397
401
}
398
402
399
403
// --------------------------------------------------------------------
@@ -439,7 +443,7 @@ function _error_number()
439
443
function _escape_table ($ table )
440
444
{
441
445
return $ table ;
442
- }
446
+ }
443
447
444
448
445
449
/**
@@ -492,7 +496,7 @@ function _from_tables($tables)
492
496
* @return string
493
497
*/
494
498
function _insert ($ table , $ keys , $ values )
495
- {
499
+ {
496
500
return "INSERT INTO " .$ this ->_escape_table ($ table )." ( " .implode (', ' , $ keys ).") VALUES ( " .implode (', ' , $ values ).") " ;
497
501
}
498
502
@@ -517,10 +521,10 @@ function _update($table, $values, $where)
517
521
{
518
522
$ valstr [] = $ key ." = " .$ val ;
519
523
}
520
-
524
+
521
525
return "UPDATE " .$ this ->_escape_table ($ table )." SET " .implode (', ' , $ valstr )." WHERE " .implode (" " , $ where );
522
526
}
523
-
527
+
524
528
// --------------------------------------------------------------------
525
529
526
530
/**
@@ -573,8 +577,8 @@ function _delete($table, $where)
573
577
function _limit ($ sql , $ limit , $ offset )
574
578
{
575
579
$ i = $ limit + $ offset ;
576
-
577
- return preg_replace ('/(^\SELECT (DISTINCT)?)/i ' ,'\\1 TOP ' .$ i .' ' , $ sql );
580
+
581
+ return preg_replace ('/(^\SELECT (DISTINCT)?)/i ' ,'\\1 TOP ' .$ i .' ' , $ sql );
578
582
}
579
583
580
584
// --------------------------------------------------------------------
@@ -595,5 +599,5 @@ function _close($conn_id)
595
599
596
600
597
601
598
- /* End of file mssql_driver .php */
599
- /* Location: ./system/database/drivers/mssql/mssql_driver .php */
602
+ /* End of file sqlsrv_driver .php */
603
+ /* Location: ./system/database/drivers/sqlsrv/sqlsrv_driver .php */
0 commit comments