The datatypes that relational DBMSes use are different from those Dylan uses. The SQL-ODBC library provides classes that represent these low-level relational datatypes, along with a table that defines the mapping from these datatypes to Dylan datatypes (Table 1.6, page 38). The methods on the record class consult this mapping when performing data coercion.
The datatypes of host variables are limited to the Dylan datatypes that appear in Table 1.6. Host variables come in two flavors: read and write. Host variables appearing in an into clause of an SQL SELECT statement are write parameters, and all other host variables are read parameters.
DBMS type | SQL type | Dylan type |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|
| |
|
| |
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
To retrieve integer elements from databases that may contain more than 30-bit data, you must use the generic-arithmetic library or a run-time error will occur. The Dylan SQL-ODBC library must also be prepared.
Example library and module definition:
define library sql-example use functional-dylan; use generic-arithmetic; use sql-odbc; export sql-example; end library; define module sql-example use generic-arithmetic-functional-dylan; use sql-odbc; end module;