summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-02 01:04:59 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-02 01:04:59 +0100
commitc98e93aab3997bfea4fbb9d07f7b2550a84f8f7a (patch)
tree76ce579843019dcd7712355345296c5c6fc9f956 /system/database
parentae85eb42aa2d5c6d9a41b3cf6c61a4bf1c9b0566 (diff)
[ci skip] DocBlocks for DB drivers' utility classes
Partially fixes issue #1295.
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB_utility.php13
-rw-r--r--system/database/drivers/cubrid/cubrid_forge.php15
-rw-r--r--system/database/drivers/ibase/ibase_forge.php9
-rw-r--r--system/database/drivers/ibase/ibase_utility.php4
-rw-r--r--system/database/drivers/mssql/mssql_forge.php7
-rw-r--r--system/database/drivers/mssql/mssql_utility.php15
-rw-r--r--system/database/drivers/mysql/mysql_forge.php9
-rw-r--r--system/database/drivers/mysql/mysql_utility.php23
-rw-r--r--system/database/drivers/mysqli/mysqli_forge.php9
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php23
-rw-r--r--system/database/drivers/oci8/oci8_forge.php19
-rw-r--r--system/database/drivers/oci8/oci8_utility.php9
-rw-r--r--system/database/drivers/odbc/odbc_forge.php7
-rw-r--r--system/database/drivers/odbc/odbc_utility.php6
-rw-r--r--system/database/drivers/pdo/pdo_forge.php7
-rw-r--r--system/database/drivers/pdo/pdo_utility.php6
-rw-r--r--system/database/drivers/postgre/postgre_forge.php11
-rw-r--r--system/database/drivers/postgre/postgre_utility.php17
-rw-r--r--system/database/drivers/sqlite/sqlite_utility.php6
-rw-r--r--system/database/drivers/sqlite3/sqlite3_utility.php6
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_forge.php7
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_utility.php17
22 files changed, 205 insertions, 40 deletions
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 3bd77c84b..31102c0c6 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -45,23 +45,30 @@ abstract class CI_DB_utility extends CI_DB_forge {
// --------------------------------------------------------------------
/**
+ * List databases statement
+ *
+ * @var string
+ */
+ $_list_databases = FALSE;
+
+ /**
* OPTIMIZE TABLE statement
*
- * @var string|bool
+ * @var string
*/
protected $_optimize_table = FALSE;
/**
* REPAIR TABLE statement
*
- * @var string|bool
+ * @var string
*/
protected $_repair_table = FALSE;
// --------------------------------------------------------------------
/**
- * Constructor
+ * Class constructor
*
* @return void
*/
diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php
index a7b4efd9a..33d502137 100644
--- a/system/database/drivers/cubrid/cubrid_forge.php
+++ b/system/database/drivers/cubrid/cubrid_forge.php
@@ -35,13 +35,26 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_cubrid_forge extends CI_DB_forge {
+ /**
+ * CREATE DATABASE statement
+ *
+ * @var string
+ */
protected $_create_database = FALSE;
+
+ // --------------------------------------------------------------------
+
+ /**
+ * DROP DATABASE statement
+ *
+ * @var string
+ */
protected $_drop_database = FALSE;
/**
* Process Fields
*
- * @param mixed the fields
+ * @param mixed $fields
* @return string
*/
protected function _process_fields($fields)
diff --git a/system/database/drivers/ibase/ibase_forge.php b/system/database/drivers/ibase/ibase_forge.php
index 7f3693dbd..7c4d00a23 100644
--- a/system/database/drivers/ibase/ibase_forge.php
+++ b/system/database/drivers/ibase/ibase_forge.php
@@ -35,12 +35,19 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_ibase_forge extends CI_DB_forge {
+ /**
+ * DROP TABLE statement
+ *
+ * @var string
+ */
protected $_drop_table = 'DROP TABLE %s';
+ // --------------------------------------------------------------------
+
/**
* Create database
*
- * @param string the database name
+ * @param string $db_name
* @return string
*/
public function create_database($db_name)
diff --git a/system/database/drivers/ibase/ibase_utility.php b/system/database/drivers/ibase/ibase_utility.php
index 06de677b6..5eb209ae1 100644
--- a/system/database/drivers/ibase/ibase_utility.php
+++ b/system/database/drivers/ibase/ibase_utility.php
@@ -35,10 +35,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_ibase_utility extends CI_DB_utility {
- protected $_list_databases = FALSE;
-
/**
- * Interbase/Firebird Export
+ * Export
*
* @param string $filename
* @return mixed
diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php
index e0b26d81e..1eef648b0 100644
--- a/system/database/drivers/mssql/mssql_forge.php
+++ b/system/database/drivers/mssql/mssql_forge.php
@@ -35,8 +35,15 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_mssql_forge extends CI_DB_forge {
+ /**
+ * DROP TABLE statement
+ *
+ * @var string
+ */
protected $_drop_table = 'DROP TABLE %s';
+ // --------------------------------------------------------------------
+
/**
* Create Table
*
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 90cc23b05..a011d5974 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -35,13 +35,24 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_mssql_utility extends CI_DB_utility {
+ /**
+ * List databases statement
+ *
+ * @var string
+ */
protected $_list_databases = 'EXEC sp_helpdb'; // Can also be: EXEC sp_databases
+
+ /**
+ * OPTIMIZE TABLE statement
+ *
+ * @var string
+ */
protected $_optimize_table = 'ALTER INDEX all ON %s REORGANIZE';
/**
- * MSSQL Export
+ * Export
*
- * @param array Preferences
+ * @param array $params Preferences
* @return bool
*/
protected function _backup($params = array())
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index 05db86253..7ce4e8b00 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -35,12 +35,19 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_mysql_forge extends CI_DB_forge {
+ /**
+ * CREATE DATABASE statement
+ *
+ * @var string
+ */
protected $_create_database = 'CREATE DATABASE %s CHARACTER SET %s COLLATE %s';
+ // --------------------------------------------------------------------
+
/**
* Process Fields
*
- * @param mixed the fields
+ * @param mixed $fields
* @return string
*/
protected function _process_fields($fields)
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index bc20d2556..8aa051755 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -35,14 +35,33 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_mysql_utility extends CI_DB_utility {
+ /**
+ * List databases statement
+ *
+ * @var string
+ */
protected $_list_databases = 'SHOW DATABASES';
+
+ /**
+ * OPTIMIZE TABLE statement
+ *
+ * @var string
+ */
protected $_optimize_table = 'OPTIMIZE TABLE %s';
+
+ /**
+ * REPAIR TABLE statement
+ *
+ * @var string
+ */
protected $_repair_table = 'REPAIR TABLE %s';
+ // --------------------------------------------------------------------
+
/**
- * MySQL Export
+ * Export
*
- * @param array Preferences
+ * @param array $params Preferences
* @return mixed
*/
protected function _backup($params = array())
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index b3c9e8e23..0732dfea5 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -35,12 +35,19 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_mysqli_forge extends CI_DB_forge {
+ /**
+ * CREATE DATABASE statement
+ *
+ * @var string
+ */
protected $_create_database = 'CREATE DATABASE %s CHARACTER SET %s COLLATE %s';
+ // --------------------------------------------------------------------
+
/**
* Process Fields
*
- * @param mixed the fields
+ * @param mixed $fields
* @return string
*/
protected function _process_fields($fields)
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index 41a9186ce..345691e84 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -35,14 +35,33 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_mysqli_utility extends CI_DB_utility {
+ /**
+ * List databases statement
+ *
+ * @var string
+ */
protected $_list_databases = 'SHOW DATABASES';
+
+ /**
+ * OPTIMIZE TABLE statement
+ *
+ * @var string
+ */
protected $_optimize_table = 'OPTIMIZE TABLE %s';
+
+ /**
+ * REPAIR TABLE statement
+ *
+ * @var string
+ */
protected $_repair_table = 'REPAIR TABLE %s';
+ // --------------------------------------------------------------------
+
/**
- * MySQLi Export
+ * Export
*
- * @param array Preferences
+ * @param array $params Preferences
* @return mixed
*/
protected function _backup($params = array())
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index fed8141b1..ad578f830 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -35,10 +35,29 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_oci8_forge extends CI_DB_forge {
+ /**
+ * CREATE DATABASE statement
+ *
+ * @var string
+ */
protected $_create_database = FALSE;
+
+ /**
+ * DROP DATABASE statement
+ *
+ * @var string
+ */
protected $_drop_database = FALSE;
+
+ /**
+ * DROP TABLE statement
+ *
+ * @var string
+ */
protected $_drop_table = 'DROP TABLE %s';
+ // --------------------------------------------------------------------
+
/**
* Create Table
*
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index 0c6cfc698..e5aae8132 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -35,12 +35,17 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_oci8_utility extends CI_DB_utility {
+ /**
+ * List databases statement
+ *
+ * @var string
+ */
protected $_list_databases = 'SELECT username FROM dba_users'; // Schemas are actual usernames
/**
- * Oracle Export
+ * Export
*
- * @param array Preferences
+ * @param array $params Preferences
* @return mixed
*/
protected function _backup($params = array())
diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php
index fb85c2a74..699ce996c 100644
--- a/system/database/drivers/odbc/odbc_forge.php
+++ b/system/database/drivers/odbc/odbc_forge.php
@@ -35,8 +35,15 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_odbc_forge extends CI_DB_forge {
+ /**
+ * DROP TABLE statement
+ *
+ * @var string
+ */
protected $_drop_table = 'DROP TABLE %s';
+ // --------------------------------------------------------------------
+
/**
* Create Table
*
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index 715bfc949..bfa94f469 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -35,12 +35,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_odbc_utility extends CI_DB_utility {
- protected $_list_databases = FALSE;
-
/**
- * ODBC Export
+ * Export
*
- * @param array Preferences
+ * @param array $params Preferences
* @return mixed
*/
protected function _backup($params = array())
diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php
index 8c22eb33f..e77970cf2 100644
--- a/system/database/drivers/pdo/pdo_forge.php
+++ b/system/database/drivers/pdo/pdo_forge.php
@@ -35,8 +35,15 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_pdo_forge extends CI_DB_forge {
+ /**
+ * DROP TABLE statement
+ *
+ * @var string
+ */
protected $_drop_table = 'DROP TABLE %s';
+ // --------------------------------------------------------------------
+
/**
* Create Table
*
diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php
index ed4d685a1..03b309249 100644
--- a/system/database/drivers/pdo/pdo_utility.php
+++ b/system/database/drivers/pdo/pdo_utility.php
@@ -35,12 +35,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_pdo_utility extends CI_DB_utility {
- protected $_list_databases = FALSE;
-
/**
- * PDO Export
+ * Export
*
- * @param array Preferences
+ * @param array $params Preferences
* @return mixed
*/
protected function _backup($params = array())
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index aac82c1e5..b08fa5177 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -35,13 +35,20 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_postgre_forge extends CI_DB_forge {
+ /**
+ * DROP TABLE statement
+ *
+ * @var string
+ */
protected $_drop_table = 'DROP TABLE IF EXISTS %s CASCADE';
+ // --------------------------------------------------------------------
+
/**
* Process Fields
*
* @param mixed $fields
- * @param array $primary_keys = array()
+ * @param array $primary_keys
* @return string
*/
protected function _process_fields($fields, $primary_keys = array())
@@ -195,7 +202,7 @@ class CI_DB_postgre_forge extends CI_DB_forge {
* @param string $alter_type the ALTER type (ADD, DROP, CHANGE)
* @param string $table the table name
* @param string $fields the column definition
- * @param string $after_field = ''
+ * @param string $after_field
* @return string
*/
protected function _alter_table($alter_type, $table, $fields, $after_field = '')
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index 96cd90e92..bae1c6704 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -35,13 +35,26 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_postgre_utility extends CI_DB_utility {
+ /**
+ * List databases statement
+ *
+ * @var string
+ */
protected $_list_databases = 'SELECT datname FROM pg_database';
+
+ /**
+ * OPTIMIZE TABLE statement
+ *
+ * @var string
+ */
protected $_optimize_table = 'REINDEX TABLE %s';
+ // --------------------------------------------------------------------
+
/**
- * Postgre Export
+ * Export
*
- * @param array Preferences
+ * @param array $params Preferences
* @return mixed
*/
protected function _backup($params = array())
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index 15ebc0392..2fd5c85f6 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -35,12 +35,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_sqlite_utility extends CI_DB_utility {
- protected $_list_databases = FALSE;
-
/**
- * SQLite Export
+ * Export
*
- * @param array Preferences
+ * @param array $params Preferences
* @return mixed
*/
protected function _backup($params = array())
diff --git a/system/database/drivers/sqlite3/sqlite3_utility.php b/system/database/drivers/sqlite3/sqlite3_utility.php
index 043c349af..6f276ebcc 100644
--- a/system/database/drivers/sqlite3/sqlite3_utility.php
+++ b/system/database/drivers/sqlite3/sqlite3_utility.php
@@ -35,12 +35,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_sqlite3_utility extends CI_DB_utility {
- protected $_list_databases = FALSE;
-
/**
- * SQLite Export
+ * Export
*
- * @param array Preferences
+ * @param array $params Preferences
* @return mixed
*/
protected function _backup($params = array())
diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php
index 1e5ef4bfd..8155565c0 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_forge.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php
@@ -35,8 +35,15 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_sqlsrv_forge extends CI_DB_forge {
+ /**
+ * DROP TABLE statement
+ *
+ * @var string
+ */
protected $_drop_table = 'DROP TABLE %s';
+ // --------------------------------------------------------------------
+
/**
* Create Table
*
diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php
index 5f7d0bdbb..315090049 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_utility.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php
@@ -35,13 +35,26 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
class CI_DB_sqlsrv_utility extends CI_DB_utility {
+ /**
+ * List databases statement
+ *
+ * @var string
+ */
protected $_list_databases = 'EXEC sp_helpdb'; // Can also be: EXEC sp_databases
+
+ /**
+ * OPTIMIZE TABLE statement
+ *
+ * @var string
+ */
protected $_optimize_table = 'ALTER INDEX all ON %s REORGANIZE';
+ // --------------------------------------------------------------------
+
/**
- * SQLSRV Export
+ * Export
*
- * @param array Preferences
+ * @param array $params Preferences
* @return bool
*/
protected function _backup($params = array())