SQLINQ Class Library  (April 2015)
Using SQLINQ to transform UML to C#
Assets.SQLINQ.SQLite.Net.SQLiteConnection Class Reference

Represents an open connection to a SQLite database. More...

Inheritance diagram for Assets.SQLINQ.SQLite.Net.SQLiteConnection:

Classes

class  ColumnInfo
 

Public Member Functions

 SQLiteConnection (string databasePath, bool storeDateTimeAsTicks=true)
 Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath. More...
 
 SQLiteConnection (string databasePath, SQLiteOpenFlags openFlags, bool storeDateTimeAsTicks=true)
 Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath. More...
 
void EnableLoadExtension (int onoff)
 
TableMapping GetMapping (Type type, CreateFlags createFlags=CreateFlags.None)
 Retrieves the mapping that is automatically generated for the given type. More...
 
TableMapping GetMapping< T > ()
 Retrieves the mapping that is automatically generated for the given type. More...
 
int DropTable< T > ()
 Executes a "drop table" on the database. This is non-recoverable. More...
 
int CreateTable< T > (CreateFlags createFlags=CreateFlags.None)
 Executes a "create table if not exists" on the database. It also creates any specified indexes on the columns of the table. It uses a schema automatically generated from the specified type. You can later access this schema by calling GetMapping. More...
 
int CreateTable (Type ty, CreateFlags createFlags=CreateFlags.None)
 Executes a "create table if not exists" on the database. It also creates any specified indexes on the columns of the table. It uses a schema automatically generated from the specified type. You can later access this schema by calling GetMapping. More...
 
int CreateIndex (string indexName, string tableName, string[] columnNames, bool unique=false)
 Creates an index for the specified table and columns. More...
 
int CreateIndex (string indexName, string tableName, string columnName, bool unique=false)
 Creates an index for the specified table and column. More...
 
int CreateIndex (string tableName, string columnName, bool unique=false)
 Creates an index for the specified table and column. More...
 
int CreateIndex (string tableName, string[] columnNames, bool unique=false)
 Creates an index for the specified table and columns. More...
 
void CreateIndex< T > (Expression< Func< T, object >> property, bool unique=false)
 Creates an index for the specified object property. e.g. CreateIndex<Client>(c => c.Name); More...
 
List< ColumnInfoGetTableInfo (string tableName)
 
SQLiteCommand CreateCommand (string cmdText, params object[] ps)
 Creates a new SQLiteCommand given the command text with arguments. Place a '?' in the command text for each of the arguments. More...
 
int Execute (string query, params object[] args)
 Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?' in the command text for each of the arguments and then executes that command. Use this method instead of Query when you don't expect rows back. Such cases include INSERTs, UPDATEs, and DELETEs. You can set the Trace or TimeExecution properties of the connection to profile execution. More...
 
ExecuteScalar< T > (string query, params object[] args)
 
List< T > Query< T > (string query, params object[] args)
 Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?' in the command text for each of the arguments and then executes that command. It returns each row of the result using the mapping automatically generated for the given type. More...
 
IEnumerable< T > DeferredQuery< T > (string query, params object[] args)
 Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?' in the command text for each of the arguments and then executes that command. It returns each row of the result using the mapping automatically generated for the given type. More...
 
List< object > Query (TableMapping map, string query, params object[] args)
 Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?' in the command text for each of the arguments and then executes that command. It returns each row of the result using the specified mapping. This function is only used by libraries in order to query the database via introspection. It is normally not used. More...
 
IEnumerable< object > DeferredQuery (TableMapping map, string query, params object[] args)
 Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?' in the command text for each of the arguments and then executes that command. It returns each row of the result using the specified mapping. This function is only used by libraries in order to query the database via introspection. It is normally not used. More...
 
TableQuery< T > Table< T > ()
 Returns a queryable interface to the table represented by the given type. More...
 
Get< T > (object pk)
 Attempts to retrieve an object with the given primary key from the table associated with the specified type. Use of this method requires that the given type have a designated PrimaryKey (using the PrimaryKeyAttribute). More...
 
Get< T > (Expression< Func< T, bool >> predicate)
 Attempts to retrieve the first object that matches the predicate from the table associated with the specified type. More...
 
Find< T > (object pk)
 Attempts to retrieve an object with the given primary key from the table associated with the specified type. Use of this method requires that the given type have a designated PrimaryKey (using the PrimaryKeyAttribute). More...
 
object Find (object pk, TableMapping map)
 Attempts to retrieve an object with the given primary key from the table associated with the specified type. Use of this method requires that the given type have a designated PrimaryKey (using the PrimaryKeyAttribute). More...
 
Find< T > (Expression< Func< T, bool >> predicate)
 Attempts to retrieve the first object that matches the predicate from the table associated with the specified type. More...
 
FindWithQuery< T > (string query, params object[] args)
 Attempts to retrieve the first object that matches the query from the table associated with the specified type. More...
 
void BeginTransaction ()
 Begins a new transaction. Call Commit to end the transaction. More...
 
string SaveTransactionPoint ()
 Creates a savepoint in the database at the current point in the transaction timeline. Begins a new transaction if one is not in progress. More...
 
void Rollback ()
 Rolls back the transaction that was begun by BeginTransaction or SaveTransactionPoint. More...
 
void RollbackTo (string savepoint)
 Rolls back the savepoint created by BeginTransaction or SaveTransactionPoint. More...
 
void Release (string savepoint)
 Releases a savepoint returned from SaveTransactionPoint. Releasing a savepoint makes changes since that savepoint permanent if the savepoint began the transaction, or otherwise the changes are permanent pending a call to Commit. More...
 
void Commit ()
 Commits the transaction that was begun by BeginTransaction. More...
 
void RunInTransaction (Action action)
 Executes

Parameters
actionwithin a (possibly nested) transaction by wrapping it in a SAVEPOINT. If an exception occurs the whole transaction is rolled back, not just the current savepoint. The exception is rethrown.
More...
 
int InsertAll (System.Collections.IEnumerable objects, bool runInTransaction=true)
 Inserts all specified objects. More...
 
int InsertAll (System.Collections.IEnumerable objects, string extra, bool runInTransaction=true)
 Inserts all specified objects. More...
 
int InsertAll (System.Collections.IEnumerable objects, Type objType, bool runInTransaction=true)
 Inserts all specified objects. More...
 
int Insert (object obj)
 Inserts the given object and retrieves its auto incremented primary key if it has one. More...
 
int InsertOrReplace (object obj)
 Inserts the given object and retrieves its auto incremented primary key if it has one. If a UNIQUE constraint violation occurs with some pre-existing object, this function deletes the old object. More...
 
int Insert (object obj, Type objType)
 Inserts the given object and retrieves its auto incremented primary key if it has one. More...
 
int InsertOrReplace (object obj, Type objType)
 Inserts the given object and retrieves its auto incremented primary key if it has one. If a UNIQUE constraint violation occurs with some pre-existing object, this function deletes the old object. More...
 
int Insert (object obj, string extra)
 Inserts the given object and retrieves its auto incremented primary key if it has one. More...
 
int Insert (object obj, string extra, Type objType)
 Inserts the given object and retrieves its auto incremented primary key if it has one. More...
 
int Update (object obj)
 Updates all of the columns of a table using the specified object except for its primary key. The object is required to have a primary key. More...
 
int Update (object obj, Type objType)
 Updates all of the columns of a table using the specified object except for its primary key. The object is required to have a primary key. More...
 
int UpdateAll (System.Collections.IEnumerable objects, bool runInTransaction=true)
 Updates all specified objects. More...
 
int Delete (object objectToDelete)
 Deletes the given object from the database using its primary key. More...
 
int Delete< T > (object primaryKey)
 Deletes the object with the specified primary key. More...
 
int DeleteAll< T > ()
 Deletes all the objects from the specified table. WARNING WARNING: Let me repeat. It deletes ALL the objects from the specified table. Do you really want to do that? More...
 
void Dispose ()
 
void Close ()
 

Protected Member Functions

virtual SQLiteCommand NewCommand ()
 Creates a new SQLiteCommand. Can be overridden to provide a sub-class. More...
 
virtual void Dispose (bool disposing)
 

Properties

IntPtr Handle [get]
 
string DatabasePath [get]
 
bool TimeExecution [get, set]
 
bool Trace [get, set]
 
bool StoreDateTimeAsTicks [get]
 
TimeSpan BusyTimeout [get, set]
 Sets a busy handler to sleep the specified amount of time when a table is locked. The handler will sleep multiple times until a total time of BusyTimeout has accumulated. More...
 
IEnumerable< TableMappingTableMappings [get]
 Returns the mappings from types to tables that the connection currently understands. More...
 
bool IsInTransaction [get]
 Whether BeginTransaction has been called and the database is waiting for a Commit. More...
 

Events

EventHandler< NotifyTableChangedEventArgsTableChanged
 

Detailed Description

Represents an open connection to a SQLite database.

Constructor & Destructor Documentation

Assets.SQLINQ.SQLite.Net.SQLiteConnection.SQLiteConnection ( string  databasePath,
bool  storeDateTimeAsTicks = true 
)

Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath.

Parameters
databasePathSpecifies the path to the database file.
storeDateTimeAsTicksSpecifies whether to store DateTime properties as ticks (true) or strings (false). You absolutely do want to store them as Ticks in all new projects. The value of false is only here for backwards compatibility. There is a significant speed advantage, with no down sides, when setting storeDateTimeAsTicks = true. If you use DateTimeOffset properties, it will be always stored as ticks regardingless the storeDateTimeAsTicks parameter.
Assets.SQLINQ.SQLite.Net.SQLiteConnection.SQLiteConnection ( string  databasePath,
SQLiteOpenFlags  openFlags,
bool  storeDateTimeAsTicks = true 
)

Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath.

Parameters
databasePathSpecifies the path to the database file.
storeDateTimeAsTicksSpecifies whether to store DateTime properties as ticks (true) or strings (false). You absolutely do want to store them as Ticks in all new projects. The value of false is only here for backwards compatibility. There is a significant speed advantage, with no down sides, when setting storeDateTimeAsTicks = true. If you use DateTimeOffset properties, it will be always stored as ticks regardingless the storeDateTimeAsTicks parameter.

Member Function Documentation

void Assets.SQLINQ.SQLite.Net.SQLiteConnection.BeginTransaction ( )

Begins a new transaction. Call Commit to end the transaction.

Throws if a transaction has already begun.

void Assets.SQLINQ.SQLite.Net.SQLiteConnection.Commit ( )

Commits the transaction that was begun by BeginTransaction.

SQLiteCommand Assets.SQLINQ.SQLite.Net.SQLiteConnection.CreateCommand ( string  cmdText,
params object[]  ps 
)

Creates a new SQLiteCommand given the command text with arguments. Place a '?' in the command text for each of the arguments.

Parameters
cmdTextThe fully escaped SQL.
argsArguments to substitute for the occurences of '?' in the command text.
Returns
A SQLiteCommand
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.CreateIndex ( string  indexName,
string  tableName,
string[]  columnNames,
bool  unique = false 
)

Creates an index for the specified table and columns.

Parameters
indexNameName of the index to create
tableNameName of the database table
columnNamesAn array of column names to index
uniqueWhether the index should be unique
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.CreateIndex ( string  indexName,
string  tableName,
string  columnName,
bool  unique = false 
)

Creates an index for the specified table and column.

Parameters
indexNameName of the index to create
tableNameName of the database table
columnNameName of the column to index
uniqueWhether the index should be unique
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.CreateIndex ( string  tableName,
string  columnName,
bool  unique = false 
)

Creates an index for the specified table and column.

Parameters
tableNameName of the database table
columnNameName of the column to index
uniqueWhether the index should be unique
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.CreateIndex ( string  tableName,
string[]  columnNames,
bool  unique = false 
)

Creates an index for the specified table and columns.

Parameters
tableNameName of the database table
columnNamesAn array of column names to index
uniqueWhether the index should be unique
void Assets.SQLINQ.SQLite.Net.SQLiteConnection.CreateIndex< T > ( Expression< Func< T, object >>  property,
bool  unique = false 
)

Creates an index for the specified object property. e.g. CreateIndex<Client>(c => c.Name);

Template Parameters
TType to reflect to a database table.
Parameters
propertyProperty to index
uniqueWhether the index should be unique
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.CreateTable ( Type  ty,
CreateFlags  createFlags = CreateFlags.None 
)

Executes a "create table if not exists" on the database. It also creates any specified indexes on the columns of the table. It uses a schema automatically generated from the specified type. You can later access this schema by calling GetMapping.

Parameters
tyType to reflect to a database table.
createFlagsOptional flags allowing implicit PK and indexes based on naming conventions.
Returns
The number of entries added to the database schema.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.CreateTable< T > ( CreateFlags  createFlags = CreateFlags.None)

Executes a "create table if not exists" on the database. It also creates any specified indexes on the columns of the table. It uses a schema automatically generated from the specified type. You can later access this schema by calling GetMapping.

Returns
The number of entries added to the database schema.
IEnumerable<object> Assets.SQLINQ.SQLite.Net.SQLiteConnection.DeferredQuery ( TableMapping  map,
string  query,
params object[]  args 
)

Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?' in the command text for each of the arguments and then executes that command. It returns each row of the result using the specified mapping. This function is only used by libraries in order to query the database via introspection. It is normally not used.

Parameters
mapA TableMapping to use to convert the resulting rows into objects.
queryThe fully escaped SQL.
argsArguments to substitute for the occurences of '?' in the query.
Returns
An enumerable with one result for each row returned by the query. The enumerator will call sqlite3_step on each call to MoveNext, so the database connection must remain open for the lifetime of the enumerator.
IEnumerable<T> Assets.SQLINQ.SQLite.Net.SQLiteConnection.DeferredQuery< T > ( string  query,
params object[]  args 
)

Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?' in the command text for each of the arguments and then executes that command. It returns each row of the result using the mapping automatically generated for the given type.

Parameters
queryThe fully escaped SQL.
argsArguments to substitute for the occurences of '?' in the query.
Returns
An enumerable with one result for each row returned by the query. The enumerator will call sqlite3_step on each call to MoveNext, so the database connection must remain open for the lifetime of the enumerator.
Type Constraints
T :new() 
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.Delete ( object  objectToDelete)

Deletes the given object from the database using its primary key.

Parameters
objectToDeleteThe object to delete. It must have a primary key designated using the PrimaryKeyAttribute.
Returns
The number of rows deleted.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.Delete< T > ( object  primaryKey)

Deletes the object with the specified primary key.

Parameters
primaryKeyThe primary key of the object to delete.
Returns
The number of objects deleted.
Template Parameters
TThe type of object.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.DeleteAll< T > ( )

Deletes all the objects from the specified table. WARNING WARNING: Let me repeat. It deletes ALL the objects from the specified table. Do you really want to do that?

Returns
The number of objects deleted.
Template Parameters
TThe type of objects to delete.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.DropTable< T > ( )

Executes a "drop table" on the database. This is non-recoverable.

int Assets.SQLINQ.SQLite.Net.SQLiteConnection.Execute ( string  query,
params object[]  args 
)

Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?' in the command text for each of the arguments and then executes that command. Use this method instead of Query when you don't expect rows back. Such cases include INSERTs, UPDATEs, and DELETEs. You can set the Trace or TimeExecution properties of the connection to profile execution.

Parameters
queryThe fully escaped SQL.
argsArguments to substitute for the occurences of '?' in the query.
Returns
The number of rows modified in the database as a result of this execution.
object Assets.SQLINQ.SQLite.Net.SQLiteConnection.Find ( object  pk,
TableMapping  map 
)

Attempts to retrieve an object with the given primary key from the table associated with the specified type. Use of this method requires that the given type have a designated PrimaryKey (using the PrimaryKeyAttribute).

Parameters
pkThe primary key.
mapThe TableMapping used to identify the object type.
Returns
The object with the given primary key or null if the object is not found.

Attempts to retrieve an object with the given primary key from the table associated with the specified type. Use of this method requires that the given type have a designated PrimaryKey (using the PrimaryKeyAttribute).

Parameters
pkThe primary key.
Returns
The object with the given primary key or null if the object is not found.
Type Constraints
T :new 
T Assets.SQLINQ.SQLite.Net.SQLiteConnection.Find< T > ( Expression< Func< T, bool >>  predicate)

Attempts to retrieve the first object that matches the predicate from the table associated with the specified type.

Parameters
predicateA predicate for which object to find.
Returns
The object that matches the given predicate or null if the object is not found.
Type Constraints
T :new() 
T Assets.SQLINQ.SQLite.Net.SQLiteConnection.FindWithQuery< T > ( string  query,
params object[]  args 
)

Attempts to retrieve the first object that matches the query from the table associated with the specified type.

Parameters
queryThe fully escaped SQL.
argsArguments to substitute for the occurences of '?' in the query.
Returns
The object that matches the given predicate or null if the object is not found.
Type Constraints
T :new() 
T Assets.SQLINQ.SQLite.Net.SQLiteConnection.Get< T > ( object  pk)

Attempts to retrieve an object with the given primary key from the table associated with the specified type. Use of this method requires that the given type have a designated PrimaryKey (using the PrimaryKeyAttribute).

Parameters
pkThe primary key.
Returns
The object with the given primary key. Throws a not found exception if the object is not found.
Type Constraints
T :new() 
T Assets.SQLINQ.SQLite.Net.SQLiteConnection.Get< T > ( Expression< Func< T, bool >>  predicate)

Attempts to retrieve the first object that matches the predicate from the table associated with the specified type.

Parameters
predicateA predicate for which object to find.
Returns
The object that matches the given predicate. Throws a not found exception if the object is not found.
Type Constraints
T :new() 
TableMapping Assets.SQLINQ.SQLite.Net.SQLiteConnection.GetMapping ( Type  type,
CreateFlags  createFlags = CreateFlags.None 
)

Retrieves the mapping that is automatically generated for the given type.

Parameters
typeThe type whose mapping to the database is returned.
createFlagsOptional flags allowing implicit PK and indexes based on naming conventions
Returns
The mapping represents the schema of the columns of the database and contains methods to set and get properties of objects.

Retrieves the mapping that is automatically generated for the given type.

Returns
The mapping represents the schema of the columns of the database and contains methods to set and get properties of objects.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.Insert ( object  obj)

Inserts the given object and retrieves its auto incremented primary key if it has one.

Parameters
objThe object to insert.
Returns
The number of rows added to the table.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.Insert ( object  obj,
Type  objType 
)

Inserts the given object and retrieves its auto incremented primary key if it has one.

Parameters
objThe object to insert.
objTypeThe type of object to insert.
Returns
The number of rows added to the table.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.Insert ( object  obj,
string  extra 
)

Inserts the given object and retrieves its auto incremented primary key if it has one.

Parameters
objThe object to insert.
extraLiteral SQL code that gets placed into the command. INSERT {extra} INTO ...
Returns
The number of rows added to the table.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.Insert ( object  obj,
string  extra,
Type  objType 
)

Inserts the given object and retrieves its auto incremented primary key if it has one.

Parameters
objThe object to insert.
extraLiteral SQL code that gets placed into the command. INSERT {extra} INTO ...
objTypeThe type of object to insert.
Returns
The number of rows added to the table.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.InsertAll ( System.Collections.IEnumerable  objects,
bool  runInTransaction = true 
)

Inserts all specified objects.

Parameters
objectsAn IEnumerable of the objects to insert.
Parameters
runInTransactionA boolean indicating if the inserts should be wrapped in a transaction.
Returns
The number of rows added to the table.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.InsertAll ( System.Collections.IEnumerable  objects,
string  extra,
bool  runInTransaction = true 
)

Inserts all specified objects.

Parameters
objectsAn IEnumerable of the objects to insert.
extraLiteral SQL code that gets placed into the command. INSERT {extra} INTO ...
runInTransactionA boolean indicating if the inserts should be wrapped in a transaction.
Returns
The number of rows added to the table.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.InsertAll ( System.Collections.IEnumerable  objects,
Type  objType,
bool  runInTransaction = true 
)

Inserts all specified objects.

Parameters
objectsAn IEnumerable of the objects to insert.
objTypeThe type of object to insert.
runInTransactionA boolean indicating if the inserts should be wrapped in a transaction.
Returns
The number of rows added to the table.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.InsertOrReplace ( object  obj)

Inserts the given object and retrieves its auto incremented primary key if it has one. If a UNIQUE constraint violation occurs with some pre-existing object, this function deletes the old object.

Parameters
objThe object to insert.
Returns
The number of rows modified.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.InsertOrReplace ( object  obj,
Type  objType 
)

Inserts the given object and retrieves its auto incremented primary key if it has one. If a UNIQUE constraint violation occurs with some pre-existing object, this function deletes the old object.

Parameters
objThe object to insert.
objTypeThe type of object to insert.
Returns
The number of rows modified.
virtual SQLiteCommand Assets.SQLINQ.SQLite.Net.SQLiteConnection.NewCommand ( )
protectedvirtual

Creates a new SQLiteCommand. Can be overridden to provide a sub-class.

See also
SQLiteCommand.OnInstanceCreated
List<object> Assets.SQLINQ.SQLite.Net.SQLiteConnection.Query ( TableMapping  map,
string  query,
params object[]  args 
)

Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?' in the command text for each of the arguments and then executes that command. It returns each row of the result using the specified mapping. This function is only used by libraries in order to query the database via introspection. It is normally not used.

Parameters
mapA TableMapping to use to convert the resulting rows into objects.
queryThe fully escaped SQL.
argsArguments to substitute for the occurences of '?' in the query.
Returns
An enumerable with one result for each row returned by the query.
List<T> Assets.SQLINQ.SQLite.Net.SQLiteConnection.Query< T > ( string  query,
params object[]  args 
)

Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?' in the command text for each of the arguments and then executes that command. It returns each row of the result using the mapping automatically generated for the given type.

Parameters
queryThe fully escaped SQL.
argsArguments to substitute for the occurences of '?' in the query.
Returns
An enumerable with one result for each row returned by the query.
Type Constraints
T :new() 
void Assets.SQLINQ.SQLite.Net.SQLiteConnection.Release ( string  savepoint)

Releases a savepoint returned from SaveTransactionPoint. Releasing a savepoint makes changes since that savepoint permanent if the savepoint began the transaction, or otherwise the changes are permanent pending a call to Commit.

The RELEASE command is like a COMMIT for a SAVEPOINT.

Parameters
savepointThe name of the savepoint to release. The string should be the result of a call to SaveTransactionPoint
void Assets.SQLINQ.SQLite.Net.SQLiteConnection.Rollback ( )

Rolls back the transaction that was begun by BeginTransaction or SaveTransactionPoint.

void Assets.SQLINQ.SQLite.Net.SQLiteConnection.RollbackTo ( string  savepoint)

Rolls back the savepoint created by BeginTransaction or SaveTransactionPoint.

Parameters
savepointThe name of the savepoint to roll back to, as returned by SaveTransactionPoint. If savepoint is null or empty, this method is equivalent to a call to Rollback
void Assets.SQLINQ.SQLite.Net.SQLiteConnection.RunInTransaction ( Action  action)

Executes

Parameters
actionwithin a (possibly nested) transaction by wrapping it in a SAVEPOINT. If an exception occurs the whole transaction is rolled back, not just the current savepoint. The exception is rethrown.

Parameters
actionThe Action to perform within a transaction.
Parameters
actioncan contain any number of operations on the connection but should never call BeginTransaction or Commit.
string Assets.SQLINQ.SQLite.Net.SQLiteConnection.SaveTransactionPoint ( )

Creates a savepoint in the database at the current point in the transaction timeline. Begins a new transaction if one is not in progress.

Call RollbackTo to undo transactions since the returned savepoint. Call Release to commit transactions after the savepoint returned here. Call Commit to end the transaction, committing all changes.

Returns
A string naming the savepoint.
TableQuery<T> Assets.SQLINQ.SQLite.Net.SQLiteConnection.Table< T > ( )

Returns a queryable interface to the table represented by the given type.

Returns
A queryable object that is able to translate Where, OrderBy, and Take queries into native SQL.
Type Constraints
T :new() 
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.Update ( object  obj)

Updates all of the columns of a table using the specified object except for its primary key. The object is required to have a primary key.

Parameters
objThe object to update. It must have a primary key designated using the PrimaryKeyAttribute.
Returns
The number of rows updated.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.Update ( object  obj,
Type  objType 
)

Updates all of the columns of a table using the specified object except for its primary key. The object is required to have a primary key.

Parameters
objThe object to update. It must have a primary key designated using the PrimaryKeyAttribute.
objTypeThe type of object to insert.
Returns
The number of rows updated.
int Assets.SQLINQ.SQLite.Net.SQLiteConnection.UpdateAll ( System.Collections.IEnumerable  objects,
bool  runInTransaction = true 
)

Updates all specified objects.

Parameters
objectsAn IEnumerable of the objects to insert.
runInTransactionA boolean indicating if the inserts should be wrapped in a transaction
Returns
The number of rows modified.

Property Documentation

TimeSpan Assets.SQLINQ.SQLite.Net.SQLiteConnection.BusyTimeout
getset

Sets a busy handler to sleep the specified amount of time when a table is locked. The handler will sleep multiple times until a total time of BusyTimeout has accumulated.

bool Assets.SQLINQ.SQLite.Net.SQLiteConnection.IsInTransaction
get

Whether BeginTransaction has been called and the database is waiting for a Commit.

IEnumerable<TableMapping> Assets.SQLINQ.SQLite.Net.SQLiteConnection.TableMappings
get

Returns the mappings from types to tables that the connection currently understands.