Releases: SergeyTsalkov/meekrodb
MeekroDB v3.1.3
add dbType()
method, which returns one of these strings: mysql
, sqlite
, pgsql
MeekroDB v3.1.2
Minor bug fixes.
MeekroDB v3.1.1
- ORM Scopes now have a
toArray()
method, useful for functions like array_map() that expect a true array and not an ArrayAccess/Traversable object - Several bug fixes
MeekroDB v3.1.0
Now includes the new MeekroORM object-relational mapper. The classic MeekroDB stuff still works the same.
MeekroDB v3.0.1
Enable the output of parse() to be used in a query or WhereClause with %? or %l
Examples:
$part = DB::parse('username=%s', 'Joe');
$results = DB::query("SELECT * FROM accounts WHERE %?", $part);
MeekroDB v3.0.0
A major release that enables SQLite and Postgres support, by dropping mysqli and transitioning to PDO as a backend.
MeekroDB v2.5.1
A minor release that resolves #102. It fixes some phpdoc comments so VSCode's parser will stop complaining.
MeekroDB v2.5
The main goal for this release is to resolve the problem discussed in #88, where the MySQL connection can time out if you have a long-running script that idles for long enough. MySQL's default wait_timeout
is 8 hours, so I introduced a variable called $reconnect_after
and set it to 4 hours by default. If at least that much time passes between your queries, the script will re-connect to the database before attempting the next query.
Major Changes:
- $reconnect_after -- If at least this many seconds have passed since the last query, re-connect before running the next query. (default: 4 hours)
All Changes:
- update() and delete() can optionally use a hash for the "where" part
- query() returns affected_rows count for non-select queries (it still returns false if the query failed and exception-throwing was disabled via a run_failed hook)
- insert(), insertIgnore(), insertUpdate(), update(), delete() also return affected_rows
- various bug fixes
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.
MeekroDB v2.3.1
Fix a few minor bugs, make compatible with PHP 7.4 with opcache enabled.