[odb-users] A view on top of several tables from different sqlite files (DB)

Weiss, Yoav yoav.weiss at intel.com
Tue Sep 8 08:57:39 EDT 2015


Hi Boris,

My issue was resolved. I simply saved the connection ptr (by using the database::connection() API) and used it for all subsequent queries and transactions. I didn't need to qualify my tables since they have unique names across the 2 database schemas. I simply used --schema-name switch in the odb code generation to create specific tables in specific databases.

Thanks for your help.

Yoav


-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Monday, September 07, 2015 19:01
To: Weiss, Yoav
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] A view on top of several tables from different sqlite files (DB)

Hi Yoav,

Weiss, Yoav <yoav.weiss at intel.com> writes:

> So I did: m_p_db->connection()->execute ("ATTACH DATABASE cell.sqlite 
> AS cells") Which worked fine, but the first query (using
> m_p_db->query_one()) on a table inside cells DB, I got: 1: no such
> table: hier_version
> 
> I think this is caused by me using the connection pointer, but I'm not 
> sure.

It would only be a problem if your application needed several connections at the same time. If you executed the two statements one after another, the query_one() would reuse the connection that was created for the first.

Try to qualify the table name with the database name as I suggested in my previous reply. I am suspecting this ability to use unqualified table names with multiple databases is a recent addition to SQLite.

Boris
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.




More information about the odb-users mailing list