Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356768

Summary: [DB] Eliminate CDODBSchema singleton in favor of specific instance for an ID's DBType
Product: [Modeling] EMF Reporter: Caspar D. <caspar_d>
Component: cdo.dbAssignee: Project Inbox <emf.cdo-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: stefan
Version: 4.13   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch v1 none

Description Caspar D. CLA 2011-09-06 03:40:01 EDT
Currently a lot of DB code uses the static IDBTable fields
on the singleton... but not all, because some system tables
depend on the result of store.getIDHandler().getDBType()
for their initialization, and so they can't be initialized
as static fields on the singleton.

In order to eliminate this inconsistency, we should eliminate
the singleton, and instead instantiate a CDODBSchema for a
specific DBType.
Comment 1 Caspar D. CLA 2011-09-06 03:48:50 EDT
Created attachment 202783 [details]
Patch v1

This patch is incomplete, but it covers a lot of the extensive (but
straightforward) textual changes, i.e. using the store-specific schema
instance instead of the global CDODBSchema.INSTANCE.

This compiles but perhaps it's all wrong; I just discovered that the
DBStore's schema is not a CDODBSchema, but yet another one :-(
Comment 2 Stefan Winkler CLA 2011-09-12 05:39:26 EDT
Thanks, Caspar, for your work. I have started working on something similar a few months back, but had to time to complete it.

I followed along the same lines as you (DBSchema wired to DBStore etc.).

However, what I see from your patch is that you still have a "central" INSTANCE in CDODBSchema.
I would suggest to remove this as well and create a dedicated constructor which initializes the schema when the CDODBSchema is added to the DBStore. This way we can have several DBStores, each one with its own instance of CDODBSchema.

The next step would be to make CDODBSchema dependent on the DBAdapter, which is needed to handle reserved words (e.g. by quoting them correctly).

As a heads up: this is related to Bug 306356 and to Bug 344232.
Comment 3 Eike Stepper CLA 2012-08-14 22:58:05 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 4 Eike Stepper CLA 2013-06-29 12:19:40 EDT
We'll try to address open problems in 4.3 (master) first and then port fixes back to 4.2.
Comment 5 Eike Stepper CLA 2015-07-14 02:22:15 EDT
Moving all open bugzillas to 4.5.
Comment 6 Eike Stepper CLA 2016-07-31 01:05:11 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 7 Eike Stepper CLA 2017-12-28 01:09:41 EST
Moving all open bugs to 4.7
Comment 8 Eike Stepper CLA 2019-11-08 02:04:42 EST
Moving all unresolved issues to version 4.8-
Comment 9 Eike Stepper CLA 2019-12-13 12:48:46 EST
Moving all unresolved issues to version 4.9
Comment 10 Eike Stepper CLA 2020-12-11 10:45:13 EST
Moving to 4.13.