Hello all,
I managed to compile and install the latest CVS version in BDS 2006. I would like to use the components in a C++ project, and I haven't been able to figure out a few things:
1 - How to programmatically create a new database;
2 - How to programmatically create a new table;
3 - How to programmatically list the existing tables in a database;
4 - If it is possible to work with a statically linked version of SQLite, instead of relying on the dll.
Thanks in advance for any help,
Ken
Newbie - a few doubts
Moderators: gto, cipto_kh, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi, I can ansewer only first three questions as I'm only experienced in using mysql.
1 and 2 : use sql create statements in a tzsqlprocessor. That means, if you realy have to do it from your applications. This kind of stuff is usually done during the implementation of applications and by a dba (or adevelopper) with some database-utility. I know, some (eg. temporary) tables can be very usefull when you can create it from your app. There are some 'problems' when you try to create databases using create database. The first one is that you should be connected to the server before creating a database. And therefore you need access to at least one other database. The second problem could be that your database does not know this statement. The third catch is that create table/database syntax is sometimes database dependent. And that way you lose some portability.
3. There is some ZSQLMetadata Component. Probably that one can help you. If not, you can try the (database dependent) information-statements of your database. eg a select on the information_schema tables of mysql5 or showtables. Just pop them in a query object and open.
4. Is there some SQLite expert on the forum?
I hope I did not lie to much...
Mark
1 and 2 : use sql create statements in a tzsqlprocessor. That means, if you realy have to do it from your applications. This kind of stuff is usually done during the implementation of applications and by a dba (or adevelopper) with some database-utility. I know, some (eg. temporary) tables can be very usefull when you can create it from your app. There are some 'problems' when you try to create databases using create database. The first one is that you should be connected to the server before creating a database. And therefore you need access to at least one other database. The second problem could be that your database does not know this statement. The third catch is that create table/database syntax is sometimes database dependent. And that way you lose some portability.
3. There is some ZSQLMetadata Component. Probably that one can help you. If not, you can try the (database dependent) information-statements of your database. eg a select on the information_schema tables of mysql5 or showtables. Just pop them in a query object and open.
4. Is there some SQLite expert on the forum?
I hope I did not lie to much...
Mark
Merci...mdaems wrote:Hi, I can ansewer only first three questions as I'm only experienced in using mysql.
1 and 2 : use sql create statements in a tzsqlprocessor. That means, if you realy have to do it from your applications. This kind of stuff is usually done during the implementation of applications and by a dba (or adevelopper) with some database-utility. I know, some (eg. temporary) tables can be very usefull when you can create it from your app. There are some 'problems' when you try to create databases using create database. The first one is that you should be connected to the server before creating a database. And therefore you need access to at least one other database. The second problem could be that your database does not know this statement. The third catch is that create table/database syntax is sometimes database dependent. And that way you lose some portability.
3. There is some ZSQLMetadata Component. Probably that one can help you. If not, you can try the (database dependent) information-statements of your database. eg a select on the information_schema tables of mysql5 or showtables. Just pop them in a query object and open.
4. Is there some SQLite expert on the forum?
I hope I did not lie to much...
Mark
The reason for (1) is that the specific app is a fairly simple one with just three tables and the user must be able to create new databases at will. Currently it works (well) with embedded Firebird, but I would like to have a 1-file distribution, that does't rely on dlls.
And may I echo your call for SLite experts?
A bientôt,
Ken
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
I was a little curious what this ZSQLMetadata thing just is, so i did some tests.
I created a new test project and i dropped 4 components on the form.
ZConnection (choose protocol and set db parameters. Connected = true)
ZSQLMetadata (choose connection)
Datasource(set Dataset to Metadata component)
DataGrid(set datasource)
Set everything active. Now you should see some datain the grid. (or an empty dataset. Just play with the MetadataType property of the metadata component. (set active to true after changing the type) mdTables shows table information, but there are plenty of options.
Mark
I created a new test project and i dropped 4 components on the form.
ZConnection (choose protocol and set db parameters. Connected = true)
ZSQLMetadata (choose connection)
Datasource(set Dataset to Metadata component)
DataGrid(set datasource)
Set everything active. Now you should see some datain the grid. (or an empty dataset. Just play with the MetadataType property of the metadata component. (set active to true after changing the type) mdTables shows table information, but there are plenty of options.
Mark