[odb-users] schema_catalog

Sokolov, Vadim O. vsokolov at anl.gov
Fri Feb 8 12:22:33 EST 2013


Hi Boris, 
I agree something like exists method would be a clean way to implement the feature and would be sufficient for our scenario.
Vadim

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Friday, February 08, 2013 10:31 AM
To: Sokolov, Vadim O.
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] schema_catalog

Hi Vadim,

Sokolov, Vadim O. <vsokolov at anl.gov> writes:

> Here is our scenario, we have 3 sqlite databases (in 3 files and they 
> correspond to 3 named schemas), I have a create_all_databases function 
> this function creates a single odb::database (use ATTACH statement 
> from sqlite) object through which a user can access any of the 3 
> databases seamlessly. However some of the applications might use just 
> one or two out of tree databases and those will not appear in the in 
> schema_catalog and I would get an exception.

I see. Returning a list of names, while possible, is not very convenient.
The implementation does not keep it so we will have to collect them and return an std::vector or something like this by value. While not a big deal, it doesn't feel very clean. Plus, with the new multi-database support, a schema with the specified name can be "available" only for certain databases (i.e., there can be schema "foo" for SQLite and MySQL and schema "bar" only for SQLite). So, ideally, we would need to return a vector of <database_id, name> pairs.

On the other hand, providing a function like exist() would be really easy and clean. It would take the database and the name and return true if a schema with this name exists for this database. Would that be sufficient for your scenario?

Boris



More information about the odb-users mailing list