diff options
author | Rick Ellis <rick.ellis@ellislab.com> | 2008-09-30 22:38:12 +0200 |
---|---|---|
committer | Rick Ellis <rick.ellis@ellislab.com> | 2008-09-30 22:38:12 +0200 |
commit | ff73401cdef0136c15c6dab95d4d722123668e7a (patch) | |
tree | a9d04ceca35fb777cdd769a1b093821d195de230 /system/database | |
parent | 8f99224e6c6d3ac51cb0f356e2e0feb10fa93f31 (diff) |
Did a little clean up. Nothing that affected functionality
Diffstat (limited to 'system/database')
-rw-r--r-- | system/database/DB_active_rec.php | 3 | ||||
-rw-r--r-- | system/database/DB_forge.php | 10 | ||||
-rw-r--r-- | system/database/drivers/mssql/mssql_driver.php | 2 | ||||
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 3 | ||||
-rw-r--r-- | system/database/drivers/oci8/oci8_driver.php | 2 | ||||
-rw-r--r-- | system/database/drivers/odbc/odbc_driver.php | 2 | ||||
-rw-r--r-- | system/database/drivers/postgre/postgre_driver.php | 2 | ||||
-rw-r--r-- | system/database/drivers/sqlite/sqlite_driver.php | 20 | ||||
-rw-r--r-- | system/database/drivers/sqlite/sqlite_forge.php | 22 |
9 files changed, 39 insertions, 27 deletions
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index fccf1b0a2..355868386 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -821,11 +821,10 @@ class CI_DB_active_record extends CI_DB_driver { /**
* Sets the HAVING values
*
- * Called by having() or orhaving()
+ * Called by having() or or_having()
*
* @access private
* @param string
-
* @param string
* @return object
*/
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index cc88c32f9..d48165e2b 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -97,6 +97,16 @@ class CI_DB_forge { */
function add_key($key = '', $primary = FALSE)
{
+ if (is_array($key))
+ {
+ foreach($key as $one)
+ {
+ $this->add_key($one, $primary);
+ }
+
+ return;
+ }
+
if ($key == '')
{
show_error('Key information is required for that operation.');
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 9a912a320..fd3f9638a 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -87,7 +87,7 @@ class CI_DB_mssql_driver extends CI_DB { */
function db_set_charset($charset, $collation)
{
- // TODO - add support if needed
+ // @todo - add support if needed
return TRUE;
}
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index de372e669..52df1e591 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -314,6 +314,9 @@ class CI_DB_mysql_driver extends CI_DB { $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows'). " FROM " . $this->_protect_identifiers($this->dbprefix.$table));
+ if ($query->num_rows() == 0)
+ return '0';
+
$row = $query->row();
return (int)$row->numrows;
}
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index b45b00326..9d9193252 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -111,7 +111,7 @@ class CI_DB_oci8_driver extends CI_DB { */
function db_set_charset($charset, $collation)
{
- // TODO - add support if needed
+ // @todo - add support if needed
return TRUE;
}
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index ed8f81cb9..06282e55c 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -94,7 +94,7 @@ class CI_DB_odbc_driver extends CI_DB { */
function db_set_charset($charset, $collation)
{
- // TODO - add support if needed
+ // @todo - add support if needed
return TRUE;
}
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 3d006d3d6..55f650280 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -92,7 +92,7 @@ class CI_DB_postgre_driver extends CI_DB { */
function db_set_charset($charset, $collation)
{
- // TODO - add support if needed
+ // @todo - add support if needed
return TRUE;
}
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 46e0fae49..782156949 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -113,7 +113,7 @@ class CI_DB_sqlite_driver extends CI_DB { */
function db_set_charset($charset, $collation)
{
- // TODO - add support if needed
+ // @todo - add support if needed
return TRUE;
}
@@ -651,24 +651,6 @@ class CI_DB_sqlite_driver extends CI_DB { @sqlite_close($conn_id);
}
- // --------------------------------------------------------------------
-
- /**
- * Rename a table
- *
- * Generates a platform-specific query so that a table can be renamed
- *
- * @access private
- * @param string the old table name
- * @param string the new table name
- * @return string
- */
- function _rename_table($table_name, $new_table_name)
- {
- $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name);
- return $sql;
- }
-
}
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 05f366a6f..631c9c771 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -144,7 +144,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { $primary_keys = $this->db->_protect_identifiers($primary_keys);
$sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")";
}
-
+
if (is_array($keys) && count($keys) > 0)
{
foreach ($keys as $key)
@@ -161,7 +161,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { $sql .= ",\n\tUNIQUE (" . implode(', ', $key) . ")";
}
}
-
+
$sql .= "\n)";
return $sql;
@@ -241,6 +241,24 @@ class CI_DB_sqlite_forge extends CI_DB_forge { return $sql;
}
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Rename a table
+ *
+ * Generates a platform-specific query so that a table can be renamed
+ *
+ * @access private
+ * @param string the old table name
+ * @param string the new table name
+ * @return string
+ */
+ function _rename_table($table_name, $new_table_name)
+ {
+ $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name);
+ return $sql;
+ }
}
/* End of file sqlite_forge.php */
|