WinBinder also adds a set of database wrapper functions written in PHP.
These functions are simple wrappers around the SQLite and MySQL functions. They are not meant to replace the database functions, but they do simplify the interaction between these functions and the WinBinder controls.
NOTE: Database wrapper functions are available for SQLite and MySQL only.
There are 3 levels of abstraction:
The database support functions start with the prefix db_.
For example, to access a record, you just call db_get_data with the table name, id number, and column name. Passing NULL as the id returns an array with the column values for the whole table, while passing NULL as the column returns the record pointed by the id. You may also pass an array of ids and columns and the results will be as expected. This is a very easy and intuitive way of accessing data. Applications that use this database layer and SQLite are completely standalone and don't even require a database server, so installation is a snap to the end user.
The functions that access the database directly reside in the db_mysql.inc.php and db_sqlite.inc.php files. They all have the prefix "raw_db_" as a reminder that you will have to deal with APPPREFIX, id and SQL by yourself. Normally you would only use the "db_" functions.
The original functions and SQL commands are available as well and can be mixed freely with the wrapper library. There are also some wrapper functions (like db_query) that may be used to give direct access to the database using SQL. In this case, the application has to take responsibility for the id field and its attributes as well as any table prefixes.
There are tasks that can nicely be solved with SQL. For example: