Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Query the model using the Database Viewer

The database model created by the CDB can also be used to query the OS model in addition to the compatibility checks. A database viewer is used to view the CDB, that is shipped with the DBMS. In this recipe, we will see how to print the vtable for a class from the model.

To use the viewer, your machine needs to have Java 1.4 installed (the JVM). The database viewer is found in a file hsqldb.jar, which is in the path EPOC\master\common\testtools\cdb\lib\... Copy the jar file into a folder on your system.

To run the viewer from any location, add the location of hsqldb.jar to your PATH environment variable. The next steps show how to run the viewer. It assumes that you have already added the jar file to your path. If you haven’t added yet, whenever you run the viewer from the command prompt, you will have to navigate to the directory that contains the hsqldb.jar file on your system.

Open a command prompt, and type:

> java –cp hsqldb.jar org.hsqldb.util.DatabaseManager

This launches the database viewer.

Note: If the database you are trying to load is very large, you need to increase the amount of memory which your JVM can use.

Use the following call to launch the viewer instead of the above:

> java –Xmx512M –cp hsqldb.jar org.hsqldb.util.DatabaseManager

It is important to note that the database viewer is unstable for very large databases, and has a tendency to hang.

Querying the OS model involves these steps:


Loading the database

After launching the database viewer, to load a database, change the database type to Standalone:

In the URL field, type the full path and name of the database. Then click OK.

If the database is loaded successfully, you will see a screen like the one below:

[Top]


Querying the database

The figure shows you, how to query using the database viewer. To perform useful queries, you will need to understand how the data in the CDB is arranged. Look at the cdb.sql script that is found in the cdb installation directory.

To get a table corresponding to the vtable for a class, the following queries can be executed. Note that the queries have been broken down to improve the performance of the tool as complex queries on large datasets can take a long time. This example demonstrates how to retrieve the virtual table for MGraphicsDeviceMap class.

The first query identifies the members functions of the class.

select cppentityid from cdb_cppentities A, cdb_cppentities B where B.name='MGraphicsDeviceMap' and A.contextid=B.cppentityid and A.entitytype = 30;

This returns a set of IDs corresponding to functions that are defined in this class:

CPPENTITYID 
----------- 
2688 
3413 
4151 
4551 
7420 
7656 
8249 
9393 
9403 
12053 
12636 
15128 
16069 
16836 
17931 

15 row(s) in 172 ms

NAME VTBLPOS 
----------------------------------- ------- 
HorizontalTwipsToPixels 0 
VerticalTwipsToPixels 1 
HorizontalPixelsToTwips 2 
VerticalPixelsToTwips 3 
GetNearestFontInTwips 4 
GetNearestFontToDesignHeightInTwips 5 
GetNearestFontToMaxHeightInTwips 6 
ReleaseFont 7 
~MGraphicsDeviceMap 8 

9 row(s) in 141 ms

This is the virtual table for the class MGraphicsDeviceMap.