7 Nokia Corporation - initial contribution. |
7 Nokia Corporation - initial contribution. |
8 Contributors: |
8 Contributors: |
9 --> |
9 --> |
10 <!DOCTYPE concept |
10 <!DOCTYPE concept |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
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"); |
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"); |
13 ... |
19 ... |
14 RDbIncremental op; |
20 RDbIncremental op; |
15 TInt step; |
21 TInt step; |
16 TInt r=op.Execute(database,KTxt,step); |
22 TInt r=op.Execute(database,KTxt,step); |
17 while (step>0 && r==KErrNone) |
23 while (step>0 && r==KErrNone) |
18 { |
24 { |
19 r=op.Next(step); |
25 r=op.Next(step); |
20 } |
26 } |
21 op.Close(); |
27 op.Close(); |
22 ... |
28 ... |
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"); |
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"); |
24 ... |
33 ... |
25 RDbUpdate update; |
34 RDbUpdate update; |
26 TInt r=update.Execute(database,KTxt); |
35 TInt r=update.Execute(database,KTxt); |
27 while (r>0) |
36 while (r>0) |
28 { |
37 { |
29 r=op.Next(); |
38 r=op.Next(); |
30 } |
39 } |
31 op.Close(); |
40 op.Close(); |
32 ... |
41 ... |
33 // r has the error code from the operation |
42 // r has the error code from the operation |
34 // update.RowCount() returns the number of rows deleted, if successful</codeblock> </section> </conbody></concept> |
43 // update.RowCount() returns the number of rows deleted, if successful</codeblock> </section> |
|
44 </conbody></concept> |