Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
<?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 xml:lang="en" id="GUID-C9A1CC1E-2398-5887-8C64-7B8EE0B22022"><title>SQL Interfaces</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This document examines both SQL options in the Symbian OS: Symbian SQL and SQLite. </p> <section><title>Purpose</title> <p>If you are creating or porting an SQL capable application to Symbian OS 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 OS licensees and third party application developers. </p> </section> <section><title>Introduction</title> <p>Symbian OS 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 OS </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 OS 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 OS 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><title>Advantage of Symbian SQL</title> <p>The advantages of using Symbian SQL to develop a Symbian OS database application are its close integration into the Symbian OS 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><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>