diff --git a/Data-Definition.md b/Data-Definition.md new file mode 100644 index 0000000..7ee08ef --- /dev/null +++ b/Data-Definition.md @@ -0,0 +1,41 @@ +## 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. \ No newline at end of file