| Information | |
|---|---|
| min. EQDKP-PLUS Version | 0.7.0.0
|
Contents |
A database abstraction layer is an application programming interface which unifies the communication between a computer application and databases such as MySQL, PostgreSQL, Oracle or SQLite. Traditionally, all database vendors provide their own interface tailored to their products which leaves it to the application programmer to implement code for all database interfaces he would like to support. Database abstraction layers reduce the amount of work by providing a consistent API to the developer and hide the database specifics behind this interface as much as possible. There exist many abstraction layers with different interfaces in numerous programming languages.
Source: Wikipedia.com
MySQL, MySQLi and PostgreSQL
The table Prefix is automatically added to the table, if you're adding two underscores in front of the table name. The Query processor is automatically adding the table prefix.
$db->query("SELECT * FROM __tablename");
Use the Query function to fetch a single line
$row = $db->query_first("SELECT * FROM __tablename"); echo $row['some_value'];
If you want to fetch multiple lines, use this construct
$result = $db->query("SELECT * FROM __tablename"); while($row = $db->fetch_record($result)){ echo $row['some_value']; } $db->free_result($result);
You should use the build in SQL Query generation. the attached array is parsed and set instead of the :params into the base Query. The Query Builder recognizes if its INSERT, REPLACE or UPDATE.
$db->query("UPDATE __test SET :params WHERE id='".$myid."'", array( 'wl_member' => ucfirst($user->data['username']), 'wl_item' => $in->get('wishlist_item'), 'wl_type' => $in->get('wishlist_type'), ));
You should use the build in SQL Query generation. the attached array is parsed and set instead of the :params into the base Query. The Query Builder recognizes if its INSERT, REPLACE or UPDATE.
$db->query("INSERT INTO __test :params", array( 'wl_id' => null, 'wl_member' => ucfirst($user->data['username']), 'wl_item' => $in->get('wishlist_item'), 'wl_type' => $in->get('wishlist_type'), ));