The following SQL types, while theoretically standard, are actually taken from the MySQL definitions. The numeric value corresponding to a logical field type may change between databases and interfaces. For interfaces other than the native MySQL interface, the SQLOP_GET_COLDEFS function will translate from the field types used by the particular interface, to the closest match from the list below (allowing for some degree of standardization at the Basic application level). Not all databases support all field types though, so care should be taken when defining schemas to make sure that the desired field types really are supported in the database(s) and/or interface(s) of interest.
MySQL field type |
Value |
Description |
---|---|---|
ASQL_TYPE_TINY |
1 |
TINYINT |
ASQL_TYPE_SHORT |
2 |
SMALLINT |
ASQL_TYPE_LONG |
3 |
INTEGER |
ASQL_TYPE_INT24 |
9 |
MEDIUMINT |
ASQL_TYPE_TINY |
1 |
TINY (character) |
ASQL_TYPE_SHORT |
2 |
SHORT |
ASQL_TYPE_LONG |
3 |
LONG |
ASQL_TYPE_LONGLONG |
8 |
BIGINT |
ASQL_TYPE_DECIMAL |
0 |
DECIMAL or NUMERIC |
ASQL_TYPE_NEWDECIMAL |
246 |
precision math DECIMAL or NUMERIC |
ASQL_TYPE_FLOAT |
4 |
FLOAT |
ASQL_TYPE_DOUBLE |
5 |
DOUBLE |
ASQL_TYPE_BIT |
16 |
BIT |
ASQL_TYPE_TIMESTAMP |
7 |
TIMESTAMP |
ASQL_TYPE_DATE |
10 |
DATE |
ASQL_TYPE_TIME |
11 |
TIME |
ASQL_TYPE_DATETIME |
12 |
DATETIME |
ASQL_TYPE_YEAR |
13 |
YEAR |
ASQL_TYPE_NEWDATE |
14 |
NEWDATE |
ASQL_TYPE_VARCHAR |
15 |
VARCHAR |
ASQL_TYPE_STRING |
254 |
CHAR or BINARY |
ASQL_TYPE_VAR_STRING |
253 |
VARCHAR or VARBINARY |
ASQL_TYPE_BLOB |
252 |
BLOB or TEXT (see max'length) |
ASQL_TYPE_SET |
248 |
SET |
ASQL_TYPE_TINY_BLOB |
249 |
TINY BLOB |
ASQL_TYPE_MEDIUM_BLOB |
250 |
MEDIUM BLOB |
ASQL_TYPE_LONG_BLOB |
251 |
LONG BLOB |
ASQL_TYPE_ENUM |
247 |
ENUM |
ASQL_TYPE_GEOMETRY |
255 |
spatial |
ASQL_TYPE_NULL |
6 |
NULL-type field |
The following field flag symbols are actually taken from the MySQL definitions. As described above for the field types, SQL.SBR will translate from the field flags used by the database/interface to the closest match from the table below, so as to provide a certain degree of isolation at the application level from the differences between databases. But care should be taken to make sure that the flags of interest are actually supported by the database/interfaces of interest.
SQL Field Flags |
Value |
Description |
---|---|---|
SQLF_NOT_NULL |
&h0001 |
field can't be null |
SQLF_PRI_KEY |
&h0002 |
field is part of primary key |
SQLF_UNIQUE_KEY |
&h0004 |
field is part of unique key |
SQLF_MULTIPLE_KEY |
&h0008 |
fieldis part of non-unique key |
SQLF_UNSIGNED |
&h0020 |
field has the UNSIGNED attribute |
SQLF_ZEROFILL |
&h0040 |
field has the ZEROFILL attribute |
SQLF_BINARY |
&h0080 |
field has the BINARY attribute |
SQLF_AUTO_INCREMENT |
&h0200 |
field has the AUTO_INCREMENT attribute |
SQLF_ENUM |
&h0100 |
<< deprecated; use SQL_TYPE_ENUM >> |
SQLF_SET |
&h0800 |
<< deprecated; use SQL_TYPE_SET >> |
SQLF_BLOB |
&h0010 |
<< deprecated; use SQL_TYPE_BLOB >> |
SQLF_TIMESTAMP |
&h0400 |
<< deprecated; use SQL_TYPE_TIMESTAMP >> |
SQLF_NO_DEFAULT_VALUE |
&h1000 |
field has no default value |
SQLF_NUM |
&h8000 |
field is numeric |