MeekroDB v2.4
MeekroDB has had a few weird ideas that made sense in 2011, but make less sense in 2021. The goal of this release is to clean up the worst offenders while preserving backwards compatibility as much as possible.
Major Changes:
- Haphazard error handling has been replaced with a standard policy of just throwing exceptions on all errors.
- Haphazard collection of callbacks have been overhauled into a coherent hooks system.
All Changes:
- Bumped up requirements to PHP 5.3 (up from 5.2).
- DB::lastQuery() returns last query (whether successful or not).
- DB::columnList() now returns more detailed information. Old column-names-only results available as array_keys(DB::columnList($name)).
- DB::parse() lets you access MeekroDB query parser without running queries.
- %% can be used to escape the % character, similar to how printf() does it. Useful for MySQL's DATE_FORMAT(), which uses the % character.
- Added DB::$logfile, which can log all queries and errors to file or screen. DB::debugMode() is deprecated but still available for backwards compatibility.
- Added DB::queryWalk(), a simple way to run queries where the result set is too big for memory and "walk through" the results without loading them all into a giant result array. The previous DB::queryRaw() is deprecated but still available for backwards compatibility.
- Removed DBHelper class-- the verticalSlice() function was added as array_column() in PHP 5.5. reIndex() is pretty useful, but doesn't belong in a database library.
- Removed usenull. DB::insert() will always treat empty string as such, and null as such. Those are different.
- Removed throw_exception_on_error and throw_exception_on_nonsql_error. Exceptions will always be thrown by default on MySQL errors, but you can prevent them from being thrown by adding a run_failed hook which returns false. Exceptions will always be thrown on parser errors, and you can not prevent them from being thrown.
- New callback hooks system to replace the error_handler, nonsql_error_handler, success_handler, and pre_sql_handler, which have all been removed.