picoSQL - Language reference manual


3) Data types


PicoSQL manages the following data types.


CHAR(dimension)
VARCHAR( dimension )

Character data of maximum dimension size. The maximum size allowed is 32767. In the current release, there is no difference between these two types.


NUMERIC(precision[, scale])

A decimal number with precision total digits and with scale of the digits after the decimal points. In the current release the maximum precision is 18.

The space required by an attribute of this kind can be computed by the following formula.

required-space = precision / 2 + 1

where the division is an integer division.


SERIAL

An integer 11 digits long, stored with the same format as a NUMERIC attribute. This number autoincrement itself every INSERT/REPLACE statement execution, starting from 1 and growing by 1. You can assign a predefined value to attributes of this type; if the assigned value is greater than any other in the table, this value became the reference for next insertions.

However, a SERIAL attribute can be modified using an UPDATE statement.


SMALLINT

An integer that requires 2 bytes and can cantain values between -32767 and 32767. The number -32768 is interpreted as NULL.

Warning! number of this type are stored in machine dependent format.


INTEGER
INT

An integer that requires 4 bytes and can cantain values between -2147483647 e 2147483647. The number -2147483648 is interpreted as NULL. INTEGER and INT are synonyms.

Warning! number of this type are stored in machine dependent format.


REAL

A single precision floating point number. It requires 4 bytes.

Warning! number of this type are stored in machine dependent format. The smaller values (FLT_MIN) is interpreted as NULL.


DOUBLE

A double precision floating point number. It requires 8 bytes.

Warning! number of this type are stored in machine dependent format. The smaller values (DBL_MIN) is interpreted as NULL.


DATE

A date. It requires 5 bytes. To specify a data you can use the appropriate escape sequence or also a string in the following format:

'YYYY-MM-DD'


TIME

A time. It requires 5 bytes.To specify a time you can use the appropriate escape sequence or also a string in the following format:

'hh:mm:ss.uuu'


TIMESTAMP

A timestamp. It requires 9 bytes. To specify a timestamp you can use the appropriate escape sequence or also a string in the following format:

'YYYY-MM-DD hh:mm:ss.uuu'


BLOB

A binary large object whose size range from 0 to 2147483648 bytes. Allocation is done in block 1024 bytes long. picoSQL load the full blob in main memory, so you must sure to have enaugh free memory.


CLOB

This type is like the BLOB but it can contain only text data.


Each of these types can contain a conventional value, called NULL, that indicate that the value is unknown or not applicable to the context. When you insert a rows without specifying all values, for example, in the unspecified attributes go the NULL value.


Index Previous Next