Data Types

Data type-hinting is the means by which SchemafreeSQL can determine the data types of your attributes at run-time.

Data type-hints are specified with the single character (the type) followed by a colon (e.g. 's:' which stands for 'string').

Within SFSQL, a leading dollar sign '$' before the type-hint (e.g. 'SELECT $s:name...') differentiates a SchemafreeSQL attribute from other SQL grammar.

Within a query command, data type-hint prefixes MUST be used.
With a modify command, data type-hint prefixes MAY be used on data types that can be auto-interpreted from their JSON counterpart types, but MUST be used when a data type is SFSQL only (i.e. datetime, time, or blob).


SFSQL Type Hint JSON Type Description Size Limit
stringsstringUTF-8 string4GB
(practically limited by max network packet size)
integerinumber64-bit integer-9223372036854775807 to 9223372036854775807
floatfnumber64 bit floating-point1E-301 to 1E+301
numbernnumberlarge integer or decimalup to 50 digits to the left and 15 digits to the right of decimal. Non-rounding
booleanbbooleanboolean value
datetimeddate+time value
timettime
bloblbinary large object4GB
(practically limited by max network packet size
objectoobjectname-value collection

NOTE 1: it is not recommended to rely on auto-interpretation for attributes whose values may auto-interpret differently (e.g. sometimes looks like an int : 123, sometimes looks like a float: 123E10). This would result in the creation of two different attributes under the same parent, each attribute having the same name but a different type.