[odb-users] executing native sql queries

Lidia Kalinovsky lidia at lemur-soft.com
Tue Jul 9 13:30:59 EDT 2013


Hello ,

I did as you suggested and got exception during first execute call.
Error is:  1: unrecognized token \"47793.sqlite\""

inNewDBName =a.sqlite
inOldDBName  = 47793.sqlite


Code is:

std::auto_ptr<odb::core::database> db =
DBHelper::CreateDatabase(inNewDBName,true);

odb::core::connection_ptr c (db->connection ());
c->execute (std::string("ATTACH DATABASE ") + inOldDBName  + " AS old");
c->execute("insert into Activity (wrntyID) Select ZWRNTYID from old");

Could you advice please ?

Thanks.
Lidia.


On Tue, Jul 9, 2013 at 4:06 PM, Lidia Kalinovsky <lidia at lemur-soft.com>wrote:

> thanks a lot - will try it.
>
>
> On Tue, Jul 9, 2013 at 3:30 PM, Boris Kolpackov <boris at codesynthesis.com>wrote:
>
>> 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
>>
>
>
>
> --
> Software integration and outsourcing services,
> Lemur-Soft, Giv'at Nili
> Israel, 37825
> Phone : (+972) 545748325
> Fax : (+972) 775345383
> Email : lidia at lemur-soft.com
> Web: www.lemur-soft.com
>



-- 
Software integration and outsourcing services,
Lemur-Soft, Giv'at Nili
Israel, 37825
Phone : (+972) 545748325
Fax : (+972) 775345383
Email : lidia at lemur-soft.com
Web: www.lemur-soft.com


More information about the odb-users mailing list