Previous Table of Contents

6. Supported SQL

Currently, XBSQL supports the following:

XBSQL supports aggregate functions, group by, and having. Note, however, that there are currently no sanity checks (hence, select n, sum(n) is valid. The results of such a query are not defined.

The following aggregate functions are available:

The following general functions are implemented:

Since XBase has no notion of null values, nullif is only defined for text arguments; the result is the value of the first argument unless it is an empty string, in which case the result is the value of the second argument.

Expressions e1 are currently fairly limited, just some basic arithmetic and string concatenations, plus equality/inequality, greater/less greater-or-equal/less-or-equal. like is also supported using either % as the wildcard character, or UNIX shell-like wildcards, and with (by default) case-insensitive matching.

Available column types for create column specifications are as below. A blob is binary data; XBase itself does not have a time data type.

The SQL parser accepts as column names any non-empty string of alphanumeric characters, or the underscore _ character, provided that at least one character a alphabetic or the underscore. To allow for column names in exising table which are the same as the SQL keywords, or which contain a space, the notation [name] can be used, hence select [The Date], [The Time] from MyTable is syntactically valid.

XBase files all contain fixed-width columns, with the exception of the blob type, which maps to a memo column. The first three cases can therefore have (width) appended. Individual columns can be indexed, for example, (...., ident int(10) index, ...). The date type will default to a width of 8 if the width is not specified or is specified as zero (since XBase stores dates in the format YYYYMMDD).

Memo fields are always created with a notional width of 10, as required by the XBase specification. This works around a minor bug in xbase-2.0.0.

Unsupported SQL includes