Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Mobile

Symbian Database Components


Other Points

Since most of the calls to EDBMS are asynchronous, typically the developer makes the EDBMS call from within a client-side active object. Using that combination avoids causing applications to block due to long-running database operations. However, if for some reason you are not using active objects client-side, or in other cases, sometimes the RDbIncremental class can be useful. This lets clients do things such as create an index in steps. Instead of having to wait a long time while an index is being built, for example, client-side programs can start the index creation process at one point, then later on ask the EDBMS server to do a little more work on the index creation, and so on.

Difference Between RDbView and RDbTable

Again, RDbView is not a normal database view; on the contrary, it is a client-side rowset. For certain queries, there's a more efficient client-side rowset structure: RDbTable. This is another rowset structure--the efficiency is server-side. Whereas in the RDbView example, the internal server-side result structure is actually a dynaset, a separate server-side copy of the data. When using RDbTable, the server-side structure is not a dynaset, but instead has pointers referring directly to the table structures.

Modifying Data

Thinking through the types of applications that use the Symbian DBMS gives the conclusion that updates beyond the simple functionality are not high on the priority list, and the Symbian implementation is no exception. The SQL update is somewhat limited, allowing non-joining where clauses, but not complex expressions in the SET portion of the update statement. To update a column value with a complex expression, the expression calculation would have to be done outside of SQL.

Developers who choose not to use SQL to modify table data are required to:

  1. Create a rowset.
  2. Update the rowset.
  3. Indicate the updating.

Using SQL as much as possible requires much less programming and is a good example of why I recommend using SQL.

Deleting Data

Deleting rows is fairly straightforward; Listing Four shows how to delete one or more rows.

 
delete from authors where author_id = 0
Listing Four: Deleting rows.

Indexes

SymbianOS supports multiple indexes on multiple columns on a table, and indexes can be unique. Listing Five is Symbian SQL for creating two multiple-column indexes on the same table.

create unique index id_index on authors(author_id)
   create index index2 on authors(last_name, first_name)
   As you can see, this is straightforward SQL.

Listing Five: Creting multiple-column indexes.

Datatypes

Symbian's DBMS server supports a rich variety of datatypes, from bits, tinyints to smallints, integer, bigint, as well as real, float, and double precision. Auto-increment columns are supported as well. There is a date type, a time type, and a timestamp, char(n), varchar(n), binary(n), and varbinary(n).

Client-side Access

If a program will be the exclusive user of a database, it is possible to bypass the DBMS server layer by using client-side access. In that case the client program directly accesses the system file server which is inside the base of the OS, and data retrieval will be faster than in the case where server. This is done by opening the database using the RDbStoreDatabase structure.

Conclusion

As mobile devices get smarter and smarter, there will be continue to be a wide variety of choices for deploying databases. Obviously, server-based databases (where the mobile device stores data on some large server machine to which the mobile device has some connection) should be given a hard look. If that is impractical, consider some local alternatives. A local alternative, in contrast to storing all data on a server, involves storing some or all the application data on the mobile device. A full-featured relational database implementation packs a lot of functionality but adds to the footprint on each device, and can require royalties and/or licenses per device. Since the internal Symbian DBMS is part of the OS, there's no per-device royalty. The Symbian DBMS implementation is a powerful implementation given its footprint--clearly it works for some applications, evidenced by Symbian's use of its DBMS for standard Symbian system applications such as Contacts, the Symbian standard application for phone contacts. In addition to internal use, and system applications, for some third-party applications using an all-local, or temp-local and replicate strategy, Symbian's royalty-free, small footprint, provided DBMS, makes sense as well.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.