PHP Classes

SQL Engine: Execute common database access SQL queries

Recommend this page to a friend!
  Info   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 559 All time: 5,456 This week: 455Up
Version License PHP version Categories
sqlengine 0.9GNU General Publi...4.1.2Databases


This class is a database access wrapper that can execute common SQL queries.

It can execute SELECT, INSERT, UPDATE and DELETE queries. It takes care of emulating auto-increment fields if these are not supported, using sequences.

It can also create a new database table or alter its fields if the table already exists.

The executed queries can be logged using a separate class.

Picture of Marian VASILE
Name: Marian VASILE <contact>
Classes: 1 package by
Country: Romania Romania
Age: ???
All time rank: 315362 in Romania Romania
Week rank: 271 Up5 in Romania Romania Up


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, please be sure to have the following file structure before you test this class: - dbcontext - - 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

  Files folder image Files  
File Role Description
Accessible without login Plain text file COPYING Doc. Copyright notice
Accessible without login Plain text file datahistory.php Example example datahistory script to show record data history
Accessible without login Plain text file Conf. DB connection script - needs to be place in dbcontext folder
Accessible without login Plain text file example.php Example example - using SQLEngine
Accessible without login Plain text file license.txt Lic. GNU GPL
Plain text file Logger.class.php Class Logger class - needs to be placed in dbcontext folder
Accessible without login Plain text file readme.txt Doc. readme file
Plain text file SQLEngine.class.php Class SQLEngine class - needs to be placed in dbcontext folder
Accessible without login Plain text file version Doc. version file

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:5,456
This week:455Up