REALSQLDatabase
From REALbasicWiki
[edit] Description
REALSQLDatabase is the stand alone SQLite based database that REAL provides with REALbasic.
The version of SQLite that REALSQLDatabase is built on is 3.3.6, while the current version of SQLite is 3.4.2.
[edit] Superclass
REALSQLDatabase is a subclass of Database
[edit] Interfaces
None
[edit] Constants
None
[edit] Methods
[edit] Function AttachDatabase(file as FolderItem, databaseName as String) as Boolean
[edit] Function AttachDatabase(file as FolderItem, databaseName as String, password as String) as Boolean
[edit] Function CreateDatabaseFile() as Boolean
Creates a new database file at the location specified by the DatabaseFile property. It returns true if it succeeded, and false if it does not. If DatabaseFile is nil, CreateDatabaseFile returns false, but does not set the Error property to true. This function is documented as overwriting an existing file, and this behavior is confirmed on Mac OS X.
[edit] Sub Decrypt()
[edit] Sub DetachDatabase(databaseName as String)
[edit] Sub Encrypt(password as String)
[edit] Function LastRowID() as Integer
[edit] Properties
[edit] AutoCommit as Boolean
[edit] DatabaseFile as FolderItem
Sets or gets the file. If DatbaseFile is nil, then the REALSQLDatbase exists in memory. This is useful for unit testing, and a source of potential gotchas.
[edit] EncryptionKey as String
[edit] ShortColumnNames as Boolean
[edit] Events
None
[edit] Sample Code
[edit] Creating a new database
Dim db as New REALSQLDatabase
db.DatabaseFile = GetFolderItem("test.rsd")
if db.DatabaseFile <> nil then
If Not db.CreateDatabaseFile then
//creation failed
End if
[edit] Creating an in-memory database
dim db as new REALSQLDatabase if db.Connect then db.SQLExecute "CREATE TABLE Table1 (table1_sn Integer)" else //check db.Error end if
