zDbmsBase

This is the base class of zoglair database drivers. It defines all methods required for persistent I/O operations, as well as a few implementation specific stubs. Methods must conform to the ANSI92 standard.

It should be noted that there is no provision for raw (~arbitrary) sql statements. All CRUD and SELECT operations are made through related wrappers (~facades). For example, instead of using something like:

$ROW = $zDbms->sql("SELECT * FROM user WHERE id=1");

... the following is used:

$ROW = $zDbms->select("user", 1);

A descendant of this class is instantiated as the globally available $zDbms object, based on the “plugin” setting in zoglair.cfg.php ($Z_DOM).

Descendants should use their constructor to connect/select a database, plus define actual library calls under the “z_cmd” property key. Zoglair will pass all necessary information, as per zoglair.cfg.php settings.

Returns error information about the last failed query. A query can fail either at the model level (zDataBase) or the DBMS level (zDbmsBase). Specifically, before a ROW gets inserted or updated, $zDbms asks the table to validate it. This is called “fixing”, and it is implemented through a call to fix_row(). If that method returns an error, this is saved under the “z_fix” key (see below) and the SQL statement is aborted. Otherwise, it is sent to the DBMS, which can itself respond with an error, too.

[stub] Qualifies a column name, so that there is no clashing with keywords and/or an extended character set is accepted. This is implementation depended. For example, MySQL uses backticks for identifier qualification.