Rebornbuddy
Loading...
Searching...
No Matches
SQLite.SQLiteConnection Class Reference

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

Inheritance diagram for SQLite.SQLiteConnection:
ff14bot.Managers.Database

Classes

class  ColumnInfo

Public Member Functions

 SQLiteConnection (string databasePath, bool storeDateTimeAsTicks=false)
 Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath.
 SQLiteConnection (string databasePath, SQLiteOpenFlags openFlags, bool storeDateTimeAsTicks=false)
 Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath.
void EnableLoadExtension (int onoff)
TableMapping GetMapping (Type type, CreateFlags createFlags=CreateFlags.None)
 Retrieves the mapping that is automatically generated for the given type.
TableMapping GetMapping< T > ()
 Retrieves the mapping that is automatically generated for the given type.
int DropTable< T > ()
 Executes a "drop table" on the database. This is non-recoverable.
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.
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.
int CreateIndex (string indexName, string tableName, string[] columnNames, bool unique=false)
 Creates an index for the specified table and columns.
int CreateIndex (string indexName, string tableName, string columnName, bool unique=false)
 Creates an index for the specified table and column.
int CreateIndex (string tableName, string columnName, bool unique=false)
 Creates an index for the specified table and column.
int CreateIndex (string tableName, string[] columnNames, bool unique=false)
 Creates an index for the specified table and columns.
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);.
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.
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.
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.
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.
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.
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.
TableQuery< T > Table< T > ()
 Returns a queryable interface to the table represented by the given type.
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).
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.
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).
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).
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.
void BeginTransaction ()
 Begins a new transaction. Call Commit to end the transaction.
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.
void Rollback ()
 Rolls back the transaction that was begun by BeginTransaction or SaveTransactionPoint.
void RollbackTo (string savepoint)
 Rolls back the savepoint created by BeginTransaction or SaveTransactionPoint.
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.
void Commit ()
 Commits the transaction that was begun by BeginTransaction.
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.

int InsertAll (System.Collections.IEnumerable objects)
 Inserts all specified objects.
int InsertAll (System.Collections.IEnumerable objects, string extra)
 Inserts all specified objects.
int InsertAll (System.Collections.IEnumerable objects, Type objType)
 Inserts all specified objects.
int Insert (object obj)
 Inserts the given object and retrieves its auto incremented primary key if it has one.
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.
int Insert (object obj, Type objType)
 Inserts the given object and retrieves its auto incremented primary key if it has one.
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.
int Insert (object obj, string extra)
 Inserts the given object and retrieves its auto incremented primary key if it has one.
int Insert (object obj, string extra, Type objType)
 Inserts the given object and retrieves its auto incremented primary key if it has one.
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.
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.
int UpdateAll (System.Collections.IEnumerable objects)
 Updates all specified objects.
int Delete (object objectToDelete)
 Deletes the given object from the database using its primary key.
int Delete< T > (object primaryKey)
 Deletes the object with the specified primary key.
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?
void Dispose ()
void Close ()

Protected Member Functions

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

Properties

Sqlite3DatabaseHandle 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.
IEnumerable< TableMappingTableMappings [get]
 Returns the mappings from types to tables that the connection currently understands.
bool IsInTransaction [get]
 Whether BeginTransaction has been called and the database is waiting for a Commit.

Events

EventHandler< NotifyTableChangedEventArgsTableChanged

Detailed Description

Represents an open connection to a SQLite database.

Constructor & Destructor Documentation

◆ SQLiteConnection() [1/2]

SQLite.SQLiteConnection.SQLiteConnection ( string databasePath,
bool storeDateTimeAsTicks = false )

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 default of false is only here for backwards compatibility. There is a significant speed advantage, with no down sides, when setting storeDateTimeAsTicks = true.

◆ SQLiteConnection() [2/2]

SQLite.SQLiteConnection.SQLiteConnection ( string databasePath,
SQLiteOpenFlags openFlags,
bool storeDateTimeAsTicks = false )

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 default of false is only here for backwards compatibility. There is a significant speed advantage, with no down sides, when setting storeDateTimeAsTicks = true.

Member Function Documentation

◆ BeginTransaction()

void SQLite.SQLiteConnection.BeginTransaction ( )

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

Throws if a transaction has already begun.

◆ Close()

void SQLite.SQLiteConnection.Close ( )

◆ Commit()

void SQLite.SQLiteConnection.Commit ( )

Commits the transaction that was begun by BeginTransaction.

◆ CreateCommand()

SQLiteCommand SQLite.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

◆ CreateIndex() [1/4]

int SQLite.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

◆ CreateIndex() [2/4]

int SQLite.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

◆ CreateIndex() [3/4]

int SQLite.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

◆ CreateIndex() [4/4]

int SQLite.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

◆ CreateIndex< T >()

void SQLite.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

◆ CreateTable()

int SQLite.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.

◆ CreateTable< T >()

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.

◆ DeferredQuery()

IEnumerable< object > SQLite.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.

◆ DeferredQuery< T >()

IEnumerable< T > SQLite.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() 

◆ Delete()

int SQLite.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.

◆ Delete< T >()

int SQLite.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.

◆ DeleteAll< T >()

int SQLite.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.

◆ Dispose() [1/2]

void SQLite.SQLiteConnection.Dispose ( )

◆ Dispose() [2/2]

virtual void SQLite.SQLiteConnection.Dispose ( bool disposing)
protectedvirtual

◆ DropTable< T >()

int SQLite.SQLiteConnection.DropTable< T > ( )

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

◆ EnableLoadExtension()

void SQLite.SQLiteConnection.EnableLoadExtension ( int onoff)

◆ Execute()

int SQLite.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.

◆ ExecuteScalar< T >()

T SQLite.SQLiteConnection.ExecuteScalar< T > ( string query,
params object[] args )

◆ Find()

object SQLite.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.

◆ Find< T >() [1/2]

T SQLite.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() 

◆ Find< T >() [2/2]

T SQLite.SQLiteConnection.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).

Parameters
pkThe primary key.
Returns
The object with the given primary key or null if the object is not found.
Type Constraints
T :new() 

◆ Get< T >() [1/2]

T SQLite.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() 

◆ Get< T >() [2/2]

T SQLite.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() 

◆ GetMapping()

TableMapping SQLite.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.


Parameters
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.

◆ GetMapping< T >()

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.

◆ GetTableInfo()

List< ColumnInfo > SQLite.SQLiteConnection.GetTableInfo ( string tableName)

◆ Insert() [1/4]

int SQLite.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.

◆ Insert() [2/4]

int SQLite.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.

◆ Insert() [3/4]

int SQLite.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.

◆ Insert() [4/4]

int SQLite.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.

◆ InsertAll() [1/3]

int SQLite.SQLiteConnection.InsertAll ( System.Collections.IEnumerable objects)

Inserts all specified objects.

Parameters
objectsAn System.Collections.IEnumerable of the objects to insert.
Returns
The number of rows added to the table.

◆ InsertAll() [2/3]

int SQLite.SQLiteConnection.InsertAll ( System.Collections.IEnumerable objects,
string extra )

Inserts all specified objects.

Parameters
objectsAn System.Collections.IEnumerable of the objects to insert.
extraLiteral SQL code that gets placed into the command. INSERT {extra} INTO ...
Returns
The number of rows added to the table.

◆ InsertAll() [3/3]

int SQLite.SQLiteConnection.InsertAll ( System.Collections.IEnumerable objects,
Type objType )

Inserts all specified objects.

Parameters
objectsAn System.Collections.IEnumerable of the objects to insert.
objTypeThe type of object to insert.
Returns
The number of rows added to the table.

◆ InsertOrReplace() [1/2]

int SQLite.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.

◆ InsertOrReplace() [2/2]

int SQLite.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.

◆ NewCommand()

virtual SQLiteCommand SQLite.SQLiteConnection.NewCommand ( )
protectedvirtual

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

See also
SQLiteCommand.OnInstanceCreated

◆ Query()

List< object > SQLite.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.

◆ Query< T >()

List< T > SQLite.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() 

◆ Release()

void SQLite.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

◆ Rollback()

void SQLite.SQLiteConnection.Rollback ( )

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

◆ RollbackTo()

void SQLite.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

◆ RunInTransaction()

void SQLite.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.

◆ SaveTransactionPoint()

string SQLite.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.

◆ Table< T >()

TableQuery< T > SQLite.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() 

◆ Update() [1/2]

int SQLite.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.

◆ Update() [2/2]

int SQLite.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.

◆ UpdateAll()

int SQLite.SQLiteConnection.UpdateAll ( System.Collections.IEnumerable objects)

Updates all specified objects.

Parameters
objectsAn System.Collections.IEnumerable of the objects to insert.
Returns
The number of rows modified.

Property Documentation

◆ BusyTimeout

TimeSpan SQLite.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.

◆ DatabasePath

string SQLite.SQLiteConnection.DatabasePath
get

◆ Handle

Sqlite3DatabaseHandle SQLite.SQLiteConnection.Handle
get

◆ IsInTransaction

bool SQLite.SQLiteConnection.IsInTransaction
get

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

◆ StoreDateTimeAsTicks

bool SQLite.SQLiteConnection.StoreDateTimeAsTicks
get

◆ TableMappings

IEnumerable<TableMapping> SQLite.SQLiteConnection.TableMappings
get

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

◆ TimeExecution

bool SQLite.SQLiteConnection.TimeExecution
getset

◆ Trace

bool SQLite.SQLiteConnection.Trace
getset

Event Documentation

◆ TableChanged

EventHandler<NotifyTableChangedEventArgs> SQLite.SQLiteConnection.TableChanged