CI_DB_forge::create_database PHP Method

create_database() public method

Create database
public create_database ( string $db_name ) : boolean
$db_name string
return boolean
    public function create_database($db_name)
    {
        if ($this->_create_database === FALSE) {
            return $this->db->db_debug ? $this->db->display_error('db_unsupported_feature') : FALSE;
        } elseif (!$this->db->query(sprintf($this->_create_database, $db_name, $this->db->char_set, $this->db->dbcollat))) {
            return $this->db->db_debug ? $this->db->display_error('db_unable_to_drop') : FALSE;
        }
        if (!empty($this->db->data_cache['db_names'])) {
            $this->db->data_cache['db_names'][] = $db_name;
        }
        return TRUE;
    }

Usage Example

コード例 #1
0
ファイル: ibase_forge.php プロジェクト: rud0lph/ci-guestbook
 /**
  * Create database
  *
  * @param	string	$db_name
  * @return	string
  */
 public function create_database($db_name)
 {
     // Firebird databases are flat files, so a path is required
     // Hostname is needed for remote access
     empty($this->db->hostname) or $db_name = $this->hostname . ':' . $db_name;
     return parent::create_database('"' . $db_name . '"');
 }