CreateTable method
|
Previous Top Next |
· | For one thing, you can now design your complete mysql database at designtime in Delphi/Kylix. When you connect these, the whole database and tablestructures will be created for you (if the appropriate options have been selected)
|
· | Another possibility is that you can now distribute your application without having to worry about the target installation database structure, the MyComponents will create the whole database structure for you if it doesn't exist on the target mysql server, exactly as your application expects it.
|
TFieldDef.DataType
|
MySQL column types equivalent
|
ftAutoInc
|
int not null auto_increment
|
ftSmallInt
|
smallint [not null]
|
ftWord,ftInteger
|
int [not null]
|
ftLargeInt
|
bigint [not null]
|
ftFloat
|
float [not null]
|
ftCurrency
|
decimal(Precision,Size) [not null] // Parameters replaced with TFieldDef properties
|
ftDate
|
date [not null]
|
ftTime
|
time [not null]
|
ftDateTime
|
datetime [not null]
|
ftTimestamp
|
timestamp [not null]
|
ftString,ftWideString,ftFixedChar,ftMemo,ftMemo,ftVariant,ftUnknown
|
Size<=255 - If ftFixedChar or faFixed then "char(Size) [not null]" Else "varchar(Size) [not null]"
255<Size<=65535 - text [not null] 65535<Size<=16777215 - mediumtext [not null] Size>16777215 - longtext [not null] |
ftBlob,ftGraphic,ftBytes,ftVarBytes
|
Size<=255 - tinyblob [not null]
255<Size<=65535 - blob [not null] 65535<Size<=16777215 - mediumblob [not null] Size>16777215 - longblob |
ftBoolean
|
tinyint(1) [not null]
|
All other types
|
varchar(255) [not null]
|
· | if ixPrimary is specified for the TIndexDef, then this becomes " primary key ({Fields})"
|
· | if ixUnique is specified for the TIndexDef, then this becomes " unique index {Name} ({Fields})"
|
· | Else it becomes " index {Name} ({Fields semicolon/comma seperated})"
|