sqlite.database



@system Database executeScript(in string databasePath, in string[] lines...);
executeScript This function allow to user read a sql script and execute the content to database

Params:

databasePath:
Path to database whes script will ne executed

lines:
One or more sql script line provides by example a file

Examples:
File sql = File( "script.sql", "r"); foreach (T line; lines(f)) executeScript( "myDB.sqlite3.db", std.conv.to!(string) line );

class Database;
Database It is an object for manipulate sqlite Database easily

this(in string databasePath, in bool inMemory = false);
Constructor

Params:
string databasePath a path to an existing or not slite database
bool inMemory default false if you want load full databse in memory

@system void createTable(in string tableName, in string[] columns...);
createTable This method allow to user to create a table into current database

Params:
string tableName name to give to table
string[] columns each field fot this table by pair

Examples:
Database db = new Database( "myDB.sqlite3.db" ); db.createTable( "people", "name TEXT", "id INTEGER PRIMARY KEY NOT NULL" );

@system void createTable(in string query);
createTable This method allow to user to create a table into current database

Params:
string query SQL query for create a table

Examples:
Database db = new Database( "myDB.sqlite3.db" ); db.createTable( "CREATE TABLE people ( name TEXT, id INTEGER PRIMARY KEY NOT NULL);" );

@system void dropTable(in string tableName);
dropTable Remove given table from current database

Params:
string tableName Name to table where will be dropped

@property @system sqlite3* connection();
connection In normal use you do not need use it

@property @system Row[] tables();
tables

Returns:
all tables in current database

@property @system void updateTablesList();
updateTablesList update tables used in current table. This it is usefull when you create a table with command and not with createTable method

@system Row[] table_info(in string tableName);
table_info

Returns:
give table structure

@system Row[] command(string query);
command This method is usefull for run one custom command But prefer in first insert, select, udpdate method define in Table

Examples:
b.command( "CREATE TABLE people ( name TEXT, id INTEGER PRIMARY KEY NOT NULL);" );

@system void command(string[] querys);
command This method is usefull for run muliple custom commands But prefer in first insert, select, udpdate method define in Table

Examples:
b.command( ["CREATE TABLE people ( name TEXT, id INTEGER PRIMARY KEY NOT NULL);", "CREATE TABLE car ( constructor TEXT, model TEXT, id INTEGER PRIMARY KEY NOT NULL)"] );

@system Row[] command(string query, Variant[] values...);
command This method is usefull for run one custom command But prefer in first insert, select, udpdate method define in Table

Examples:
b.command( "SELECT FROM people ( name ) WHERE id=?;", cast(Variant)1 ); b.command( "SELECT FROM car ( name ) WHERE constructor=? and model=?;", cast(Variant) "citroën", cast(Variant) "C5");

@system void command(string[] querys, Variant[][] values...);
command This method is usefull for run multiple custom command But prefer in first insert, select, udpdate method define in Table

Examples:
b.command( ["SELECT FROM people ( name ) WHERE id=?;", "SELECT FROM car ( name ) WHERE constructor=? and mode=?;"], [ [cast(Variant)1], [cast(Variant)"citroën", cast(Variant)"C5" ] ] );

@system int opApply(int delegate(ref Table) dg);
opApply This method allow user to iterate through database for get table foreach(Table t; db) t.select( ["name"], "id=?", cast(Variant) 5);

@system Table opIndex(in string name);
opIndex This method allow user to get table by his name

Example:
Table people = db["people"];


Page generated by Ddoc.