Database creation

Forum for posting problems using QxOrm library

Database creation

Postby Kai78 » Sun Apr 26, 2015 10:03 pm

Hi
I am new to QxOrm and I am impressed by the extent of this class library.
I want to create a database and tables by QxOrm but haven't found a way how to create a database.
I saw that QxSqlDatabase has a method createDatabase but it is private.
How can I create a database via QxOrm (mySql)? I haven't found any hint in the tutorials.
When I create a table does it only get created if it does not already exist?
And is there any way on how to get to know this class library better. Unfortunately in the doxygen documentation the methods aren't very well described (just code).
I would be very grateful for answers.
Thank you.
Kai78
 
Posts: 1
Joined: Sun Apr 26, 2015 9:47 pm

Re: Database creation

Postby qxorm » Mon Apr 27, 2015 7:36 am

Hello,

I am new to QxOrm and I am impressed by the extent of this class library.

Thx !

I want to create a database and tables by QxOrm but haven't found a way how to create a database.
I saw that QxSqlDatabase has a method createDatabase but it is private.
How can I create a database via QxOrm (mySql)? I haven't found any hint in the tutorials.

More details in the FAQ here : http://www.qxorm.com/qxorm_en/faq.html#faq_230
So to create your tables, I would recommend to :
- use QxEntityEditor to generate your database schema (create tables) and C++ source code
- or use a tool dedicated to your SGBD (and then you can import the database schema in QxEntityEditor to generate source code if you want)

As it is written in the FAQ, there is the qx::dao::create_table function provided b QxOrm library.
But this function should be used only for prototypes or samples (works only with SQLite, should work with MySQL too).

When I create a table does it only get created if it does not already exist?

If you use QxEntityEditor : yes !
With the feature "Tag project state" (menu action) : you can freeze a version :
- first version : all tables are created
- use "Tag project state" feature
- second version : create new tables if necessary + add/remove columns in tables already exists, etc...

And is there any way on how to get to know this class library better. Unfortunately in the doxygen documentation the methods aren't very well described (just code).

I would recommend to try QxEntityEditor : it could be very useful to know how to implements some features, because it generates automatically C++ source code (or go to C++ preview tab).
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 9 guests

cron