1 Data Definition
Shikiryu edited this page 2019-10-21 09:34:04 +02:00

Create Database

Syntax: public function createDatabase($file)

Params: $file filename

Mainly use in the constructor

Example:

$xmldb = new XMLDB('test.xml', 'id', true);

Particular Behaviour:

Thanks to the constructor, you can manage your DB __construct($file, $pk = "id", $createIfNotExist = false, $databaseName = "Database", $tableName = "table", $itemName = "item", $encoding = "utf-8") We advise you to stay with default params anyway.

Drop Database

Syntax: public function dropDatabase($definitely = false)

Params: $definitely boolean do you wanna delete the file too ?

Example: $xmldbtest->dropDatabase(); will reset your DB, but your file'll still exist on your server.

Create Table

Syntax: public function createTable($name, $autoincrement = false, $aiDefaultValue = 0)

Example: $xmldbtest->createTable('table1', true, 2)

The new table will append in your DB. Therefore, it'll be the last table in the file (if it might help). New: You can now configure each table with an autoincrement index.

h2. Drop Table

Syntax: public function dropTable($table)

Example: $xmldbtest->dropTable('table1')

This will delete the table with the given name.