Home Blog Documentation Download Features Forum Users Contact
Documentation

Database

Database functions

cms_db_auto_name

Returns automatically generated node's name using node's title and cms_sanitize from last insert operation. This should be called after cms_db_insert.

cms_db_connect

Connects to the database using settings from config.php

cms_db_count

Selects number of records within given contstraint

cms_db_create

Creates the database structure using lib/schema.sql file

cms_db_delete

Executes SQL DELETE with given constraint

cms_db_ensure

Reports fatal DB error if the param is non-TRUE

cms_db_escape

Escapes PHP's value for SQL usage depending on the value's type

cms_db_fatal

Reports fatal DB error, with SQL dump and custom message, and stops the execution

cms_db_get_global

Gets global variable from `global` table

cms_db_id

Ensures that array is proper node's PHP representation (starting at index 1). Adds optionally element into the end of the array.

cms_db_insert

Executes SQL INSERT inserting new row into specified table and returns the ID of the row For nodes it finds and prepares new ID hash using parent's ID specified inside $items[id]

cms_db_query

Executes specified SQL query for the current DB link

cms_db_select

Produces SQL SELECT query for specified fields within given contstraints, and returns results as array of hashes

cms_db_serialize_id

Serialize node ID into MySQL compatible format (hexadecimal) using 16-bit unsigned words, i.e.

cms_db_setup

Sets up the initial sample database using lib/schema.sql and sample entries

cms_db_tuple

Joins two values with space

cms_db_unserialize_id

Convert back MySQL (hex) ID representation back to array

cms_db_update

Executes SQL UPDATE with given constraint and specified fields to update

cms_db_where

Produces SQL WHERE clause for SELECT and UPDATE, i.e.:

cms_log

Logs the parameter into internal log buffer, beaking with new-line, and returns current log buffer