How to emulate ADO editing / updating mechanism for SQLite in C ++?

I have a C ++ application that uses ADO to communicate with an Oracle database. I am updating an application to support offline documents. I decided to implement SQLite for the local side.

I have implemented a wrapper around ADO classes that call the appropriate code. However, the ADO method of adding / editing / deleting rows is a little difficult to implement for SQLite.

For ADO, I would write something like:

CADODatabase db;
CADORecordset rs( &db );
db.Open( "connection string" );
rs.Open( "select * from table1 where table1key=123" );
if (!rs.IsEOF())
{
    int value;
    rs.GetFieldValue( "field", value );
    if (value == 456)
    {
        rs.Edit();
        rs.SetFieldValue( "field", 456 );
        rs.Update();
    }
}
rs.Close();
db.Close();

For this simple example, I understand that I could just post the update, but the real code is much more complicated.

Edit() Update() ? , Edit() , Update() , , , .

+3
1

", , , , .

ROWID , ?

0

Source: https://habr.com/ru/post/1707910/


All Articles