SQLEngine a simple sql engine that provides data history log, transparent insert_id`s and (partial) compatibility between various database systems.
Although I agree database independence is rather an utopic goal, I am starting to believe that nowadays, with so much CPU / RAM power at our disposal, a DB can be efficiently used for its original basic functions, and leave all the hard work on the application itself. This can release a harsh comment from some guys but maybe we just don't need to be so different when all we seek is a fast, reliable, all-mighty open source software that would run on as many configurations as possible.
SQLEngine is part of a larger "rapid development framework".
If you can contribute in any way, please contact me. Suggestions are welcome. Criticism is best.
INSTALLATION:
As I could not find a way to create folders on phpclasses.net, please be sure to have the following file structure before you test this class:
- dbcontext
- dbconnect.inc.php
- SQLEngine.class.php
- Logger.class.php
- log (please set permissions to a+r so that web server can write in this folder)
- COPYING
- datahistory.php
- example.php
- license.txt
- readme.txt
- version
Currently implemented functions:
* SQLEngine::CHECK_CREATE_TABLE provides an easy way to create all tables and relations required to automatically record record id, author, date and history of all changes performed upon a row of data. All you need to provide is a regular SQL formatted somehow to allow easy parsing (see example.php)
* SQLEngine::EXEC_QUERY keeps track of everything a record needs to be properly identified and monitored: transparent insert_id, author, date and history row.
* SQLEngine::NEXT returns a formated PEAR row with all keys changed to lowercase for compatibility between all DB systems
* SQLEngine::COMPAT_QUERY provides an alternative compatible sql query when no history is necessary for that data
* Logger::LOG_SQL provides an easy way to log all SQL activities to a file
* Logger::LOG_EVENT provides an alternative log file to record logical operations
Try the example.php and look through the code to understand if it can be useful to you.
Current limitations:
* INSERT and DELETE queries may be issued for one record at a time. "INSERT INTO table VALUES (a, n), (b, m)" will not work in this version. Also "DELETE * FROM table" will not record all deletions into data history tables.
* SQL Compatibility is still very basic
* There are several global variables of which I'll try to get rid of in later versions |