sqlite.database



Database executeScript(string databasePath, 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 slaite Database easily

this(string databasePath, 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

void createTable(string tableName, 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" );

void createTable(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);" );

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

Params:
string tableName Name to table where will be dropped

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

@property Row[] tables();
tables

Returns:
all tables in current database

@property 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

Row[] table_info(string tableName);
table_info

Returns:
give table structure

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);" );

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)"] );

Row[] command(string query, VariantN!(24u)[] 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" );

void command(string[] querys, VariantN!(24u)[][] 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 model)?;"], [ [cast(Variant)1], [cast(Variant)"citroën", cast(Variant)"C5" ] ] );

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);

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

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


Page generated by Ddoc.