Re: [h2] How to create table programming in version 2 ?

2022-06-06 Thread Andreas Reichel
Greetings.

As  Noel pointed out, for the H2 project this might be internal API
subject to change without notification.

However, https://github.com/JSQLParser/JSqlParser and https://www.jooq.org/
 provide such an API, which will De-Parse into a SQL, which can be
executed in H2 (or any other RDBMS).

This way you would be independent from the particular SQL Flavour
and/or RDBMS.

Cheers and good luck.
Andreas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/1f5e2bc7acc67be0cae418ebec0d613ec30dce00.camel%40manticore-projects.com.


Re: [h2] How to create table programming in version 2 ?

2022-06-06 Thread Noel Grandin
You're using purely internal functions, which is always going to be problematic, because then you're never sure if you 
have obeyed all the invariants which the code needs.


Why not just call "CREATE TABLE" using the normal JDBC API?


--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/b5e08a8e-5b34-5103-2144-33dd192388d4%40gmail.com.


[h2] How to create table programming in version 2 ?

2022-06-06 Thread Van Bruce
hi,

I have a requirement for code to create tables dynamically, the code works 
fine in H2 version 1.x 

final Session session = connection.getSession();
final Database database = session.getDatabase();
final Schema schema = database.getSchema(session.getCurrentSchemaName());
final CreateTableData createTableData = new CreateTableData();
createTableData.schema = schema;
createTableData.tableName = tableName;
createTableData.id = database.allocateObjectId();
createTableData.temporary = false;
createTableData.globalTemporary = false;
createTableData.persistIndexes = false;
createTableData.persistData = false;
createTableData.create = true;
createTableData.session = session;

However in 2.x,  database cannot get directly from session.

Is there doc show how to solve or someone can help me 

thx in advance

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/d494c369-fcca-4654-a7bd-f30359b94079n%40googlegroups.com.