Usage
How to use it?
For real deployment it's necessary to change the core according to your needs
- some special constructions are always necessary. Fortunatelly the core is
flexible and easily extendable. Right now DL/SQL uses MySQL as its backend.
There're only several calls to DB, changing them is work for few minutes so
porting DL/SQL to let's say PostgreSQL is piece of cake.
API
There're only two API calls:
rpn_init()
clears all the cached values (actually sets the
counted bit to false).
rpn_eval($expression)
evaluates entered DL/SQL expression.
For using DL/SQL interpreter it's necessary to include file
rpnparser.phtml
in your project. For easy implementation I also advise you to include file
include/setup.phtml which contains all the necassary stuff for
connecting to database and setting the directories. Without this file, you'll
have to do all the things yourself!
DB structure
There's only one SQL table with following structure:
CREATE TABLE datastack
(
ds_id INTEGER AUTO_INCREMENT PRIMARY KEY,
ds_type SMALLINT DEFAULT '0' NOT NULL,
ds_kvant_type SMALLINT DEFAULT '0' NOT NULL,
ds_name VARCHAR(255) DEFAULT '' NOT NULL,
ds_num_val FLOAT DEFAULT '' ,
ds_string_val TEXT DEFAULT '' ,
ds_text_data TEXT DEFAULT '' ,
ds_counted TINYINT DEFAULT '0' NOT NULL,
INDEX (ds_type),
INDEX (ds_kvant_type),
INDEX (ds_name),
INDEX (ds_counted)
);
ds_id is ID
ds_type contains type of record - Value/Expression/Function
ds_kvant_type contains its quantity type - Value/List of values
ds_name contains name of record
ds_num_val contains numeric value of record (if kvant_type=Value)
ds_string_val contains numeric value of record (if kvant_type=List)
ds_text_data contains function/expression definition (if type=Exp/Func)
ds_counted is set to 1 (True) when there's cached value
Filling the DB
You can use included administration interface in directory
[YOUR_DLSQL_DIR]/admin/, which
was generated in
PaRADiSo 2.
Testing
You can test the engine using script
[YOUR_DLSQL_DIR]/index.phtml, some of
recommended test are included in the default SQL dump found in
defaults/dlsql.sql.