Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to execute SQL incrementally

DDL and DML statements can be executed incrementally.


Incremental execution of a DDL statement

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 RDbIncremental.

_LIT(KTxt,"DROP TABLE Suppliers");
...
RDbIncremental op;
TInt step;
TInt r=op.Execute(database,KTxt,step);
while (step>0 && r==KErrNone)
    {
    r=op.Next(step);
    }
op.Close();
...
// r has the error code from the operation

[Top]


Incremental execution of a DML statement

The following code fragment is an example of driving the incremental execution of a DML statement to completion.

_LIT(KTxt,"DELETE FROM Suppliers");
...
RDbUpdate update;
TInt r=update.Execute(database,KTxt);
while (r>0)
    {
    r=op.Next();
    }
op.Close();
...
// r has the error code from the operation
// update.RowCount() returns the number of rows deleted, if successful