- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:dictionary:createdatabase

# createDatabase

##### Syntax

    string createDatabase(
        string $databaseName,
        optional mixed $databaseOptions=false
    )

## Description

The method `createDatabase()` returns an array of strings holding the SQL necessary to create a database (or user space) on the current DBMS. To actually execute the code, the output must be passes to executesqlarray.

## Usage

    /*
    * On an Oracle system
    */
    $dict = newdataDictionary($db);
    print_r($dict->createDatabase('ADODB_TEST'));
    /*
    * Returns
    Array
    (
        [0] => CREATE USER ADODB_TEST IDENTIFIED BY tiger
        [1] => GRANT CREATE SESSION, CREATE TABLE,UNLIMITED TABLESPACE,CREATE SEQUENCE TO ADODB_TEST
    )
    */

## Notes

- Support for this method is limited
- Each supported database has its own specific options
- Special rights on the database may be need to actually execute the returned SQL
- In the driver current in use does not support the method, false is returned

v5/dictionary/createdatabase.txt · Last modified: 2016/01/12 17:06 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top