Creating new table at runtime

Posts   
 
    
orenpeled
User
Posts: 53
Joined: 25-Jul-2005
# Posted on: 18-Aug-2005 08:57:50   

Hi,

My application needs to change an Oracle schema at runtime, meaning creation of new tables, adding foreign keys etc. Of course, I would like to have LLBLGen create for me matching entities at runtime, but this is not that important.... wink

Anyhow, does LLBLGen support DDL?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-Aug-2005 10:47:01   

No, it doesn't support DDL as in: create new tables and automagically new .NET types are created for you simple_smile .

Frans Bouma | Lead developer LLBLGen Pro
orenpeled
User
Posts: 53
Joined: 25-Jul-2005
# Posted on: 21-Aug-2005 12:37:44   

I don't really need .NET types. I could think that having the class EntityBase2 means that I can put data into it and call a method that only creates a table in the database based on this type.

Is it possible? Or is there something else? I want to avoid SQL statements ("CREATE TABLE....."), much like when performing DML commands

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Aug-2005 10:28:19   

No that's not possible, LLBLGen Pro doesn't support creation of schema elements like tables. So you have to use DDL statements.

Frans Bouma | Lead developer LLBLGen Pro
orenpeled
User
Posts: 53
Joined: 25-Jul-2005
# Posted on: 30-Aug-2005 08:48:08   

OK, so here's my problem. My application - a web-services application - uses a single DB-connection for each web-service through its lifetime.

Having a simple set of DML commands my code will be something like:

mDataAccessAdapter.OpenConnection(); mDataAccessAdapter.FetchEntity(...); mDataAccessAdapter.SaveEntity(...); . . mDataAccessAdapter.CloseConnection();

But when I need to create a new table among the DML commands, I understand that I should use either ODP directly (and open a new connection) or DataAccessAdapter.ExecuteActionQuery() (and create a new connection).

  1. Is it true that in the ExecuteActionQuery case I wouldn't have to open the connection? What do the DataAccessAdapter perform behind the scene?

  2. Why, anyhow, do I have to create a new connection object? Why can't the DataAccessAdapter's connection be used in some way?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 30-Aug-2005 11:13:25   

orenpeled wrote:

OK, so here's my problem. My application - a web-services application - uses a single DB-connection for each web-service through its lifetime.

Having a simple set of DML commands my code will be something like:

mDataAccessAdapter.OpenConnection(); mDataAccessAdapter.FetchEntity(...); mDataAccessAdapter.SaveEntity(...); . . mDataAccessAdapter.CloseConnection();

But when I need to create a new table among the DML commands, I understand that I should use either ODP directly (and open a new connection) or DataAccessAdapter.ExecuteActionQuery() (and create a new connection).

  1. Is it true that in the ExecuteActionQuery case I wouldn't have to open the connection? What do the DataAccessAdapter perform behind the scene?

Thats done behind the scenes, yes simple_smile

  1. Why, anyhow, do I have to create a new connection object? Why can't the DataAccessAdapter's connection be used in some way?

You don't need to create your own connection, you can order the DataAccessAdapter to create one for you.

Frans Bouma | Lead developer LLBLGen Pro