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