SQL - Extended  1.0.0
Pi-Con: Small utilities makes the difference
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
SQLite.SQLiteConnection Class Reference

The basic SQLiteConnection class from SQLite-Net, with added code. More...

Inheritance diagram for SQLite.SQLiteConnection:
SQLite.SQLiteConnectionWithLock

Classes

class  ColumnInfo
 Column information on the connection to determine the migration option(s) More...
 
class  ManyToManyRefColumns
 Data structure for the Many to Many Reference Table this class is used to make columns with different types. More...
 

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...
 
 SQLiteConnection (SQLiteConnectionString connectionString)
 Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath. More...
 
void EnableWriteAheadLogging ()
 Enables the write ahead logging. WAL is significantly faster in most scenarios by providing better concurrency and better disk IO performance than the normal jounral mode. You only need to call this function once in the lifetime of the database. More...
 
void EnableLoadExtension (bool enabled)
 Enable or disable extension loading. More...
 
void ResetAllValues ()
 Reset all the values of the columns rows Added for the foreignKey / multiple records editing More...
 
TableMapping GetMapping (Type type, CreateFlags createFlags=CreateFlags.None, object obj=null, SQLiteConnection conn=null)
 Retrieves the mapping that is automatically generated for the given type. Modified by Pi-Con More...
 
TableMapping GetMapping< T > (CreateFlags createFlags=CreateFlags.None)
 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 DropTable (TableMapping map)
 Executes a "drop table" on the database. This is non-recoverable. More...
 
CreateTableResult 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...
 
CreateTableResult 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...
 
CreateTablesResult CreateTables< T, T2 > (CreateFlags createFlags=CreateFlags.None)
 Executes a "create table if not exists" on the database for each type. 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...
 
CreateTablesResult CreateTables< T, T2, T3 > (CreateFlags createFlags=CreateFlags.None)
 Executes a "create table if not exists" on the database for each type. 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...
 
CreateTablesResult CreateTables< T, T2, T3, T4 > (CreateFlags createFlags=CreateFlags.None)
 Executes a "create table if not exists" on the database for each type. 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...
 
CreateTablesResult CreateTables< T, T2, T3, T4, T5 > (CreateFlags createFlags=CreateFlags.None)
 Executes a "create table if not exists" on the database for each type. 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...
 
CreateTablesResult CreateTables (CreateFlags createFlags=CreateFlags.None, params Type[] types)
 Executes a "create table if not exists" on the database for each type. 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...
 
int 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)
 Query the built-in sqlite table_info table for a specific tables columns. More...
 
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...
 
void SetForeignKeysPragma (bool setOn=false)
 Set the PRAGAMA foreignkeys, be aware that this can lead into unrequested errors on the database especially with FK's that are null or not avalible, See the SQLite-Net doumentation for more details More...
 
List< Object > LookForObject (Object obj, ManyToManyStructure mtm)
 Look for all objects (cloumns) we need for the Many to Many Foreign Key operations Function is "almost" indidentical to the function in TableMapping. Function is recursive to get also the related objects. More...
 
int WriteManyToManyRefTable (object obj)
 Write - Insert into the reference table(s) of the Many to Many relation(s) in the database from one object. Can be more than one table More...
 
int WriteManyToManyRefTable (object obj, ManyToManyStructure mtm)
 Write - Insert into the reference table of the Many to Many relation in the database from one object. Only one table, one Many To Many More...
 
int WriteManyToManyRefTable (object obj, Type objType, ManyToManyStructure mtm)
 Write - Insert into the reference table of the Many to Many relation in the database from one object. Only one table, one Many To Many More...
 
int CleanManyToManyRefTable (Type type)
 Remove the orphant entries in the reference table of the Many To Many realtion. That means it will loop through all entires in the left table and Compare this with the entries in de Left - Foreign Key assigned column of the reference table The entries in the reference table without a link (value) in the left table will be removed. preform the same on the Right table. More...
 
int CleanManyToManyRefTable (ManyToManyStructure mtm)
 Remove the orphant entries in the reference table of the Many To Many realtion. That means it will loop through all entires in the left table and Compare this with the entries in de Left - Foreign Key assigned column of the reference table The entries in the reference table without a link (value) in the left table will be removed. preform the same on the Right table. More...
 
List< T > QueryFk< T > (string queyrstring)
 A Query of a SQL command, method is needed for the QueryTableMapFk method Query as defined SQLConnction basic script wil result is a error: ambigious function. More...
 
List< T > TableManyToMany< T > (bool isRecursive=false)
 Get ALL the Many To Many data from the database with the specified type, only the fields marked as Many To Many will be addressed The marking is done by the method CheckManyToMany CheckManyToMany
More...
 
List< T > TablesManyToMany< T > (Expression< Func< T, bool >> predicate, bool isRecursive=false)
 Get the Many To Many data from the database with the specified type, only the fields marked as Many To Many will be addressed The marking is done by the method CheckManyToMany CheckManyToMany The expression is to limit the top table (Left Table). More...
 
List< T > ManyToMany< T > (List< T > baseRecords, bool isRecursive=false)
 Get the Many To Many data from the database with the specified type, for the records as specified More...
 
List< T > QueryMtM< T > (string query, params object[] args)
 A Query of a SQL command, method is needed for the ManyToMany method Query as defined SQLConnction basic script wil result is a error: ambigious function. More...
 
Type RelatedManyData< T > (Object currentObject, bool isRecursive)
 Get the related ManytoMany data for specified object, And the related data recursive if option is set. More...
 
List< ManyToManyStructureCheckManyToMany< T > ()
 Check if there are Many to Many relations on the specified table, Left Table see the Demo for principe the structure of the Many to Many, Team (Left) - TeamMatch (Right) and TeamToTeamMatch Middle ) More...
 
List< ManyToManyStructureCheckManyToMany (Type typeLeftTable)
 Check if there are Many to Many relations on the specified table, Left Table see the Demo for principe the structure of the Many to Many, Team (Left) - TeamMatch (Right) and TeamToTeamMatch Middle ) More...
 
List< T > TableOneToMany< T > (bool isRecursive=false)
 Get ALL the One To Many data and the other columns from the database with the specified type, if the option isReciursive is true it will get All data specified in table scheme for the specified type, database table More...
 
List< T > TableOneToMany< T > (Expression< Func< T, bool >> predicate, bool isRecursive=false)
 Get ALL the One To Many data and the other columns from the database with the specified type, if the option isReciursive is true it will get All data specified in table scheme for the specified type, database table More...
 
List< T > TableAllToMany< T > (bool isRecursive=false)
 Get ALL the All To Many data and the other columns from the database with the specified type, if the option isReciursive is true it will get All data specified in table scheme for the specified type, database table More...
 
List< T > TableAllToMany< T > (Expression< Func< T, bool >> predicate, bool isRecursive=false)
 Get ALL the All To Many data and the other columns from the database with the specified type, if the option isReciursive is true it will get All data specified in table scheme for the specified type, database table More...
 
List< T > TableAllToMany< T > (Expression< Func< T, bool >> predicate, bool isRecursive=true, bool fetchManyToMany=true)
 Get ALL the data and the other columns from the database with the specified type, if the option isReciursive and fetchManyToMany is true (default) it will get All data specified in table scheme for the specified type, database table More...
 
List< T > AllToMany< T > (List< T > baseRecords, bool isRecursive, bool fetchManyToMany)
 Get ALL the data and the other columns from the database with the specified type, if the option isReciursive and fetchManyToMany is true (default) it will get All data specified in table scheme for the specified type, database table More...
 
List< T > RelatedData< T > (Object currentObject)
 Get all teh related data from the specified type with the foreignkeys as defined in the database scheme A FkReference / Foereign Key: Table: Team type: TableType Column: ClubId string: ColumnName Attribute: [ForeignKey(Club, "Id")] type: FkTableType, string: FkColumnName To get the related data we construct a predicate, that will be used to narrow down the realted data RelatedData<T>(Expression<Func<T, bool>> pred = null) RelatedData<Team>(x => x.ClubId = 1123) More...
 
Expression< Func< T, bool > > MakePredicate< T > (string columnName, Object parentIdObj)
 Construct a predicate to specify the fetched data Specieied type: T = Team (team => team.ClubId == 1123) – 1123 is IdC.value of the object - Club. More...
 
int UpSertAll (IEnumerable objects, bool runInTransaction=true, bool resetValues=true, bool manyToManyClean=false)
 Inserts or Updates (UpSert) the given objects The lib version should be at least 3.24.00 We reset all the temporary values of the object. The return value is the number of rows added/updated to the tables. More...
 
int UpSert (object obj)
 Inserts or Updates (UpSert) the given object The lib version should be at least 3.24.00 We reset all the temporary values of the object. The return value is the number of rows added/updated to the table. More...
 
int UpSert (object obj, Type objType, bool resetValues=true, bool manyToManyClean=false)
 Inserts or Update (UpSert) the given object The lib version should be at least 3.24.00 We reset all the temporary values of the object. The return value is the number of rows added/updated to the table. More...
 

Public Attributes

Dictionary< string, object > PksLastUsed = new Dictionary<string, object>()
 Primary key last used in the TableMapping for automatic update of the related tables – the List<T> or T[] in the objects More...
 
List< FKReferenceForeignKeys = new List<FKReference>()
 A list of the Foreign Keys used by the current objects More...
 
bool PragmaForeignKeys = true
 Bool value for updating / resets of the foreign key PRAGMA in the database More...
 
List< string > TableOrder = new List<string>()
 The order of the tables we need to follow, otherwise some upserts /inserts /updates gives a error when the PRAGMA foreign keys is true, structure example: Club, Team, TeamPlayers More...
 

Protected Member Functions

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

Properties

Sqlite3DatabaseHandle Handle [get]
 The handle to the Connection of the SQL-Net 3 More...
 
string DatabasePath [get]
 Gets the database path used by this connection. More...
 
int LibVersionNumber [get]
 Gets the SQLite library version number. 3007014 would be v3.7.14 More...
 
bool TimeExecution [get, set]
 Whether Trace lines should be written that show the execution time of queries. More...
 
bool Trace [get, set]
 Whether to writer queries to Tracer during execution. More...
 
Action< string > Tracer [get, set]
 The delegate responsible for writing trace lines. More...
 
bool StoreDateTimeAsTicks [get]
 Whether to store DateTime properties as ticks (true) or strings (false). More...
 
bool StoreTimeSpanAsTicks [get]
 Whether to store TimeSpan properties as ticks (true) or strings (false). More...
 
string DateTimeStringFormat [get]
 The format to use when storing DateTime properties as strings. Ignored if StoreDateTimeAsTicks is true. More...
 
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...
 

:name and $name can all be used in the query.

Creates a new SQLiteCommand given the command text with named arguments. Place a "[@:$]VVV" in the command text for each of the arguments. VVV represents an alphanumeric identifier. For example,

Parameters
cmdTextThe fully escaped SQL.
argsArguments to substitute for the occurences of "[@:$]VVV" in the command text.
Returns
A SQLiteCommand
bool IsInTransaction [get]
 Whether BeginTransaction has been called and the database is waiting for a Commit. More...
 
EventHandler< NotifyTableChangedEventArgsTableChanged
 Handler for the Event - Notification More...
 
SQLiteCommand CreateCommand (string cmdText, Dictionary< string, object > args)
 
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)
 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 when return primitive values. You can set the Trace or TimeExecution properties of the connection to profile execution. More...
 
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...
 
List< T > QueryScalars< 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 the first column of each row of the result. 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...
 
object Get (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...
 
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...
 
object FindWithQuery (TableMapping map, 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 action within 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 updates its auto incremented primary key if it has one). The return value is the number of rows added to the table. More...
 
int InsertOrReplace (object obj)
 Inserts the given object (and updates its auto incremented primary key if it has one). The return value is the number of rows added to the table. 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 updates its auto incremented primary key if it has one). The return value is the number of rows added to the table. More...
 
int InsertOrReplace (object obj, Type objType)
 Inserts the given object (and updates its auto incremented primary key if it has one). The return value is the number of rows added to the table. 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 updates its auto incremented primary key if it has one). The return value is the number of rows added to the table. More...
 
int Insert (object obj, string extra, Type objType)
 Inserts the given object (and updates its auto incremented primary key if it has one). The return value is the number of rows added to the table. 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 the columns of the object in 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 Delete (object primaryKey, TableMapping map)
 Deletes the object with the specified primary key. More...
 
int Delete< T > (Expression< Func< T, bool >> predicate)
 Deletes the found objects from the specified table. according the predicate. 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...
 
int DeleteAll (TableMapping map)
 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 Backup (string destinationDatabasePath, string databaseName="main")
 Backup the entire database to the specified path. More...
 
void Dispose ()
 Dispose the connection More...
 
void Close ()
 Close action to dispose the connection More...
 
virtual void Dispose (bool disposing)
 Close action to dispose the connection More...
 

Detailed Description

The basic SQLiteConnection class from SQLite-Net, with added code.

Extended Code for the UpSert method(s).

Extended Code for the One To Many method(s).

Extended Code for the Many To Many method(s).

Utilties and properties we use voor the SQL-Extended methods: Write Functions:

Read functions:

Constructor & Destructor Documentation

◆ SQLiteConnection() [1/3]

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

◆ SQLiteConnection() [2/3]

SQLite.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.
openFlagsFlags controlling how the connection should be opened.
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.

◆ SQLiteConnection() [3/3]

SQLite.SQLiteConnection.SQLiteConnection ( SQLiteConnectionString  connectionString)

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

Parameters
connectionStringDetails on how to find and open the database.

Member Function Documentation

◆ AllToMany< T >()

List<T> SQLite.SQLiteConnection.AllToMany< T > ( List< T >  baseRecords,
bool  isRecursive,
bool  fetchManyToMany 
)

Get ALL the data and the other columns from the database with the specified type, if the option isReciursive and fetchManyToMany is true (default) it will get All data specified in table scheme for the specified type, database table

Parameters
baseRecords

An enumerable (List) of the records to fetch

Parameters
isRecursive

If set (true) the related data on the table is fetched recursive,

Parameters
fetchManyToMany

If set the get all data from the object, Columns, One To Many and Many To Many data

Template Parameters
T
Returns
An enumerable (List) with the results for each row returned
Type Constraints
T :new() 

◆ Backup()

void SQLite.SQLiteConnection.Backup ( string  destinationDatabasePath,
string  databaseName = "main" 
)

Backup the entire database to the specified path.

Parameters
destinationDatabasePathPath to backup file.
databaseNameThe name of the database to backup (usually "main").

◆ BeginTransaction()

void SQLite.SQLiteConnection.BeginTransaction ( )

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

Throws if a transaction has already begun.

◆ CheckManyToMany()

List<ManyToManyStructure> SQLite.SQLiteConnection.CheckManyToMany ( Type  typeLeftTable)

Check if there are Many to Many relations on the specified table, Left Table see the Demo for principe the structure of the Many to Many, Team (Left) - TeamMatch (Right) and TeamToTeamMatch Middle )

Parameters
typeLeftTable

the specied type, table of the Database.

Returns
An enumerable (List) with the the ManyToMany Foreign Keys of the specifeied type

◆ CheckManyToMany< T >()

Check if there are Many to Many relations on the specified table, Left Table see the Demo for principe the structure of the Many to Many, Team (Left) - TeamMatch (Right) and TeamToTeamMatch Middle )

Template Parameters
T

the specied type, table of the Database.

Returns
An enumerable (List) with the the ManyToMany Foreign Keys of the specifeied type

◆ CleanManyToManyRefTable() [1/2]

int SQLite.SQLiteConnection.CleanManyToManyRefTable ( ManyToManyStructure  mtm)

Remove the orphant entries in the reference table of the Many To Many realtion. That means it will loop through all entires in the left table and Compare this with the entries in de Left - Foreign Key assigned column of the reference table The entries in the reference table without a link (value) in the left table will be removed. preform the same on the Right table.

Parameters
mtm
Returns
rowsAffected

◆ CleanManyToManyRefTable() [2/2]

int SQLite.SQLiteConnection.CleanManyToManyRefTable ( Type  type)

Remove the orphant entries in the reference table of the Many To Many realtion. That means it will loop through all entires in the left table and Compare this with the entries in de Left - Foreign Key assigned column of the reference table The entries in the reference table without a link (value) in the left table will be removed. preform the same on the Right table.

Parameters
type
Returns

◆ Close()

void SQLite.SQLiteConnection.Close ( )

Close action to dispose the connection

◆ 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.
psArguments 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 >()

int 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()

CreateTableResult 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
Whether the table was created or migrated (enum).

◆ 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
Whether the table was created or migrated.

◆ CreateTables()

CreateTablesResult SQLite.SQLiteConnection.CreateTables ( CreateFlags  createFlags = CreateFlags.None,
params Type[]  types 
)

Executes a "create table if not exists" on the database for each type. 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
Whether the table was created or migrated for each type.

◆ CreateTables< T, T2 >()

Executes a "create table if not exists" on the database for each type. 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
Whether the table was created or migrated for each type.
Type Constraints
T :new() 
T2 :new() 

◆ CreateTables< T, T2, T3 >()

Executes a "create table if not exists" on the database for each type. 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
Whether the table was created or migrated for each type.
Type Constraints
T :new() 
T2 :new() 
T3 :new() 

◆ CreateTables< T, T2, T3, T4 >()

Executes a "create table if not exists" on the database for each type. 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
Whether the table was created or migrated for each type.
Type Constraints
T :new() 
T2 :new() 
T3 :new() 
T4 :new() 

◆ CreateTables< T, T2, T3, T4, T5 >()

Executes a "create table if not exists" on the database for each type. 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
Whether the table was created or migrated for each type.
Type Constraints
T :new() 
T2 :new() 
T3 :new() 
T4 :new() 
T5 :new() 

◆ 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 (retrieved by calling GetEnumerator() on the result of this method) 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 (retrieved by calling GetEnumerator() on the result of this method) 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() [1/2]

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() [2/2]

int SQLite.SQLiteConnection.Delete ( object  primaryKey,
TableMapping  map 
)

Deletes the object with the specified primary key.

Parameters
primaryKeyThe primary key of the object to delete.
mapThe TableMapping used to identify the table.
Returns
The number of objects deleted.

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

int SQLite.SQLiteConnection.Delete< T > ( Expression< Func< T, bool >>  predicate)

Deletes the found objects from the specified table. according the predicate.

Template Parameters
T
Parameters
predicate
Returns
The number of objects deleted.
Type Constraints
T :new() 

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

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

int SQLite.SQLiteConnection.DeleteAll ( TableMapping  map)

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?

Parameters
mapThe TableMapping used to identify the table.
Returns
The number of objects deleted.

◆ 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 the connection

◆ Dispose() [2/2]

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

Close action to dispose the connection

◆ DropTable()

int SQLite.SQLiteConnection.DropTable ( TableMapping  map)

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

Parameters
mapThe TableMapping used to identify the table.

◆ DropTable< T >()

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

◆ EnableLoadExtension()

void SQLite.SQLiteConnection.EnableLoadExtension ( bool  enabled)

Enable or disable extension loading.

◆ EnableWriteAheadLogging()

void SQLite.SQLiteConnection.EnableWriteAheadLogging ( )

Enables the write ahead logging. WAL is significantly faster in most scenarios by providing better concurrency and better disk IO performance than the normal jounral mode. You only need to call this function once in the lifetime of the database.

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

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 when return primitive values. 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.

◆ 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 table.
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() 

◆ FindWithQuery()

object SQLite.SQLiteConnection.FindWithQuery ( TableMapping  map,
string  query,
params object[]  args 
)

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

Parameters
mapThe TableMapping used to identify the table.
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.

◆ FindWithQuery< T >()

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

◆ Get()

object SQLite.SQLiteConnection.Get ( 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 table.
Returns
The object with the given primary key. Throws a not found exception if the object is not found.

◆ 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,
object  obj = null,
SQLiteConnection  conn = null 
)

Retrieves the mapping that is automatically generated for the given type. Modified by Pi-Con

Parameters
typeThe type whose mapping to the database is returned.
createFlagsOptional flags allowing implicit PK and indexes based on naming conventions
obj
conn
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.

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.

◆ GetTableInfo()

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

Query the built-in sqlite table_info table for a specific tables columns.

Returns
The columns contains in the table.
Parameters
tableNameTable name.

◆ Insert() [1/4]

int SQLite.SQLiteConnection.Insert ( object  obj)

Inserts the given object (and updates its auto incremented primary key if it has one). The return value is the number of rows added to the table.

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 updates its auto incremented primary key if it has one). The return value is the number of rows added to the table.

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 updates its auto incremented primary key if it has one). The return value is the number of rows added to the table.

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 updates its auto incremented primary key if it has one). The return value is the number of rows added to the table.

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,
bool  runInTransaction = true 
)

Inserts 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 added to the table.

◆ InsertAll() [2/3]

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

◆ InsertAll() [3/3]

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

◆ InsertOrReplace() [1/2]

int SQLite.SQLiteConnection.InsertOrReplace ( object  obj)

Inserts the given object (and updates its auto incremented primary key if it has one). The return value is the number of rows added to the table. 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 updates its auto incremented primary key if it has one). The return value is the number of rows added to the table. 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.

◆ LookForObject()

List<Object> SQLite.SQLiteConnection.LookForObject ( Object  obj,
ManyToManyStructure  mtm 
)

Look for all objects (cloumns) we need for the Many to Many Foreign Key operations Function is "almost" indidentical to the function in TableMapping. Function is recursive to get also the related objects.

Parameters
obj
mtm
Returns

◆ MakePredicate< T >()

Expression<Func<T, bool> > SQLite.SQLiteConnection.MakePredicate< T > ( string  columnName,
Object  parentIdObj 
)

Construct a predicate to specify the fetched data Specieied type: T = Team (team => team.ClubId == 1123) – 1123 is IdC.value of the object - Club.

Parameters
columnName

Name of the Foreign Key Column

Parameters
parentIdObj

Objjct with data for the Id - column to fetch.

Template Parameters
T

The specified type

Returns
the constructed predicate function, (x => x.ClubId == 1123)

◆ ManyToMany< T >()

List<T> SQLite.SQLiteConnection.ManyToMany< T > ( List< T >  baseRecords,
bool  isRecursive = false 
)

Get the Many To Many data from the database with the specified type, for the records as specified

Parameters
baseRecords

The records of the top table we proces.

Parameters
isRecursive

Fetch also the related data (recursive) if option is set.

Template Parameters
T

the specied type, table of the Database.

Returns
An enumerable (List) with the results for each row returned
Type Constraints
T :new() 

◆ 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() 

◆ QueryFk< T >()

List<T> SQLite.SQLiteConnection.QueryFk< T > ( string  queyrstring)

A Query of a SQL command, method is needed for the QueryTableMapFk method Query as defined SQLConnction basic script wil result is a error: ambigious function.

Parameters
queyrstring

SQL string we proces

Template Parameters
T

Type of the object

Returns
Type Constraints
T :new() 

◆ QueryMtM< T >()

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

A Query of a SQL command, method is needed for the ManyToMany method Query as defined SQLConnction basic script wil result is a error: ambigious function.

Parameters
queryThe fully escaped SQL.
argsArguments to substitute for the occurences of '?' in the query.
Template Parameters
T

the specied type, table of the Database.

Returns
An enumerable (List) with the results for each row returned
Type Constraints
T :new() 

◆ QueryScalars< T >()

List<T> SQLite.SQLiteConnection.QueryScalars< 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 the first column of each row of the result.

Parameters
queryThe fully escaped SQL.
argsArguments to substitute for the occurences of '?' in the query.
Returns
An enumerable with one result for the first column of each row returned by the query.

◆ RelatedData< T >()

List<T> SQLite.SQLiteConnection.RelatedData< T > ( Object  currentObject)

Get all teh related data from the specified type with the foreignkeys as defined in the database scheme A FkReference / Foereign Key: Table: Team type: TableType Column: ClubId string: ColumnName Attribute: [ForeignKey(Club, "Id")] type: FkTableType, string: FkColumnName To get the related data we construct a predicate, that will be used to narrow down the realted data RelatedData<T>(Expression<Func<T, bool>> pred = null) RelatedData<Team>(x => x.ClubId = 1123)

Parameters
currentObject

the specified object to fill with the data

Template Parameters
T

The specified type

Returns
An enumerable (List) with the results for one row (object) returned /returns>
Type Constraints
T :new() 

◆ RelatedManyData< T >()

Type SQLite.SQLiteConnection.RelatedManyData< T > ( Object  currentObject,
bool  isRecursive 
)

Get the related ManytoMany data for specified object, And the related data recursive if option is set.

Parameters
currentObjectThe object we have to process
isRecursiveif true it will find also the right table related data recursive
Template Parameters
T
Returns
return the processed type for the recursive operations
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

◆ ResetAllValues()

void SQLite.SQLiteConnection.ResetAllValues ( )

Reset all the values of the columns rows Added for the foreignKey / multiple records editing

◆ 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 action within 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. action can 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(string) 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.

◆ SetForeignKeysPragma()

void SQLite.SQLiteConnection.SetForeignKeysPragma ( bool  setOn = false)

Set the PRAGAMA foreignkeys, be aware that this can lead into unrequested errors on the database especially with FK's that are null or not avalible, See the SQLite-Net doumentation for more details

Parameters
setOn

◆ 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() 

◆ TableAllToMany< T >() [1/3]

List<T> SQLite.SQLiteConnection.TableAllToMany< T > ( bool  isRecursive = false)

Get ALL the All To Many data and the other columns from the database with the specified type, if the option isReciursive is true it will get All data specified in table scheme for the specified type, database table

Parameters
isRecursive

If set (true) the related data on the table is fetched recursive

Template Parameters
T
Returns
An enumerable (List) with the results for each row returned
Type Constraints
T :new() 

◆ TableAllToMany< T >() [2/3]

List<T> SQLite.SQLiteConnection.TableAllToMany< T > ( Expression< Func< T, bool >>  predicate,
bool  isRecursive = false 
)

Get ALL the All To Many data and the other columns from the database with the specified type, if the option isReciursive is true it will get All data specified in table scheme for the specified type, database table

Parameters
predicate

A predicate for which object to find, or null for all records

Parameters
isRecursive

If set (true) the related data on the table is fetched recursive

Template Parameters
T
Returns
An enumerable (List) with the results for each row returned
Type Constraints
T :new() 

◆ TableAllToMany< T >() [3/3]

List<T> SQLite.SQLiteConnection.TableAllToMany< T > ( Expression< Func< T, bool >>  predicate,
bool  isRecursive = true,
bool  fetchManyToMany = true 
)

Get ALL the data and the other columns from the database with the specified type, if the option isReciursive and fetchManyToMany is true (default) it will get All data specified in table scheme for the specified type, database table

Parameters
predicate

A predicate for which object to find, or null for all records

Parameters
isRecursive

If set (true) the related data on the table is fetched recursive,

Parameters
fetchManyToMany

If set the get all data from the object, Columns, One To Many and Many To Many data

Template Parameters
T
Returns
An enumerable (List) with the results for each row returned
Type Constraints
T :new() 

◆ TableManyToMany< T >()

List<T> SQLite.SQLiteConnection.TableManyToMany< T > ( bool  isRecursive = false)

Get ALL the Many To Many data from the database with the specified type, only the fields marked as Many To Many will be addressed The marking is done by the method CheckManyToMany CheckManyToMany

Parameters
isRecursiveIf set (true) the related data on the right table is fetched recursive
Template Parameters
T
Returns
An enumerable (List) with the results for each row returned
Type Constraints
T :new() 

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

List<T> SQLite.SQLiteConnection.TableOneToMany< T > ( bool  isRecursive = false)

Get ALL the One To Many data and the other columns from the database with the specified type, if the option isReciursive is true it will get All data specified in table scheme for the specified type, database table

Parameters
isRecursive

If set (true) the related data on the table is fetched recursive

Template Parameters
T
Returns
An enumerable (List) with the results for each row returned
Type Constraints
T :new() 

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

List<T> SQLite.SQLiteConnection.TableOneToMany< T > ( Expression< Func< T, bool >>  predicate,
bool  isRecursive = false 
)

Get ALL the One To Many data and the other columns from the database with the specified type, if the option isReciursive is true it will get All data specified in table scheme for the specified type, database table

Parameters
predicate

A predicate for which object to find, or null for all records

Parameters
isRecursive

If set (true) the related data on the table is fetched recursive

Template Parameters
T
Returns
An enumerable (List) with the results for each row returned
Type Constraints
T :new() 

◆ TablesManyToMany< T >()

List<T> SQLite.SQLiteConnection.TablesManyToMany< T > ( Expression< Func< T, bool >>  predicate,
bool  isRecursive = false 
)

Get the Many To Many data from the database with the specified type, only the fields marked as Many To Many will be addressed The marking is done by the method CheckManyToMany CheckManyToMany The expression is to limit the top table (Left Table).

Parameters
predicate

A predicate for which object to find.

Parameters
isRecursiveIf set (true) the related data on the right table is fetched recursive
Template Parameters
T
Returns
An enumerable (List) with the results for each row returned
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 the columns of the object in 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,
bool  runInTransaction = true 
)

Updates all specified objects.

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

◆ UpSert() [1/2]

int SQLite.SQLiteConnection.UpSert ( object  obj)

Inserts or Updates (UpSert) the given object The lib version should be at least 3.24.00 We reset all the temporary values of the object. The return value is the number of rows added/updated to the table.

Parameters
objThe object to insert.
Returns
The number of rows upsert (insert or updated) to the table.

◆ UpSert() [2/2]

int SQLite.SQLiteConnection.UpSert ( object  obj,
Type  objType,
bool  resetValues = true,
bool  manyToManyClean = false 
)

Inserts or Update (UpSert) the given object The lib version should be at least 3.24.00 We reset all the temporary values of the object. The return value is the number of rows added/updated to the table.

Parameters
objThe object to insert.
objTypeThe type of object to insert.
resetValuesIf true we reset all the temporary values of the object.
manyToManyClean
Returns
The number of rows upsert (insert or updated) to the table.

◆ UpSertAll()

int SQLite.SQLiteConnection.UpSertAll ( IEnumerable  objects,
bool  runInTransaction = true,
bool  resetValues = true,
bool  manyToManyClean = false 
)

Inserts or Updates (UpSert) the given objects The lib version should be at least 3.24.00 We reset all the temporary values of the object. The return value is the number of rows added/updated to the tables.

Parameters
objectsAn IEnumerable of the objects to upsert.
runInTransactionA boolean indicating if the upsert should be wrapped in a transaction.
resetValuesIf true we reset all the temporary values of the object.
manyToManyClean
Returns
The number of rows that are upsert to the table.

◆ WriteManyToManyRefTable() [1/3]

int SQLite.SQLiteConnection.WriteManyToManyRefTable ( object  obj)

Write - Insert into the reference table(s) of the Many to Many relation(s) in the database from one object. Can be more than one table

Parameters
obj
Returns
rowsAffected

◆ WriteManyToManyRefTable() [2/3]

int SQLite.SQLiteConnection.WriteManyToManyRefTable ( object  obj,
ManyToManyStructure  mtm 
)

Write - Insert into the reference table of the Many to Many relation in the database from one object. Only one table, one Many To Many

Parameters
obj
mtm
Returns
rowsAffected

◆ WriteManyToManyRefTable() [3/3]

int SQLite.SQLiteConnection.WriteManyToManyRefTable ( object  obj,
Type  objType,
ManyToManyStructure  mtm 
)

Write - Insert into the reference table of the Many to Many relation in the database from one object. Only one table, one Many To Many

Parameters
obj
objType
mtm
Returns
rowsAffected

Member Data Documentation

◆ ForeignKeys

List<FKReference> SQLite.SQLiteConnection.ForeignKeys = new List<FKReference>()

A list of the Foreign Keys used by the current objects

Template Parameters
FKReference
Returns

◆ PksLastUsed

Dictionary<string, object> SQLite.SQLiteConnection.PksLastUsed = new Dictionary<string, object>()

Primary key last used in the TableMapping for automatic update of the related tables – the List<T> or T[] in the objects

Template Parameters
stringThe description of the Foreign Key as used in SQL
objectThe object of the referenced Column in the ForeignKey


◆ PragmaForeignKeys

bool SQLite.SQLiteConnection.PragmaForeignKeys = true

Bool value for updating / resets of the foreign key PRAGMA in the database

◆ TableOrder

List<string> SQLite.SQLiteConnection.TableOrder = new List<string>()

The order of the tables we need to follow, otherwise some upserts /inserts /updates gives a error when the PRAGMA foreign keys is true, structure example: Club, Team, TeamPlayers

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

Gets the database path used by this connection.

◆ DateTimeStringFormat

string SQLite.SQLiteConnection.DateTimeStringFormat
get

The format to use when storing DateTime properties as strings. Ignored if StoreDateTimeAsTicks is true.

The date time string format.

◆ Handle

Sqlite3DatabaseHandle SQLite.SQLiteConnection.Handle
get

The handle to the Connection of the SQL-Net 3

◆ IsInTransaction

bool SQLite.SQLiteConnection.IsInTransaction
get

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

◆ LibVersionNumber

int SQLite.SQLiteConnection.LibVersionNumber
get

Gets the SQLite library version number. 3007014 would be v3.7.14

◆ StoreDateTimeAsTicks

bool SQLite.SQLiteConnection.StoreDateTimeAsTicks
get

Whether to store DateTime properties as ticks (true) or strings (false).

◆ StoreTimeSpanAsTicks

bool SQLite.SQLiteConnection.StoreTimeSpanAsTicks
get

Whether to store TimeSpan properties as ticks (true) or strings (false).

◆ 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

Whether Trace lines should be written that show the execution time of queries.

◆ Trace

bool SQLite.SQLiteConnection.Trace
getset

Whether to writer queries to Tracer during execution.

The tracer.

◆ Tracer

Action<string> SQLite.SQLiteConnection.Tracer
getset

The delegate responsible for writing trace lines.

The tracer.

Event Documentation

◆ TableChanged

EventHandler<NotifyTableChangedEventArgs> SQLite.SQLiteConnection.TableChanged

Handler for the Event - Notification


The documentation for this class was generated from the following files: