Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Using the DB Mapping to populate queries
[CDO] Using the DB Mapping to populate queries [message #991334] Tue, 18 December 2012 14:46 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hello,

Is there a way to access the DBStore MappingStrategy, so I can find out the column names in the DB? I know have to deal with column names which are sometimes case-incensitive, and sometime are CamelCased:

For example: Same code, different DB setup gives this:

MySQL setup 1:
Table name => metrics_MetricValueRange_metricValues_list


MySQL setup 2:
Table name => metrics_metricvaluerange_metricvalues_list

This would require to different SQL query text, to be succesful in both setups.

Additionally MySQL, likes to know the DB name to prefix the table. Can I fetch the DB/Schema name this from CDO somehow?


Thank You, Christophe
Re: [CDO] Using the DB Mapping to populate queries [message #991374 is a reply to message #991334] Tue, 18 December 2012 20:11 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5590
Registered: July 2009
Senior Member
Am 18.12.2012 15:46, schrieb Christophe Bouhier:
> Hello,
> Is there a way to access the DBStore MappingStrategy, so I can find out the column names in the DB? I know have to
> deal with column names which are sometimes case-incensitive, and sometime are CamelCased:
> For example: Same code, different DB setup gives this:
> MySQL setup 1: Table name => metrics_MetricValueRange_metricValues_list
>
>
> MySQL setup 2: Table name => metrics_metricvaluerange_metricvalues_list
I don't follow. Are you saying something in CDO causes these differences?

>
> This would require to different SQL query text, to be succesful in both setups.
I think something in the particular Mysql configurations causes case insensitive identifiers. In that case the case in
the queries wouldn't matter, either.

> Additionally MySQL, likes to know the DB name to prefix the table. Can I fetch the DB/Schema name this from CDO somehow?
All these informations should be accessible on the server side through IDBStore, IMappingStrategy, IClassMapping, etc.

If you need them at the client side, it would be possible to implement and contribute a custom IQueryHandler that
returns these mapping informations (or any other server information).

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Using the DB Mapping to populate queries [message #991929 is a reply to message #991374] Thu, 20 December 2012 13:58 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
I am merely describing the differences. I am not pointing towards CDO regarding this.
I managed to work around this issue, but converting the queries to CamelCase table names, and this also works
on non-CamelCase column names. so it's fine.

Thanks for the pointer on IDBStore etc... I think I get the DB name from those API's. I need this info on the client and server.
(my CDO access code, is common to client and server). So an extended IQueryHandler implementation would be an option.



Previous Topic:[CDO-Net4j] Compression of Net4j/CDO streams
Next Topic:ExtendedMetadata unmapped structuralFeature
Goto Forum:
  


Current Time: Sat Dec 20 16:01:38 GMT 2014

Powered by FUDForum. Page generated in 0.11609 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software