Table of Contents
Xojo Database API in the V4RB plugin
You can read about Xojo Database API in the online WIKI of Xojo:
http://docs.xojo.com/index.php/Database_Class
Note: in the past, when Xojo was named REALbasic, this was named as RBDB API.
Note: you should have Database license of Xojo to use this API.
Overview of Xojo Database API
Xojo tries to provide unified API to access different databases. Because of this API tends to be minimalistic:
- Database - main class
- RecordSet - Result of SqlSelect()
- DatabaseRecord - optional, helper class for Database.InsertRecord() method.
- PreparedSQLStatement - helper class, produced by Database.Prepare() method. Allows to use SQL queries with bound parameters.
Abstract class 'Database' and set of database-specific sub-classes:
- MSSQLServerDatabase
- MySQLCommunityServer
- ODBCDatabase
- OracleDatabase
- PostgreSQLDatabase
- SQLiteDatabase
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.
SQLiteDatabase
class have propertydb.DatabaseFile
, which means the path on HDD to a database file. Remote DB classes use DatabaseName property to specify just database name.SQLiteDatabase
class have methodCreateDatabaseFile()
to create database on disk andconnect()
to open. Remote DB classes haveconnect()
method only.
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
VRBDatabase
. - SQLite DB (Local and Client to Valentina SQLite Server) via class
VSqliteDataBase
.
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 existed 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
VRBDatabase Class
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.
Properties:
* ConnectionTimeout as Integer * DatabaseFile as FolderItem * Port as Integer * EmbeddedSerial as String
Methods:
* 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.