How to execute SQL incrementally

Describes how SQL statements are executed.

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
      

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