Next: , Up: ODBC Datatypes   [Contents][Index]


10.26.3.1 Reading from the database

When reading data from the database the following datatypes are supported, with conversion to the corresponding prolog datatypes.

SQL_CHAR, SQL_VARCHAR etc.

A list of character codes.

SQL_BIT

The integer 0 for false, or 1 for true.

SQL_INTEGER, SQL_TINYINT, SQL_SMALLINT, etc.

An integer.

SQL_REAL, SQL_DOUBLE, SQL_FLOAT

A floating point number.

SQL_DATE

A term date(Year, Month, DayOfMonth), with one-based integer arguments. E.g. date(2012,10,22) means October 22, 2012.

SQL_TIME

A term time(Hour, Minute, Second) with one-based integer arguments. E.g. time(22,11,5) means eleven minutes and five seconds past ten pm.

SQL_TIMESTAMP

A term timestamp(Year, Month, Day, Hour, Minute, Second, Fraction) where the arguments have the same meaning as for SQL_TIME and SQL_TIMESTAMP and Fraction means fractional nanoseconds past, as an integer.

the SQL null value

The atom null.

SQL_BINARY and other binary types
SQL_INTERVAL_HOUR and other interval types
SQL_UTCTIME and SQL_UTCDATETIME

Currently not supported.

Note that atoms with names that start with an upper case letter, like SQL_CHAR must be quoted in Prolog, e.g. 'SQL_CHAR'.


Send feedback on this subject.