SQLiteDatabase
Class SQLiteDatabase (inherits from
Database)
| Property | Description
|
| AutoCommit As Boolean | Specifies whether an implicit Commit will occur after every SQL statement (INSERT, UPDATE). Setting this to true will ensure you don't lose any data, but it could significantly slow down your application. It is a far better idea to use transactions (refer to the example below).
|
| DatabaseFile As FolderItem | Specifies the file that contains (or will contain) the SQLite database
|
| EncryptionKey As String | Specifies the password needed to connect to an encrypted database. This must be set before calling Connect().
|
| ShortColumnNames As Boolean | When False, the table name will prefix the column name in RecordSets (e.g. People.Name). When True, only the column name will be used (e.g. Name)
|
| Method Prototype | Description
|
| Function AttachDatabase( file As FolderItem, dbName As String, p As String = "") As Boolean | Allows you to attach another SQLite database file to the existing database connection.
|
| Function CreateDataBaseFile() As Boolean | Creates a new SQLite database. Returns True if the database was successfully created, False if it was not.
|
| Sub Decrypt() | Decrypts the connected database
|
| Sub DetachDatabase( dbName As String ) | Disconnects a database file that was Attached to the current database connection
|
| Sub Encrypt( password As String ) | Encrypts the database using the specified password
|
| Function LastRowID() As Integer | Returns the ID of the last auto-generated key that was added to a table. This is useful after an INSERT command to get the ID of the row that was just added to the database.
|
Example:
myDB.SQLExecute("BEGIN TRANSACTION")
For i As Integer = 0 To 100
myDB.SQLExecute("INSERT INTO myTable (Name) VALUES 'Bob'")
Next
myDB.Commit
Dim myDB As New SQLiteDatabase
myDB.DatabaseFile = GetFolderItem("test.sqlite")
If Not myDB.Connect Then
Print "Error connect to database!"
End If