Table of Contents
Xojo Database API in the V4RB plugin
You can read about Xojo Database API in the online WIKI of Xojo:
Note: in the past, when Xojo was named REALbasic, this was named as RBDB API.
Note: you should have a Database license of Xojo to use this API.
Overview of Xojo Database API
Xojo tries to provide a unified API to access different databases. Because of this API tends to be minimalistic:
- Database - main class
- RowSet - Result of SqlSelect(). (Old name - RecordSet).
- DatabaseRow - optional, helper class for Database.InsertRecord() method. (Old name - DatabaseRecord).
- PreparedSQLStatement - helper class, produced by Database.Prepare() method. Allows using SQL queries with bound parameters.
Abstract class 'Database' and set of database-specific sub-classes:
You can find an important difference in those classes between SQLite and others, because SQLite is a local DB engine, while others are remote DB SQL Servers.
V4RB Plugin and Xojo Database API
Starting with v6.0, V4RB plugin adds support for SQLite and provides 'Xojo Database API' for 2 databases:
- Valentina DB (Local and Client to Valentina DB Server) via class
- SQLite DB (Local and Client to Valentina SQLite Server) via class
Both these classes inherit directly from the Database class of Xojo, so all its properties and methods can be used as described in the documentation of Xojo.
Xojo Database API for SQLite
V4RB plugin, when used for SQLite database, provides both:
- access to LOCAL SQLite databases.
- access to remote Valentina SQLite Server.
We do our best efforts to provide:
- similar API for SqliteDatabase and VSqliteDatabase classes
- similar API for local and remote work
so you can:
- easily migrate existing code of your Xojo app from built-in SQLite classes to Valentina SQLite implementation
- have the same code working with both local and client-server SQLite databases
Xojo Database API for Valentina DB
Valentina's version is not so reach, because
1) Valentina developers prefer to use Valentina Native API, which is much more powerful and flexible.
2) Exits the bridge from
VRBDatabase class to
VDatabase class if it needs to use more features.
* ConnectionTimeout as Integer * DatabaseFile as FolderItem * Port as Integer * EmbeddedSerial as String * StructureEncryptionKey as String // new since v.10.4.16 * DataEncryptionKey as String // new since v.10.4.16
* Connect() as boolean * CreateDataBaseFile() as boolean * OpenDataBaseFile() as boolean * OpenBLOB( inTableName as string, inFieldName as string, inRowID as Int64, inReadWrite as boolean ) As VSqliteBLOB
Exists bridge from Xojo Database classes for Valentina to native Valentina API classes with the help of
VDatabase.Constructor( VRBDatabase inDB ). See Valentina Reference.pdf for details.
Dim dbFile as FolderItem Dim db as VRBDataBase db = new VRBDataBase if gClient then db.Host = "localhost" db.UserName = "sa" db.Password = "sa" db.Port = 15432 db.databaseName = filename else dbFile = GetFolderItem(filename) db.databaseFile = dbFile end if // Optionally set encryption keys: db.StructureEncryptionKey = "456" db.DataEncryptionKey = "123" if db.Connect then ...