TGTable: Difference between revisions
Jump to navigation
Jump to search
Created page with "TGTable is not used to store or retrieve data. This component is only used to store table metadata : description, fields, index, constraints." |
No edit summary |
||
| Line 2: | Line 2: | ||
This component is only used to store table metadata : description, fields, index, constraints. | This component is only used to store table metadata : description, fields, index, constraints. | ||
== To create a new table == | |||
This is for a new functionnality in the application (only in the trunk version). | |||
* Create the table and all it's index and constraints with MySql Query Browser or any other MySql client (not PostgreSQL). | |||
**The following types can be used only. If other types are necessary, some development must be done. | |||
*** Integer Autoinc | |||
*** Integer, smallint | |||
*** Varchar | |||
*** Timestamp | |||
*** Date, Datetime | |||
*** Blob | |||
**Always start with an '''Id''' field, Autoinc and Primary key | |||
**Always end with an '''UpdateDate''' field, ''TimeStamp default current_timestamp on update current_timestamp'' | |||
* Create a TGTable object in Datamodule, with connexion set to open the previous database. | |||
** Create a new computed field AutoInc, correct it's Name (bug), set it Required and set the field to fkData. | |||
** Add '''all''' other fields. | |||
** Write the index and constraint instructions in the property ''Properties'' of the TGTable. | |||
** In DataModule1.DbAfterConnect event, add to TGTable.Check. | |||
* Test it and check the structure and data created in the query browser ! | |||
Revision as of 23:05, 17 October 2012
TGTable is not used to store or retrieve data.
This component is only used to store table metadata : description, fields, index, constraints.
To create a new table
This is for a new functionnality in the application (only in the trunk version).
- Create the table and all it's index and constraints with MySql Query Browser or any other MySql client (not PostgreSQL).
- The following types can be used only. If other types are necessary, some development must be done.
- Integer Autoinc
- Integer, smallint
- Varchar
- Timestamp
- Date, Datetime
- Blob
- Always start with an Id field, Autoinc and Primary key
- Always end with an UpdateDate field, TimeStamp default current_timestamp on update current_timestamp
- The following types can be used only. If other types are necessary, some development must be done.
- Create a TGTable object in Datamodule, with connexion set to open the previous database.
- Create a new computed field AutoInc, correct it's Name (bug), set it Required and set the field to fkData.
- Add all other fields.
- Write the index and constraint instructions in the property Properties of the TGTable.
- In DataModule1.DbAfterConnect event, add to TGTable.Check.
- Test it and check the structure and data created in the query browser !