CMSB v3.63 Released - ZenDB: Next-Generation Database Library
1 posts by 1 authors in: Forums > CMS Builder
Last Post: November 7, 2023 (RSS)
By Dave - November 7, 2023
Hi everyone,
We're pleased to announce the arrival of the v3.63. We're really excited about this one!
If you've ever had to write (or modify) MySQL code, or if you want to learn, then this will be of special interest to you.
ZenDB: Next-Generation Database Library
ZenDB is a PHP/MySQL database abstraction layer designed to make your development process faster, easier, and more enjoyable. It focuses on ease of use, beautiful code, and optimizing for common use cases while also allowing for advanced and complex queries when needed.
Some notable features of this library include:
- Simple & Intuitive: We mimic MySQL terminology while removing unnecessary complexity, making it easy to learn and use. If you're familiar with MySQL, you'll find this fast and intuitive; otherwise, you'll effortlessly learn MySQL just by using it.
- Flexible Syntax: Database methods can be called in various ways to meet your specific needs, and they can easily adapt to both quick data lookups and complicated queries, all while keeping your code clean and understandable.
- Injection Proof SQL: We've made it impossible to write insecure MySQL code, so you never have to worry about escaping user inputs or accidentally introducing a security vulnerability in your code.
- Automatic HTML-encoding: Along the same lines, we automatically HTML-encode output so you don't have to do that either, with the option to disable it when needed.
- And so much more.
Here's some sample code that shows the general syntax and some of the different ways these functions can work:
// load a record by num
$user = DB::get('users', 123);
// load all users
$users = DB::select('users');
foreach ($users as $user) {
print "$user->name\n"; // outputs html-encoded name
}
// load matching users with sql and positional placeholders (allows for more complex queries)
$users = DB::select('users', "division = ? AND city = ?", "2", "Vancouver");
// load matching users with sql and named placeholders (allows for even more complex queries)
$where = "category = :cat AND city = :city AND age >= :min AND age <= :max AND job_status = :status";
$users = DB::select('users', $where, [
':cat' => 2,
':city' => "Vancouver",
':min' => 21,
':max' => 50,
':status' => 'Full-Time'
]);
We've already integrated this into CMS Builder, and rewritten the cron.php dispatcher to use it. Feel free to give it a try and post any questions
You can find a more detailed document that better describes all the features here:
https://github.com/interactivetools-com/ZenDB/#zendb-phpmysql-database-library
Other CMSB Changes:
- Email Templates: Email templates can now include attachments.
- Hide PHP Errors: If you're logged in to the CMS as an Admin we'll now always show you errors even if "Hide PHP Errors" is enabled
- Hide PHP Errors: Cron job errors will also no longer hide errors when logging or emailing reports to the developer or server admin (who already has full access)
- Developer Log: The "Backtrace" field is now "Call Stack" and shows a user-friendly list of function calls to make it easier to pinpoint errors.
- Developer Log: The initial error file and line reported are from the most likely cause above the cms /lib/ folder, making it easier to track the origin of errors
Here's the complete changelog:
*** November 7, 2023 - Version 3.63 (ZenDB Database Library)
SERVER REQUIREMENTS: PHP 8.0+ and MySQL 5.5+
NEW FEATURES
- ZenDB Database Library - Added new next-generation database library for improved performance and security.
MINOR CHANGES & BUG FIXES
- Email Templates: Email templates can now include attachments.
- Developer Log: Replaced "Backtrace" with sequential "Call Stack" to make debugging faster and easier.
- Hide PHP Errors: Now only applies to web requests and displays full errors for cronjobs and logged-in admins.
- showme() no longer outputs HTML tags when Content-type is "text/plain" (for debugging)
- Security: Automatically remove X-Powered-By: PHP/x.x header to prevent information disclosure
- Programmers: Added new plugin filter 'headers' for adding or modifying headers sent to the browser
- Misc Code and other minor improvements.
You can download the latest version here: https://www.interactivetools.com/order/download.php
Please post any feedback, questions, or bugs you find!
Thanks! :)
interactivetools.com