TGTable

From Gestinux Wiki
Revision as of 22:05, 17 October 2012 by Tintinux (talk | contribs)
Jump to navigation Jump to search

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
  • 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 !