Dmitry Koterov (dmitry_koterov) wrote in php,
Dmitry Koterov
dmitry_koterov
php

DbSimple: need your opinion

Recently I translated into English one of my old project, DbSimple (LGPL). It is a DB abstraction library for PHP which could work with MySQL, PostgreSQL, FireBird. The main idea is extremely simple interface: everything which may be done automatically is realized so in DbSimple, and code remains quite readable.

It would be great if your comment this library (and possibly try). For my projects this library simplifies the work very much, maybe it will be useful for others...

Some key features:
  • Conditional macro-blocks in SQL body ({}-blocks), which allow to dynamically generate even very complex queries without detriment to code readability.
  • Caching of query results (if necessary).
  • Different fetch methods (as column, as 2d array, as key-based multidimension array, as tree etc.).
  • Supports various placeholder (query arguments) types: list-based, associative, identifier-based etc.
  • Supports operation "select + count total number of resulting rows" (for data displayed page-by-page).
  • Functions for direct fetching: all result rows, one row, one column, one cell, associative array, multi-dimensional associative array, linked tree etc.
The most interesting synopse (macro-blocks, placeholders, select one page with total counting):

$rows = $DB->selectPage($totalNumberOfRows, '
SELECT *
FROM goods
WHERE
category_id IN(?a)
{ AND activated_at > ? }
LIMIT ?d, ?d
',
$categoryIds,
(empty($_POST['activated_at'])? DBSIMPLE_SKIP : $_POST['activated_at']),
$pageOffset, $pageSize
);

Other synopsis are at http://en.dklab.ru/lib/DbSimple/#list1
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments