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


10.31.3.2 Writing to the database

When writing data to the database the following SQL datatypes are supported.

SQL_CHAR, SQL_VARCHAR etc.

A list of character codes, or a list of atoms.

For backwards compatibility only, an atom is also accepted, but note that the atoms null and [] have special meaning (as SQL null value and empty code list, respectively) and more atoms with special meaning may be introduced in the future. For compatibility with some ODBC drivers, the integer 0 and 1 are allowed, meaning "0" and "1".

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 or a small integer.

SQL_DATE

A term date(Year, Month, DayOfMonth), as above.

SQL_TIME

A term time(Hour, Minute, Second), as above.

SQL_TIMESTAMP

A term timestamp(Year, Month, Day, Hour, Minute, Second, Fraction), as above.

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.

if a value is out of range for the corresponding SQL type, e.g. a too large integer for SQL_SMALLINT, the result is undefined. 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.