summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-25 08:56:49 +0200
committeradmin <devnull@localhost>2006-09-25 08:56:49 +0200
commit6cec6a58d993fb0b1beb5fac7ea0d1cb9769c0a4 (patch)
tree7822c065d054814fd1c44d1d2ef0159d535b446a /system/database
parent4ceac2d4efa5a16486b6e97911bb32e261b9d648 (diff)
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB_utility.php29
-rw-r--r--system/database/drivers/mssql/mssql_utility.php12
-rw-r--r--system/database/drivers/mysql/mysql_utility.php12
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php12
-rw-r--r--system/database/drivers/oci8/oci8_utility.php6
-rw-r--r--system/database/drivers/odbc/odbc_utility.php8
-rw-r--r--system/database/drivers/postgre/postgre_utility.php12
-rw-r--r--system/database/drivers/sqlite/sqlite_utility.php6
8 files changed, 55 insertions, 42 deletions
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 8e1921dbc..128984d4f 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -181,7 +181,8 @@ class CI_DB_utility {
return FALSE;
}
- return $this->_field_data($this->db->dbprefix.$table);
+ $query = $this->db->query($this->_field_data($this->db->dbprefix.$table));
+ return $query->field_data();
}
// --------------------------------------------------------------------
@@ -208,6 +209,32 @@ class CI_DB_utility {
return current($fields);
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Create database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function create_database($name)
+ {
+ $sql = $this->_create_database($name);
+
+ if (is_bool($sql))
+ {
+ return $sql;
+ }
+
+ return $this->db->query($sql);
+ }
+
+ // --------------------------------------------------------------------
+
+
+
+
function create_table()
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 61fe5fcbc..49b63b7d0 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -28,13 +28,13 @@ class CI_DB_mssql_utility extends CI_DB_utility {
/**
* Create database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function create_database($name)
+ function _create_database($name)
{
- return $this->db->query("CREATE DATABASE ".$name);
+ return "CREATE DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -84,7 +84,7 @@ class CI_DB_mssql_utility extends CI_DB_utility {
*/
function drop_table($table)
{
- "DROP TABLE ".$this->db->_escape_table($name);
+ return $this->db->query("DROP TABLE ".$this->db->_escape_table($name));
}
// --------------------------------------------------------------------
@@ -144,9 +144,7 @@ class CI_DB_mssql_utility extends CI_DB_utility {
*/
function _field_data($table)
{
- $sql = "SELECT TOP 1 FROM ".$this->db->_escape_table($table);
- $query = $this->db->query($sql);
- return $query->field_data();
+ return "SELECT TOP 1 FROM ".$this->db->_escape_table($table);
}
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index 23c4e094d..e5f8e850d 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -27,13 +27,13 @@ class CI_DB_mysql_utility extends CI_DB_utility {
/**
* Create database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function create_database($name)
+ function _create_database($name)
{
- return $this->db->query("CREATE DATABASE ".$name);
+ return "CREATE DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -83,7 +83,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
*/
function drop_table($table)
{
- "DROP TABLE IF EXISTS ".$this->db->_escape_table($name);
+ return $this->db->query("DROP TABLE IF EXISTS ".$this->db->_escape_table($name));
}
// --------------------------------------------------------------------
@@ -143,9 +143,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
*/
function _field_data($table)
{
- $sql = "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
- $query = $this->db->query($sql);
- return $query->field_data();
+ return "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
}
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index ca8f3fe34..1775047ca 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -27,13 +27,13 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
/**
* Create database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function create_database($name)
+ function _create_database($name)
{
- return $this->db->query("CREATE DATABASE ".$name);
+ return "CREATE DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -83,7 +83,7 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
*/
function drop_table($table)
{
- "DROP TABLE IF EXISTS ".$this->db->_escape_table($name);
+ return $this->db->query("DROP TABLE IF EXISTS ".$this->db->_escape_table($name));
}
// --------------------------------------------------------------------
@@ -143,9 +143,7 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
*/
function _field_data($table)
{
- $sql = "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
- $query = $this->db->query($sql);
- return $query->field_data();
+ return "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
}
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index 7e3ee7285..74b0165cb 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -32,7 +32,7 @@ class CI_DB_oci8_utility extends CI_DB_utility {
* @param string the database name
* @return bool
*/
- function create_database($name)
+ function _create_database($name)
{
}
@@ -130,9 +130,7 @@ class CI_DB_oci8_utility extends CI_DB_utility {
*/
function _field_data($table)
{
- $sql = "SELECT * FROM ".$this->db->_escape_table($table)." where rownum = 1";
- $query = $this->db->query($sql);
- return $query->field_data();
+ return "SELECT * FROM ".$this->db->_escape_table($table)." where rownum = 1";
}
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index cfd829cb6..74f8d3905 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -28,11 +28,11 @@ class CI_DB_odbc_utility extends CI_DB_utility {
/**
* Create database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function create_database($name)
+ function _create_database()
{
// ODBC has no "create database" command since it's
// designed to connect to an existing database
@@ -156,9 +156,7 @@ class CI_DB_odbc_utility extends CI_DB_utility {
*/
function _field_data($table)
{
- $sql = "SELECT TOP 1 FROM ".$this->db->_escape_table($table);
- $query = $this->db->query($sql);
- return $query->field_data();
+ return "SELECT TOP 1 FROM ".$this->db->_escape_table($table);
}
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index 7bb210ab7..8e51623be 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -28,13 +28,13 @@ class CI_DB_postgre_utility extends CI_DB_utility {
/**
* Create database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function create_database($name)
+ function _create_database($name)
{
- return $this->db->query("CREATE DATABASE ".$name);
+ return "CREATE DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -84,7 +84,7 @@ class CI_DB_postgre_utility extends CI_DB_utility {
*/
function drop_table($table)
{
- "DROP TABLE ".$this->db->_escape_table($name)." CASCADE";
+ return $this->db->query("DROP TABLE ".$this->db->_escape_table($name)." CASCADE");
}
// --------------------------------------------------------------------
@@ -144,9 +144,7 @@ class CI_DB_postgre_utility extends CI_DB_utility {
*/
function _field_data($table)
{
- $sql = "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
- $query = $this->db->query($sql);
- return $query->field_data();
+ return "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
}
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index 744ca3f37..14b406a5c 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -32,7 +32,7 @@ class CI_DB_sqlite_utility extends CI_DB_utility {
* @param string the database name
* @return bool
*/
- function create_database()
+ function _create_database()
{
// In SQLite, a database is created when you connect to the database
return TRUE;
@@ -152,9 +152,7 @@ class CI_DB_sqlite_utility extends CI_DB_utility {
*/
function _field_data($table)
{
- $sql = "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
- $query = $this->db->query($sql);
- return $query->field_data();
+ return "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
}