FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Mobility
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
June 27, 2006

Symbian Database Components

(Page 4 of 6)

Physical Implementation

The Symbian operating system supports a VFAT-type filesystem that's similar to DOS. A SymbianOS database is just another file on a filesystem, and can be arbitrarily named in an arbitrary location. So, for example, you could store a file named "my database" in the C:\Documents folder. Within my one database file 'C:\Documents\my database' can be stored several tables.

C++ vs. SQL

The details of the SymbianOS database API are proprietary, specific to Symbian, and usually not the best approach to creating tables. The industry-standard language for creating tables, retrieving data, and modifying data is SQL. I recommend using SQL with the SymbianOS DBMS wherever possible.

Furthermore, the documentation states that contrary to normal expectations, commands utilized using SQL on the Symbian DBMS actually perform at least as fast as the equivalent operation using the C++ API. One exception to the "SQL is about as fast as the C++ API" is when using bulk inserts--for a few rows, there's not much difference, but for more than a few rows, the C++ API outperforms using SQL's INSERT statements, according to Symbian

In summary, my recommendation is to use the SQL interface whenever possible. It's standard, easier to use, and the performance downsides are minimal. In some cases, however, there is functionality that the SQL interface does not provide, so you have to use C++ to implement the functionality. Probably the three most important examples are compacting the database, transaction management, and notification.

Database compaction involves reorganizing the internal layout of the file to create a smaller file. Transaction management involves explicit rollbacks and commits. Notification is an interesting feature--users of a database can use the RDbNotifier class to get notification of certain events in the database, such as a transaction rollback.

A typical table creation session using Symbian SQL might look like Listing Two.

 

create table authors ( author_id counter, last_name varchar(40), first_name varchar(40) )

Listing Two: Table creation.
Previous Page | 1 Introduction | 2 EDBMS: The SymbianOS Internal Database | 3 Limitations | 4 Physical Implementation | 5 Retrieving Data | 6 Other Points Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK