Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 12:12 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
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 17:20 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
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 19:27 Go to previous message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
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: Thu Apr 25 04:16:33 GMT 2024

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

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

Back to the top