Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site


Data Types


The C acronym for each SQL data type is listed in the below table.

Data type
SQL data type
MIMER_BINARY
BINARY
MIMER_BINARY_VARYING
BINARY VARYING
MIMER_BLOB
BINARY LARGE OBJECT
MIMER_BOOLEAN
BOOLEAN
MIMER_CHARACTER
CHARACTER
MIMER_CHARACTER_VARYING
CHARACTER VARYING
MIMER_CLOB
CHARACTER LARGE OBJECT
MIMER_DATE *
DATE
MIMER_DECIMAL *
DECIMAL
MIMER_FLOAT *
FLOAT(p)
MIMER_INTEGER
INTEGER(p)
MIMER_INTERVAL_DAY *
INTERVAL DAY
MIMER_INTERVAL_DAY_TO_HOUR *
INTERVAL DAY TO HOUR
MIMER_INTERVAL_DAY_TO_MINUTE *
INTERVAL DAY TO MINUTE
MIMER_INTERVAL_DAY_TO_SECOND *
INTERVAL DAY TO SECOND
MIMER_INTERVAL_HOUR *
INTERVAL HOUR
MIMER_INTERVAL_HOUR_TO_MINUTE *
INTERVAL HOUR TO MINUTE
MIMER_INTERVAL_HOUR_TO_SECOND *
INTERVAL HOUR TO SECOND
MIMER_INTERVAL_MINUTE *
INTERVAL MINUTE
MIMER_INTERVAL_MINUTE_TO_SECOND *
INTERVAL MINUTE TO SECOND
MIMER_INTERVAL_MONTH *
INTERVAL MONTH
MIMER_INTERVAL_SECOND *
INTERVAL SECOND
MIMER_INTERVAL_YEAR *
INTERVAL YEAR
MIMER_INTERVAL_YEAR_TO_MONTH *
INTERVAL YEAR TO MONTH
MIMER_NCHAR
NATIONAL CHARACTER
MIMER_NCHAR_VARYING
NATIONAL CHARACTER VARYING
MIMER_NCLOB
NATIONAL CHARACTER LARGE OBJECT
MIMER_T_BIGINT
BIGINT
MIMER_T_DOUBLE
DOUBLE PRECISION
MIMER_T_FLOAT
FLOAT
MIMER_T_INTEGER
INTEGER
MIMER_T_REAL
REAL
MIMER_T_SMALLINT
SMALLINT
MIMER_TIME *
TIME
MIMER_TIMESTAMP *
TIMESTAMP

The data types marked with an asterisk (*) are not supported by the Micro API's data input and data output routines. To use these data types, convert the data using the SQL function CAST.

The following table describes which API calls may be used to set or get parameters and column values of the corresponding SQL data type.

SQL data type
Routines
BIGINT
BINARY
BINARY LARGE OBJECT
BINARY VARYING
BOOLEAN
CHARACTER
CHARACTER LARGE OBJECT
CHARACTER VARYING
DOUBLE PRECISION
INTEGER
NATIONAL CHARACTER
NATIONAL CHARACTER LARGE OBJECT
NATIONAL CHARACTER VARYING
REAL
SMALLINT

Data types which do not have a corresponding manipulation method according to the above table must be explicitly casted to a data type which does.

CAST examples

For example, when fecthing data, if the SQL underlying data type of the column DATE_COLUMN is DATE, the following query can be used to cast the DATE to a string:

 select cast(DATE_COLUMN as CHARACTER(16)) from DATE_TABLE;
 

Which will return a date literal, i.e. on the format DATE'YYYY-MM-DD'. To extract just the YYYY-MM-DD part, the substring function can be used:

 select substring(cast(DATE_COLUMN as CHARACTER(16)) from 6 for 10)
 from DATE_TABLE;
 

Correspondingly, when inserting data the following insert statement would perform the reverse cast:

 insert into DATE_TABLE values (cast(cast(? as CHARACTER(10)) as date));

Detecting Data Types at Run-time

If the data type of a column or parameter is not known until runtime it is possible to detect them and dynamically choose which getter or setter function to use. For this purpose the functions MimerColumnType and MimerParameterType are used to obtain the type of a column or parameter.

A range of macros may be used to determine which getter/setter which matches the datatype obtained from MimerColumnType or MimerParameterType. These are:

Macro
Description
 MimerIsBinary(t)
Will yield true if the type (t) can be accessed or manipulated using MimerGetBinary or MimerSetBinary.
 MimerIsBlob(t)
Will yield true if the type (t) can be accessed or manipulated using MimerGetBlobData or MimerSetBlobData.
 MimerIsBoolean(t)
Will yield true if the type (t) can be accessed or manipulated using MimerGetBoolean or MimerSetBoolean.
 MimerIsClob(t)
Will yield true if the type (t) can be accessed or manipulated using MimerGetNclobDataC or MimerSetNclobDataC.
 MimerIsDouble(t)
Will yield true if the type (t) can be accessed or manipulated using MimerGetDouble or MimerSetDouble.
 MimerIsFloat(t)
Will yield true if the type (t) can be accessed or manipulated using MimerGetFloat or MimerSetFloat.
 MimerIsInt32(t)
Will yield true if the type (t) can be accessed or manipulated using MimerGetInt32 or MimerSetInt32.
 MimerIsInt64(t)
Will yield true if the type (t) can be accessed or manipulated using MimerGetInt64 or MimerSetInt64.
 MimerIsString(t)
Will yield true if the type (t) can be accessed or manipulated using MimerGetString, MimerGetStringC, MimerSetString or MimerSetStringC.


Mimer
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
info@mimer.se
Mimer SQL Documentation TOC PREV NEXT INDEX