Firebird 2.0
PHP5 Programming
Manual

FBIRD_QUERY – NEW DATABASE CREATION

Purpose

Use a special form of the fbird_query function to create a new database.

Syntax

<connect_query> ::=
   fbird_query( IBASE_CREATE, create_sql)


Element 
Type
Description
create_sql
string
A valid DB creation statement
<return>
mixed
A connection handle on success, False on failure

Semantics

When called with the special connection handle IBASE_CREATE, the fbird_query function accepts one type of SQL statement, the create database statement. See the next topic for syntax.

Example

The below example creates a test database with one table containing one row:

$user = 'SYSDBA';
$password = 'masterkey';
$test_db = fbird_query(IBASE_CREATE,
   sprintf("CREATE SCHEMA 'test.fdb' USER '%s' PASSWORD '%s' DEFAULT
   CHARACTER SET NONE", $user, $password));
$tr = fbird_trans($test_db);
fbird_query($tr,"create table test1 (i integer, c varchar(100))");
fbird_commit_ret($tr);
fbird_query($tr,"insert into test1(i, c) values(1, 'test table not                  created with isql')");
fbird_commit($tr);
fbird_close($test_db);



See also

create syntax


previous page goto index next page

Legal information