fnc12/sqlite_orm

Multi database connection

jairoareyes opened this issue · 2 comments

Thanks for your amazing work.

I'm trying to create two connections to different database files. Like:

File A:
	auto inline configure_z_storage(const std::string &db_path)
	{
		using namespace sqlite_orm;

		return make_storage(db_path, ....);
       }
using StorageClient = decltype(configure_z_storage(nullptr));

File B:
	auto inline configure_y_storage(const std::string &db_path)
	{
		using namespace sqlite_orm;

		return make_storage(db_path, ....);
       }
using StorageClient = decltype(configure_y_storage(nullptr));

However, when I try to compile, it shows me this error:

 error: conflicting declaration ‘using StorageClient ....
using StorageClient = decltype(configure_y_storage(nullptr));
...

 note: previous declaration as ‘using StorageClient ....

How can I solve this issue? thanks.

fnc12 commented

this issue is not related to sqlite_orm. You have two types with the same name inside the same scope. You can have the same issue if you write:

using StorageClient = int;
using StorageClient = double;

You're right, I solved this issue using different names for StorageClient. Thanks.