Symbian3/SDK/Source/GUID-C9A1CC1E-2398-5887-8C64-7B8EE0B22022.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 7 51a74ef9ed63
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-C9A1CC1E-2398-5887-8C64-7B8EE0B22022" xml:lang="en"><title>SQL
Interfaces</title><shortdesc>This document examines both SQL options in the Symbian platform:
Symbian SQL and SQLite.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-C2260AFE-8003-45A7-A492-E98F6F4C7221"><title>Purpose</title> <p>If you are creating or porting an SQL capable
application to Symbian platform you should read this document to get a better
understanding of the issues and options. </p> <p><b>Intended
audience:</b> </p> <p>This document is intended to be used by Symbian platform
licensees and third party application developers. </p> </section>
<section id="GUID-A566BEF7-254D-4AFE-BF06-7EB7B9E79F8C"><title>Introduction</title> <p>Symbian platform exposes two interfaces
to SQL: </p> <ol id="GUID-EC4FEAFB-BF19-5B50-9375-D01DE46B93FF">
<li id="GUID-6503D03A-7D56-5D90-A0A9-A22BB47292F3"><p>the Symbian SQL component
of Symbian platform </p> </li>
<li id="GUID-D30E8F76-CCC4-556C-9082-1B823875017F"><p>the open source SQLite
3 API. </p> </li>
</ol> <p>If you are developing an application for Symbian platform which involves
accessing a database with SQL you must decide which of these interfaces to
use before you begin. This is for two reasons. </p> <ol id="GUID-DBDCA7D4-3CC9-5D98-A159-A0BE9BA579F5">
<li id="GUID-AB276B85-649B-5711-9FF8-554A1F4D1A2A"><p>It is not possible to
access the same database with both interfaces, whether concurrently or not. </p> </li>
<li id="GUID-EEA6698B-9407-5EB7-AF61-E78325A5E187"><p>The two interfaces are
different and do not have identical functionality. </p> </li>
</ol> <p><b>Choose
an SQL interface</b> </p> <p>Here is a simple set of rules to help you select
the interface most appropriate to your development needs. </p> <ul>
<li id="GUID-8D28DF39-824E-5E0A-801B-33CB924BF406"><p> <xref href="GUID-1F12E3F5-45B2-55EC-B021-00338277C608.dita">Symbian
SQL DB</xref> if you are developing a new application for the Symbian platform </p> </li>
<li id="GUID-83033CC7-D55F-5C96-9BB1-DC1A6B00ECA1"><p> <xref href="GUID-5CA62D99-15E2-5556-966F-CFC3FCE3B246.dita"> SQLite</xref> 3
interface if you are porting an existing SQLite application written in C </p> </li>
</ul> </section>
<section id="GUID-446D6569-74E5-4577-9F2D-EB6177767A43"><title>Advantage of Symbian SQL</title> <p>The advantages of using
Symbian SQL to develop a Symbian platform database application are its close
integration into the Symbian platform as a whole and the consequent robustness,
efficiency and security that this provides. </p> <ul>
<li id="GUID-0F131E72-2374-5E23-B675-790D0B5C2861"><p>Symbian SQL is robust
because applications are isolated from the server. Errors in the application
do not affect the server and vice versa. </p> </li>
<li id="GUID-9E6100F8-2D80-574D-9252-9E893C877628"><p>Symbian SQL is robust
because an application can be configured to be included in database backup
and restore. </p> </li>
<li id="GUID-2BC27055-6799-5FA7-82BB-E353B2587CC3"><p>Symbian SQL is efficient
because multiple applications share one instance of a database cache. The
server has a single connection to the file system and there is no need of
multiple caches that duplicate the use of memory. </p> </li>
<li id="GUID-B3FD8457-9107-5EB6-817D-B7226C41A8FA"><p>Symbian SQL is efficient
because the single connection from the server to the file system eliminates
the need for mutexes. This makes efficient use of kernel resources. </p> </li>
<li id="GUID-61CAB80A-1A51-5CF4-B9BC-2529269046DC"><p>Symbian SQL is efficient
because it sets up a soft heap limit. This means that the server reuses free
memory before it attempts to allocate more. The limit may still be overridden,
for example when a blob or a large text column is accessed. This limits RAM
usage. </p> </li>
<li id="GUID-33FF23F0-96DF-5FB2-A300-82D59D44C6E9"><p>Symbian SQL is efficient
because it provides asynchronous APIs. This allows the application to make
a database call and perform other work while it waits for the call to return. </p> </li>
<li id="GUID-AA010085-DA9F-5944-AC8D-28A07BB5FBA6"><p>Symbian SQL is efficient
because the server is single threaded and no file locking mechanism is required. </p> </li>
</ul> </section>
<section id="GUID-ED633559-1D6D-4D35-A903-92CB758B3275"><title>Advantages of SQLite 3 API</title> <p>The advantages of the
SQLite 3 API are its open source status, excellent documentation, widespread
use and large developer community. For a single cross platform application
written by a team of developers it may not be worthwhile mastering the C++
interface and to use the SQLite 3 API instead. </p> <p>The SQLite 3 API exposes
many functions not available in Symbian SQL, particularly the SQLite C extension
API. However, it should be noted that Symbian SQL provides several built-in
collation functions and a built-in implementation of the LIKE operator. </p> <p>SQLite
3 API supports multi-threaded applications and provides concurrent database
access. </p> </section>
</conbody><related-links>
<link href="GUID-22844C28-AB5B-5A6F-8863-7269464684B4.dita"><linktext>SQL Overview</linktext>
</link>
<link href="GUID-5CA62D99-15E2-5556-966F-CFC3FCE3B246.dita"><linktext>SQLite Overview</linktext>
</link>
</related-links></concept>