|
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-BDC03973-45B0-54BD-99D1-298F4F59DB95" xml:lang="en"><title>How |
|
13 to execute SQL incrementally</title><shortdesc>Describes how SQL statements are executed.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>DDL and DML statements can be executed incrementally.</p> |
|
15 <section id="GUID-98969CFF-05CB-44AC-B104-55BAB017FF95"><title>Incremental execution of a DDL statement</title> <p>The following |
|
16 code fragment illustrates the incremental execution of a DDL statement. In |
|
17 practice, this is no better than direct execution but shows the 'end conditions' |
|
18 for running <codeph>RDbIncremental</codeph>.</p> <codeblock id="GUID-BC862C15-ACC4-5D29-A814-358C88116B6F" xml:space="preserve">_LIT(KTxt,"DROP TABLE Suppliers"); |
|
19 ... |
|
20 RDbIncremental op; |
|
21 TInt step; |
|
22 TInt r=op.Execute(database,KTxt,step); |
|
23 while (step>0 && r==KErrNone) |
|
24 { |
|
25 r=op.Next(step); |
|
26 } |
|
27 op.Close(); |
|
28 ... |
|
29 // r has the error code from the operation</codeblock> </section> |
|
30 <section id="GUID-49F5A5A9-34FB-4493-BD1E-A6DA8AFC23F9"><title>Incremental execution of a DML statement</title> <p>The following |
|
31 code fragment is an example of driving the incremental execution of a DML |
|
32 statement to completion.</p> <codeblock id="GUID-F25A1017-B103-530C-B426-54098A696014" xml:space="preserve">_LIT(KTxt,"DELETE FROM Suppliers"); |
|
33 ... |
|
34 RDbUpdate update; |
|
35 TInt r=update.Execute(database,KTxt); |
|
36 while (r>0) |
|
37 { |
|
38 r=op.Next(); |
|
39 } |
|
40 op.Close(); |
|
41 ... |
|
42 // r has the error code from the operation |
|
43 // update.RowCount() returns the number of rows deleted, if successful</codeblock> </section> |
|
44 </conbody></concept> |