summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/interbase
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-02-17 21:58:08 +0100
committerTimothy Warren <tim@timshomepage.net>2012-02-17 21:58:08 +0100
commitc2b712eb5230fc247ef81b4b88de789b9dd08cb4 (patch)
tree20cd09b5e290d6f96b86036ebd2f06b3bf6dd118 /system/database/drivers/interbase
parent7d42eb39484a784496868f4446a2d47b0c52410d (diff)
implemented create_database, misc cleanup
Diffstat (limited to 'system/database/drivers/interbase')
-rw-r--r--system/database/drivers/interbase/interbase_driver.php17
-rw-r--r--system/database/drivers/interbase/interbase_forge.php20
2 files changed, 16 insertions, 21 deletions
diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php
index 20663d8bb..bc7365e4d 100644
--- a/system/database/drivers/interbase/interbase_driver.php
+++ b/system/database/drivers/interbase/interbase_driver.php
@@ -104,7 +104,7 @@ class CI_DB_interbase_driver extends CI_DB {
/**
* Select the database
*
- * @return resource
+ * @return bool
*/
public function db_select()
{
@@ -119,7 +119,7 @@ class CI_DB_interbase_driver extends CI_DB {
*
* @param string
* @param string
- * @return resource
+ * @return bool
*/
public function db_set_charset($charset, $collation)
{
@@ -332,6 +332,8 @@ class CI_DB_interbase_driver extends CI_DB {
$query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . ' FROM ' . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
+ $query->result_array();
+
if ($query->num_rows() == 0)
{
return 0;
@@ -379,17 +381,10 @@ SQL;
*/
public function _list_columns($table = '')
{
- $sql = <<<SQL
+ return <<<SQL
SELECT "RDB\$FIELD_NAME" FROM "RDB\$RELATION_FIELDS"
- WHERE "RDB\$RELATION_NAME" NOT LIKE 'RDB$%'
- AND "RDB\$RELATION_NAME" NOT LIKE 'MON$%'
+ WHERE "RDB\$RELATION_NAME"='{$table}';
SQL;
- if($table !== '')
- {
- $sql .= ' AND "RDB$RELATION_NAME"='.$table;
- }
-
- return $sql;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/interbase/interbase_forge.php b/system/database/drivers/interbase/interbase_forge.php
index 6301481c5..d9b55a87f 100644
--- a/system/database/drivers/interbase/interbase_forge.php
+++ b/system/database/drivers/interbase/interbase_forge.php
@@ -40,13 +40,14 @@ class CI_DB_interbase_forge extends CI_DB_forge {
* Create database
*
* @param string the database name
- * @return bool
+ * @return string
*/
- public function _create_database()
+ public function _create_database($filename='')
{
- // In Interbase/Firebird, a database is created when you connect to the database.
- // We'll return TRUE so that an error isn't generated
- return TRUE;
+ // Firebird databases are flat files, so a path is required
+ // Hostname is needed for remote access
+ return 'CREATE DATABASE "'.$this->hostname.':'.$filename.'"';
+
}
// --------------------------------------------------------------------
@@ -72,7 +73,7 @@ class CI_DB_interbase_forge extends CI_DB_forge {
* @param mixed primary key(s)
* @param mixed key(s)
* @param boolean should 'IF NOT EXISTS' be added to the SQL
- * @return bool
+ * @return string
*/
public function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
{
@@ -168,7 +169,7 @@ class CI_DB_interbase_forge extends CI_DB_forge {
/**
* Drop Table
*
- * @return bool
+ * @return string
*/
public function _drop_table($table)
{
@@ -190,7 +191,7 @@ class CI_DB_interbase_forge extends CI_DB_forge {
* @param string the default value
* @param boolean should 'NOT NULL' be added
* @param string the field after which we should add the new field
- * @return object
+ * @return string
*/
public function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '')
{
@@ -234,8 +235,7 @@ class CI_DB_interbase_forge extends CI_DB_forge {
*/
public 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;
+ return 'ALTER TABLE '.$this->db->_protect_identifiers($table_name).' RENAME TO '.$this->db->_protect_identifiers($new_table_name);
}
}