Database/DKDB SQL format

From Lanius CMS Wiki

Lanius CMS uses internally a special format for its SQL data; this is the general specification of such format:

  • a DKDB SQL file must be UTF-8 encoded without BOM header;
  • either a PHP, SQL or GZ extension is allowed;
  • the first line of the (eventually uncompressed) file must be like the following
         /* @DKDB 0.4 @GID  5 <?php if (@$my->gid< 5)die; ?> */
  • comments start with /* and end with */, even multi-line (as the SQL standard specifies)
  • each delimited string (through the SQL standard single quote character ') can contain any binary data
  • there are no recognized escape characters, the only recognized escape sequence is that of single quote characters ' which delimits SQL strings; two subsequent single quote characters (hexadecimal \x27\x27) always evaluate to a single quote character

The SQL data is re-encoded (and correctly escaped) for the target database system by Lanius CMS itself; following the above DKDB SQL standard format you will allow maximum portability between different database systems.

Note: the DKDB SQL format is used natively by Gladius DB; strings will be re-encoded for each database system upon import

SQL constraints

In order to avoid incompatibilities it is suggested to use a plain simple syntax as most compliant to SQL92 as possible, but taking in account the following:

  • do not use display lengths (like in int(10))
  • use INTEGER instead of INT and VARCHAR for string types, possibly upper case
  • use the TEXT field for unlimited length strings
  • possibly use FLOAT for floating-point data types
  • use AUTO_INCREMENT for automatically incremented columns (it will be automatically translated into SERIAL for PostgreSQL)
  • do not use JOINs and GROUP BY in SQL queries

Related pages

Personal tools
Create a book
  • Add wiki page
  • Collections help