Skip to main content



      Home
Home » Modeling » EMF » [CDO] exposing the DB name for the DBStore
[CDO] exposing the DB name for the DBStore [message #1283431] Thu, 03 April 2014 08:12 Go to next message
Eclipse UserFriend
Hi,

In MySQL queries exectuted with CDOQueryHandler need to have the DB name
prefixing a table name.

example:

private static final String SELECT_MVR_NON_CAMEL = "select val.cdo_id"
+ " from " + DB_NAME
+ ".metrics_metricvaluerange_metricvalues_list as val_list join "
+ DB_NAME + ".generics_value as val"
+ " on val_list.cdo_value = val.cdo_id"
+ " where val_list.cdo_source = :mvr_cdoid";


Now the DB_NAME is a hard coded static. I tried to get it from the
IRepository or IDBStore but to no avail... What is the API to get the DB
Schema name which can be used in a query?

Thank You Christophe
Re: [CDO] exposing the DB name for the DBStore [message #1283650 is a reply to message #1283431] Thu, 03 April 2014 13:20 Go to previous messageGo to next message
Eclipse UserFriend
So, you are constructing the query on the server side?
Then, this should work:

IDBStore store = ...
store.getMappingStrategy().getTableName(eClass);


Christophe Bouhier wrote on Thu, 03 April 2014 14:12
Hi,

In MySQL queries exectuted with CDOQueryHandler need to have the DB name
prefixing a table name.

example:

private static final String SELECT_MVR_NON_CAMEL = "select val.cdo_id"
+ " from " + DB_NAME
+ ".metrics_metricvaluerange_metricvalues_list as val_list join "
+ DB_NAME + ".generics_value as val"
+ " on val_list.cdo_value = val.cdo_id"
+ " where val_list.cdo_source = :mvr_cdoid";


Now the DB_NAME is a hard coded static. I tried to get it from the
IRepository or IDBStore but to no avail... What is the API to get the DB
Schema name which can be used in a query?

Thank You Christophe

Re: [CDO] exposing the DB name for the DBStore [message #1283738 is a reply to message #1283650] Thu, 03 April 2014 15:27 Go to previous message
Eclipse UserFriend
Oh, sorry, you want the DB schema, not the table name...
Maybe, you could set a repository property to reflect the schema name you are using.

Erdal Karaca wrote on Thu, 03 April 2014 19:20
So, you are constructing the query on the server side?
Then, this should work:

IDBStore store = ...
store.getMappingStrategy().getTableName(eClass);


Christophe Bouhier wrote on Thu, 03 April 2014 14:12
Hi,

In MySQL queries exectuted with CDOQueryHandler need to have the DB name
prefixing a table name.

example:

private static final String SELECT_MVR_NON_CAMEL = "select val.cdo_id"
+ " from " + DB_NAME
+ ".metrics_metricvaluerange_metricvalues_list as val_list join "
+ DB_NAME + ".generics_value as val"
+ " on val_list.cdo_value = val.cdo_id"
+ " where val_list.cdo_source = :mvr_cdoid";


Now the DB_NAME is a hard coded static. I tried to get it from the
IRepository or IDBStore but to no avail... What is the API to get the DB
Schema name which can be used in a query?

Thank You Christophe


Previous Topic:SetCommand doesn't work with Boolean
Next Topic:[EMF] retrieve cross-model-referenced object
Goto Forum:
  


Current Time: Sat Jul 05 06:57:24 EDT 2025

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

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

Back to the top