Next: , Previous: , Up: Top   [Index]


3 Representation in Octave of types defined by SQL

For types specific to database implementations, see Postgresql data types.

The last column indicates whether the SQL type is automatically deduced by this packages functions from the representation of the data in Octave. If not, the correct SQL type must be specified by the user if the data is sent from Octave to the database.

The listed names of SQL data types are those which are used by the functions of this package. They are sometimes different from the original SQL typenames, e.g. int2, int4, and int8 instead of smallint, integer, and bigint, respectively. If not obvious, the original SQL typename is given in parantheses.

SQLOctaveauto
boollogical scalaryes
bytea (variable length binary string)array of uint8, one-dimensional if converted from SQL datayes
float8double scalaryes
float4single scalaryes
varcharstringno
bpchar (char)stringno
int2int16 scalaryes
int4int32 scalaryes
int8int64 scalaryes
timestamp8-byte-time-value (see below), positive or negative difference to 2000-01-01 00:00no
timestamptzas timestampno
time8-byte-time-value (see below)no
timetz2-element cell array with 8-byte-time-value (see below, time of day) and int32 scalar (time zone in seconds, negative east of UTC)no
dateint32 scalar, positive or negative difference to 2000-01-01no
interval3-element cell array with 8-byte-time-value (see below), int32 (days), and int32 (months)no
bitstructure with fields bitlen (int32, number of valid bits) and bits (uint8 array, 8 bits per entry, first entry contains the leftmost bits, last entry may contain less than 8 bits)no
varbitas bityes
xmlstringno
any arrayStructure with fields data (holding a cell-array with entries of a type corresponding to the SQL element type), ndims (holding the number of dimensions of the corresponding SQL array, since this can not be deduced from the dimensions of the Octave cell-array in all cases), and optionally (but always present in returned values) lbounds (a row vector of enumeration bases for all dimensions, default is ones (1, ndims); enumeration bases different from 1 are supported e.g. by Postgresql). Array elements may not correspond to arrays in SQL (use additional dimensions for this), but may correspond to composite types, which is allowed to lead to arbitrarily deep nesting.no
any composite type (row type)One-dimensional cell-array with entries of types corresponding to the respective SQL types. Entries may also correspond to an array-type or composite type; this is allowed to lead to arbitrarily deep nesting.no

8-byte-time-value: int64 scalar, representing microseconds, if server is configured for integer date/time; double scalar, representing seconds, if server is configured for float date/time. If the type (integer or float) of an input Octave variable for an 8-byte-time-value does not match the server configuration, there is no automatic conversion but an error is thrown.

Octaves NA corresponds to an SQL NULL value (not NaN, which is interpreted as a value of a float type!).


Next: , Previous: , Up: Top   [Index]