[odb-users] executing native sql queries

Boris Kolpackov boris at codesynthesis.com
Tue Jul 9 08:30:40 EDT 2013


Hi Lidia,

Lidia Kalinovsky <lidia at lemur-soft.com> writes:

> db = create_db(<new_db>);
> db->execute("insert into Activity (wrntyID) Select zwrntyID from " + <old
> db> + ".dbo.ZActivity");
> 
> Clear it does not work as I don't know how to relate to old db ( by path
> ??? ).

You could attach the old database:

db->execute ("ATTACH DATABASE /path/to/old.db AS old");
db->execute ("insert into Activity (wrntyID) Select zwrntyID from old.ZActivity");


> Is there some way to get result of execute ( not only number of rows
> affected ) ?

You can use a native view to handle a result set of a native SELECT
statement. See Chapter 9, "Views" for details.

Boris



More information about the odb-users mailing list