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