Add all the phpdocs to the domframework
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1246 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
43
dblayer.php
43
dblayer.php
@@ -1,4 +1,8 @@
|
||||
<?php
|
||||
/** DomFramework
|
||||
@package domframework
|
||||
@author Dominique Fournier <dominique@fournier38.fr> */
|
||||
|
||||
// dblayer.php
|
||||
|
||||
/* Documentation :
|
||||
@@ -27,15 +31,20 @@ Optionnaly, you can add the
|
||||
/** Permit abstraction on the differents SQL databases available */
|
||||
class dblayer extends PDO
|
||||
{
|
||||
/** The fields with the definition of type, and special parameters */
|
||||
protected $fields = array ();
|
||||
/** The primary field */
|
||||
protected $primary = null;
|
||||
/** An array to define the unique fields (or array of unique fields) */
|
||||
protected $unique = null;
|
||||
/** The db connection */
|
||||
protected $db = null;
|
||||
/** Debug of the SQL */
|
||||
public $debug = FALSE;
|
||||
/** Return all the tables available in the database */
|
||||
function listTables ()
|
||||
{
|
||||
$driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME);
|
||||
$driver = $this->getAttribute (PDO::ATTR_DRIVER_NAME);
|
||||
$rc = @include_once ("dbLayer".ucfirst ($driver).".php");
|
||||
if ($rc === FALSE)
|
||||
throw new Exception (sprintf (_("dbLayer driver %s not available"),
|
||||
@@ -54,7 +63,11 @@ class dblayer extends PDO
|
||||
MYSQL : SHOW COLUMNS FROM yourtable;*/
|
||||
|
||||
/** Connection to the database engine
|
||||
See http://fr2.php.net/manual/en/pdo.construct.php for the $dsn format */
|
||||
See http://fr2.php.net/manual/en/pdo.construct.php for the $dsn format
|
||||
@param string $dsn PDO Data Source Name
|
||||
@param string|null $username Username to connect
|
||||
@param string|null $password Password to connect
|
||||
@param string|null $driver_options Driver options to the database */
|
||||
function __construct ($dsn, $username=null, $password=null,
|
||||
$driver_options=null)
|
||||
{
|
||||
@@ -62,7 +75,8 @@ class dblayer extends PDO
|
||||
$this->db->setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
}
|
||||
|
||||
/** Create a new entry in the table. Datas must be an indexed array */
|
||||
/** Create a new entry in the table. Datas must be an indexed array
|
||||
@param array $datas Datas to be recorded (column=>value)*/
|
||||
function create ($datas)
|
||||
{
|
||||
if ($this->db === null)
|
||||
@@ -145,13 +159,14 @@ class dblayer extends PDO
|
||||
|
||||
/** Read the table content based on a select filter, ordered by order
|
||||
operator and the associated select value
|
||||
- $select = array (array ($key, $val, $operator), ...)
|
||||
$key=>column, $val=>value to found, $operator=>'LIKE', =...
|
||||
- $display = array ($col1, $col2...);
|
||||
Columns displayed
|
||||
- $order = array (array ($key, $orientation), ...)
|
||||
$key=>column, $orientation=ASC/DESC
|
||||
*/
|
||||
@param array|null $select Rows to select with
|
||||
$select = array (array ($key, $val, $operator), ...)
|
||||
$key=>column, $val=>value to found, $operator=>'LIKE', =...
|
||||
@param array|null $display Columns displayed
|
||||
$display = array ($col1, $col2...);
|
||||
@param array|null $order Sort the columns by orientation
|
||||
$order = array (array ($key, $orientation), ...)
|
||||
$key=>column, $orientation=ASC/DESC */
|
||||
function read ($select=null, $display=null, $order=null)
|
||||
{
|
||||
if ($this->db === null)
|
||||
@@ -224,7 +239,10 @@ class dblayer extends PDO
|
||||
}
|
||||
|
||||
/** Update the key tuple with the provided datas
|
||||
Return the number of rows modified */
|
||||
Return the number of rows modified
|
||||
@param string|integer $updatekey The key applied on primary key to be
|
||||
updated
|
||||
@param array $datas The values to be updated */
|
||||
function update ($updatekey, $datas)
|
||||
{
|
||||
if ($this->db === null)
|
||||
@@ -326,7 +344,8 @@ class dblayer extends PDO
|
||||
}
|
||||
|
||||
/** Delete a tuple identified by its primary key
|
||||
Return the number of deleted rows (can be 0 !) */
|
||||
Return the number of deleted rows (can be 0 !)
|
||||
@param strin|integer $deletekey The key of primary key to be deleted */
|
||||
function delete ($deletekey)
|
||||
{
|
||||
if ($this->db === null)
|
||||
|
||||
Reference in New Issue
Block a user