Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Application with two different databases schema
Re: Application with two different databases schema [message #53886 is a reply to message #53885] Mon, 11 May 2020 12:08 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
mirek wrote on Mon, 11 May 2020 10:21
I think that there are 2 separate issues:

- Session

and

- Schema

WRT to Session, things get complicated here as you cannot obviously use global session (the one assigned with SQL = statement) for both databases.

This is no showstopper - Sql instances have constructor form with SqlSession as parameter while default Sql constructors are using global session.

Usually one DB is "dominant" for the application. In that case, it makes sense to assign global session for dominant database connection and use constructor with parameter for secondary one.

Now for the schema issue. Obviously, you need two schema files and import each one with its dialect, also duplicate all other details you need.
Simply #undef SCHEMADIALECT after the include and define a new value for it.

I will try to make a reference example for this...

Mirek


Thanks for the reply.
I do not use SQL, so the I have no problem with sessions. I can use both, but currently with the same .SCH. Moreover when I create a new db of course appear tables not wanted belonging to the other db.

My problems is how to deal with two schema.
I have just tried to duplicate the code

#define SCHEMADIALECT <plugin/sqlite3/Sqlite3Schema.h>
#define MODEL <OrionVR/db.sch>
#include <Sql/sch_header.h>

#undef SCHEMADIALECT
#undef MODEL

#define SCHEMADIALECT <MySql/MySqlSchema.h>
#define MODEL <OrionVR/db2.sch>
#include <Sql/sch_header.h>


but the compiler signal error.
Luigi
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Jsonize() in database table structures (S_*) [patch]
Next Topic: OleDBSession in Archive
Goto Forum:
  


Current Time: Mon Apr 29 00:31:50 CEST 2024

Total time taken to generate the page: 0.04042 seconds