Skip to content

Commit 79922c0

Browse files
committed
Removed the parameter use in database drivers' _close() and added a default _close() method in CI_DB_driver + some changelog fixes
1 parent 32593f9 commit 79922c0

File tree

15 files changed

+71
-90
lines changed

15 files changed

+71
-90
lines changed

system/database/DB_driver.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,13 +1152,27 @@ public function close()
11521152
{
11531153
if ($this->conn_id)
11541154
{
1155-
$this->_close($this->conn_id);
1155+
$this->_close();
11561156
$this->conn_id = FALSE;
11571157
}
11581158
}
11591159

11601160
// --------------------------------------------------------------------
11611161

1162+
/**
1163+
* Close DB Connection
1164+
*
1165+
* This method would be overriden by most of the drivers.
1166+
*
1167+
* @return void
1168+
*/
1169+
protected function _close()
1170+
{
1171+
$this->conn_id = FALSE;
1172+
}
1173+
1174+
// --------------------------------------------------------------------
1175+
11621176
/**
11631177
* Display an error message
11641178
*
@@ -1401,7 +1415,7 @@ protected function _reset_select()
14011415
*/
14021416
public function __destruct()
14031417
{
1404-
if ($this->conn_id && ! $this->pconnect)
1418+
if ( ! $this->pconnect)
14051419
{
14061420
$this->close();
14071421
}
@@ -1410,4 +1424,4 @@ public function __destruct()
14101424
}
14111425

14121426
/* End of file DB_driver.php */
1413-
/* Location: ./system/database/DB_driver.php */
1427+
/* Location: ./system/database/DB_driver.php */

system/database/DB_result.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,10 @@ public function previous_row($type = 'object')
378378
public function unbuffered_row($type = 'object')
379379
{
380380
return ($type !== 'array') ? $this->_fetch_object() : $this->_fetch_assoc();
381-
382381
}
383382

384383
// --------------------------------------------------------------------
385-
384+
386385
/**
387386
* The following functions are normally overloaded by the identically named
388387
* methods in the platform-specific driver -- except when query caching

system/database/drivers/cubrid/cubrid_driver.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ protected function _update_batch($table, $values, $index, $where = NULL)
485485
}
486486

487487
// --------------------------------------------------------------------
488-
488+
489489
/**
490490
* Limit string
491491
*
@@ -506,15 +506,14 @@ protected function _limit($sql, $limit, $offset)
506506
/**
507507
* Close DB Connection
508508
*
509-
* @param resource
510509
* @return void
511510
*/
512-
protected function _close($conn_id)
511+
protected function _close()
513512
{
514-
@cubrid_close($conn_id);
513+
@cubrid_close($this->conn_id);
515514
}
516515

517516
}
518517

519518
/* End of file cubrid_driver.php */
520-
/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */
519+
/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */

system/database/drivers/interbase/interbase_driver.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,11 @@ protected function _limit($sql, $limit, $offset)
472472
/**
473473
* Close DB Connection
474474
*
475-
* @param resource
476475
* @return void
477476
*/
478-
protected function _close($conn_id)
477+
protected function _close()
479478
{
480-
@ibase_close($conn_id);
479+
@ibase_close($this->conn_id);
481480
}
482481

483482
}

system/database/drivers/mssql/mssql_driver.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,15 +523,14 @@ protected function _limit($sql, $limit, $offset)
523523
/**
524524
* Close DB Connection
525525
*
526-
* @param resource
527526
* @return void
528527
*/
529-
protected function _close($conn_id)
528+
protected function _close()
530529
{
531-
@mssql_close($conn_id);
530+
@mssql_close($this->conn_id);
532531
}
533532

534533
}
535534

536535
/* End of file mssql_driver.php */
537-
/* Location: ./system/database/drivers/mssql/mssql_driver.php */
536+
/* Location: ./system/database/drivers/mssql/mssql_driver.php */

system/database/drivers/mysql/mysql_driver.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,15 +520,14 @@ protected function _limit($sql, $limit, $offset)
520520
/**
521521
* Close DB Connection
522522
*
523-
* @param resource
524523
* @return void
525524
*/
526-
protected function _close($conn_id)
525+
protected function _close()
527526
{
528-
@mysql_close($conn_id);
527+
@mysql_close($this->conn_id);
529528
}
530529

531530
}
532531

533532
/* End of file mysql_driver.php */
534-
/* Location: ./system/database/drivers/mysql/mysql_driver.php */
533+
/* Location: ./system/database/drivers/mysql/mysql_driver.php */

system/database/drivers/mysqli/mysqli_driver.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,16 +523,14 @@ protected function _limit($sql, $limit, $offset)
523523
/**
524524
* Close DB Connection
525525
*
526-
* @param object
527526
* @return void
528527
*/
529-
protected function _close($conn_id)
528+
protected function _close()
530529
{
531530
$this->conn_id->close();
532-
$this->conn_id = FALSE;
533531
}
534532

535533
}
536534

537535
/* End of file mysqli_driver.php */
538-
/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */
536+
/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */

system/database/drivers/oci8/oci8_driver.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,15 +671,14 @@ protected function _limit($sql, $limit, $offset)
671671
/**
672672
* Close DB Connection
673673
*
674-
* @param resource
675674
* @return void
676675
*/
677-
protected function _close($conn_id)
676+
protected function _close()
678677
{
679-
@oci_close($conn_id);
678+
@oci_close($this->conn_id);
680679
}
681680

682681
}
683682

684683
/* End of file oci8_driver.php */
685-
/* Location: ./system/database/drivers/oci8/oci8_driver.php */
684+
/* Location: ./system/database/drivers/oci8/oci8_driver.php */

system/database/drivers/odbc/odbc_driver.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,15 +402,14 @@ protected function _limit($sql, $limit, $offset)
402402
/**
403403
* Close DB Connection
404404
*
405-
* @param resource
406405
* @return void
407406
*/
408-
protected function _close($conn_id)
407+
protected function _close()
409408
{
410-
@odbc_close($conn_id);
409+
@odbc_close($this->conn_id);
411410
}
412411

413412
}
414413

415414
/* End of file odbc_driver.php */
416-
/* Location: ./system/database/drivers/odbc/odbc_driver.php */
415+
/* Location: ./system/database/drivers/odbc/odbc_driver.php */

system/database/drivers/pdo/pdo_driver.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -667,20 +667,7 @@ protected function _limit($sql, $limit, $offset)
667667
}
668668
}
669669

670-
// --------------------------------------------------------------------
671-
672-
/**
673-
* Close DB Connection
674-
*
675-
* @param object
676-
* @return void
677-
*/
678-
protected function _close($conn_id)
679-
{
680-
$this->conn_id = NULL;
681-
}
682-
683670
}
684671

685672
/* End of file pdo_driver.php */
686-
/* Location: ./system/database/drivers/pdo/pdo_driver.php */
673+
/* Location: ./system/database/drivers/pdo/pdo_driver.php */

0 commit comments

Comments
 (0)