Delphi数据类型与各数据库数据类型对比如下表,如有具体说明见表中脚注:
Delphi Type |
Oracle Types |
SQL Server Types |
MySQL Types [1] |
InterBase Types |
PostgreSQL Types |
SQLite Types |
ftSmallint |
NUMBER(p, 0)[2] |
SMALLINT |
TINYINT(M) (M > 1) |
SMALLINT |
SMALLINT |
TINYINT |
ftWord |
- |
TINYINT |
TINYINT(M) UNSIGNED (M > 1) |
- |
- |
- |
ftInteger |
NUMBER(p, 0)[2] |
INT |
MEDIUMINT |
INTEGER |
INTEGER |
INTEGER |
ftLargeint |
NUMBER(p, 0)[2] |
BIGINT |
BIT |
BIGINT |
BIGINT |
BIGINT |
ftFloat |
NUMBER(p, s)[2] |
DECIMAL(p, s)[3] |
DECIMAL(p, s)[3] |
NUMBER(p, s)[3] |
DECIMAL[3] |
DECIMAL(p, s)[3] |
ftBCD |
NUMBER(p, s)[2] |
DECIMAL(p, s)[3] |
DECIMAL(p, s)[3] |
DECIMAL(p, s)[3] |
DECIMAL[3] |
DECIMAL[3] |
ftFMTBcd |
NUMBER(p, s)[2] |
DECIMAL(p, s) |
DECIMAL(p, s)[3] |
DECIMAL(p, s)[3] |
DECIMAL[3] |
DECIMAL[3] |
ftCurrency |
- |
MONEY |
- |
- |
MONEY |
MONEY |
ftBoolean |
- |
BIT |
BOOLEAN |
BOOLEAN |
BOOLEAN |
|
ftString |
VARCHAR2 |
CHAR |
CHAR |
CHAR |
CHAR |
|
ftWideString |
NCHAR |
|||||
ftMemo |
TEXT |
TINYTEXT |
BLOB TEXT |
TEXT |
TEXT |
|
ftWideMemo |
NTEXT[11] |
|||||
ftOraClob |
CLOB |
- |
- |
- |
- |
- |
ftBlob |
LONG RAW |
IMAGE |
TINYBLOB |
BLOB BINARY |
BYTEA |
BLOB |
ftOraBlob |
BLOB |
- |
- |
- |
LARGE OBJECT |
- |
ftBytes |
- |
BINARY |
BINARY |
- |
- |
- |
ftVarBytes |
RAW |
VARBINARY |
VARBINARY |
CHAR |
- |
BINARY |
ftDate |
- |
- |
DATE |
DATE |
DATE |
DATE |
ftDateTime |
DATE |
DATE |
DATETIME |
TIMESTAMP |
TIMESTAMP |
TIMESTAMP |
ftTime |
- |
- |
TIME |
TIME |
TIME |
TIME |
ftTimeStamp |
TIMESTAMP |
- |
- |
- |
- |
- |
ftCursor |
REF CURSOR |
- |
- |
- |
REFCURSOR |
- |
ftGuid |
- |
UNIQUEIDENTIFIER |
- |
- |
- |
- |
ftVariant |
- |
SQL_VARIANT |
- |
- |
- |
- |
NOT SUPPORTED |
BFILE |
CURSOR |
- |
- |
- |
- |
[1] – 如果FieldsAsString 选项被设置 True,则除BLOB和TEXT数据类型外,全部做为ftString来处理
[2] – Oracle NUMBER数据类型与Delphi数据类型对应方式:
if scale equals zero, provider checks values of the specific options to choose the correct Delphi type in the following order:
1.1 field precision is less or equal Precision Smallint (default is 4) - uses ftSmallint;
1.2 field precision is less or equal Precision Integer (default is 9) - uses ftInteger;
1.3 field precision is less or equal Precision LargeInt (default is 18) - uses ftLargeint;
if scale is greater than zero, the appropriate Delphi type is chosen using the following sequence of rules:.
2.1 field precision is less or equal PrecisionFloat (default is 0) - uses ftFloat;
2.2 EnableBCD is True and field precision, scale is less or equal PrecisionBCD (default is 14,4) - uses ftBCD;
2.3 EnableFMTBCD is True and field precision, scale is less or equal PrecisionFMTBCD (default is 38,38) - uses ftFMTBCD;
2.4 uses ftFloat.
[3] - The appropriate Delphi type is chosen using the following sequence of rules:
EnableBCD is True and field precision, scale is less or equal 14,4 - uses ftBCD;
EnableFMTBCD is True - uses ftFMTBCD;
uses ftFloat.
[4] - If the EnableBoolean option is True
[5] - If the RawAsString option is True
[6] - If the BinaryAsString is True
[7] - If the UseUnicode option is True, all server types mapped to ftString will be mapped to ftWideString.
[8] - If the LongStrings option is False, and the field length is greater than 255, all server types mapped to ftString will be mapped to ftMemo.
[9] - For all Delphi versions prior to BDS 2006.
[10] - If the UseUnicode option is True, in BDS 2006 and later versions all server types mapped to ftMemo will be mapped to ftWideMemo.
[11] - For BDS 2006 and higher IDE versions.