Chapter 8. Databases


REALBASIC 2005 SHIPS WITH A NEW DATABASE engine, based on the open source SQLite project (read more about it at http://www.SQLite.org/). The REALSQLdatabase class is the class you use to manage databases, and this replaces the legacy REALdatabase, which is still part of the distribution but is available only for backward compatibility. REALSQLdatabase is a subclass of the Database class, and the Database class provides a generic database API that can be used with more than just REALSQLdatabases. Professional edition users can also use plug-ins that provide the following classes: MySQLDatabase, PostgresDatabase, OpenBaseDatabase, OracleDatabase, Database4DServer and ODBCDatabase classes.

Fortunately, REALSQLdatabase is available to all users, and because it shares the same basic API as the other classes, you can readily create a project using REALSQLdatabase and upgrade to one of the other databases at a later time with minimal changes to your code. That is, of course, if you actually write any code when implementing your database. One of the greatest strengths of REALbasic is how simple it makes it to create, update, and modify databases, something that can easily be done without writing a single line of code, and in only a few minutes.

The first database example I will show you does just thatit creates a "codeless" database and shows you just how easy it is. I'll use it to create a different way of tracking RSS subscriptions in the RSSReader application. When that is accomplished, I will show you the same database created through code, which is still a relatively painless process. The fact that REALbasic uses SQLite as the underlying database should fill you with delight. As an open source project, the quality of the database is extremely high. It consumes little memory; it's compact, it's fast, and its innards are readily accessible to any developer interested in looking inside. It is not a multiuser database like MySQL or Postgres, so it may not be right for all occasions, but it is right for many of them.

One especially valuable feature is that SQLite database files are cross-platform and they do not have any endian issues. You can move the database file around to different machines and open it without any problems. One of the benefits of it being an open source project is that there are many language bindings to SQLite, such as Java, Python, Perl, PHP, Delphi, and Visual Basic, to name a few. This means that any databases you create with REALbasic can also be made available to applications written in other languages.




REALbasic Cross-Platform Application Development
REALbasic Cross-Platform Application Development
ISBN: 0672328135
EAN: 2147483647
Year: 2004
Pages: 149

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net