[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/includes/pear/ -> DB.php (sommaire)

This is a special constant that tells DB the user hasn't specified any particular get mode, so the default should be used.

Poids: 948 lignes (29 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 1 fichier
 htdocs/includes/pear/PEAR.php

Définit 4 classes

DB:: (9 méthodes):
  factory()
  connect()
  apiVersion()
  isError()
  isConnection()
  isManip()
  errorMessage()
  parseDSN()
  assertExtension()

DB_Error:: (1 méthode):
  DB_Error()

DB_result:: (10 méthodes):
  DB_result()
  setOption()
  fetchRow()
  fetchInto()
  numCols()
  numRows()
  nextResult()
  free()
  tableInfo()
  getRowCounter()

DB_row:: (1 méthode):
  DB_row()


Classe: DB  - X-Ref

The main "DB" class is simply a container class with some static
methods for creating DB objects as well as some utility functions
common to all parts of DB.

The object model of DB is as follows (indentation means inheritance):

DB           The main DB class.  This is simply a utility class
with some "static" methods for creating DB objects as
well as common utility functions for other DB classes.

DB_common    The base for each DB implementation.  Provides default
|            implementations (in OO lingo virtual methods) for
|            the actual DB implementations as well as a bunch of
|            query utility functions.
|
+-DB_mysql   The DB implementation for MySQL.  Inherits DB_common.
When calling DB::factory or DB::connect for MySQL
connections, the object returned is an instance of this
class.

factory($type)   X-Ref
Create a new DB connection object for the specified database
type

param: string $type database type, for example "mysql"
return: mixed a newly created DB object, or a DB error code on

connect($dsn, $options = false)   X-Ref
Create a new DB connection object and connect to the specified
database

param: mixed $dsn "data source name", see the DB::parseDSN
param: mixed $options An associative array of option names and
return: mixed a newly created DB connection object, or a DB

apiVersion()   X-Ref
Return the DB API version

return: int the DB API version number

isError($value)   X-Ref
Tell whether a result code from a DB method is an error

param: int $value result code
return: bool whether $value is an error

isConnection($value)   X-Ref
Tell whether a value is a DB connection

param: mixed $value value to test
return: bool whether $value is a DB connection

isManip($query)   X-Ref
Tell whether a query is a data manipulation query (insert,
update or delete) or a data definition query (create, drop,
alter, grant, revoke).

param: string $query the query
return: boolean whether $query is a data manipulation query

errorMessage($value)   X-Ref
Return a textual error message for a DB error code

param: integer $value error code
return: string error message, or false if the error code was

parseDSN($dsn)   X-Ref
Parse a data source name

A array with the following keys will be returned:
phptype: Database backend used in PHP (mysql, odbc etc.)
dbsyntax: Database used with regards to SQL syntax etc.
protocol: Communication protocol to use (tcp, unix etc.)
hostspec: Host specification (hostname[:port])
database: Database to use on the DBMS server
username: User name for login
password: Password for login

The format of the supplied DSN is in its fullest form:

phptype(dbsyntax)://username:password@protocol+hostspec/database

Most variations are allowed:

phptype://username:password@protocol+hostspec:110//usr/db_file.db
phptype://username:password@hostspec/database_name
phptype://username:password@hostspec
phptype://username@hostspec
phptype://hostspec/database
phptype://hostspec
phptype(dbsyntax)
phptype

author: Tomas V.V.Cox <cox@idecnet.com>
param: string $dsn Data Source Name to be parsed
return: array an associative array

assertExtension($name)   X-Ref
Load a PHP database extension if it is not loaded already.

param: string $name the base name of the extension (without the .so or
return: boolean true if the extension was already or successfully

Classe: DB_Error  - X-Ref

DB_Error implements a class for reporting portable database error
messages.

DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,$level = E_USER_NOTICE, $debuginfo = null)   X-Ref
DB_Error constructor.

param: mixed   $code   DB error code, or string with error message.
param: integer $mode   what "error mode" to operate in
param: integer $level  what error level to use for $mode & PEAR_ERROR_TRIGGER
param: mixed   $debuginfo  additional debug info, such as the last query

Classe: DB_result  - X-Ref

This class implements a wrapper for a DB result set.
A new instance of this class will be returned by the DB implementation
after processing a query that returns data.

DB_result(&$dbh, $result, $options = array()   X-Ref
DB_result constructor.

param: resource &$dbh   DB object reference
param: resource $result  result resource id
param: array    $options assoc array with optional result options

setOption($key, $value = null)   X-Ref
Pas de description

fetchRow($fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null)   X-Ref
Fetch and return a row of data (it uses driver->fetchInto for that)

param: int $fetchmode format of fetched row
param: int $rownum    the row number to fetch
return: array a row of data, NULL on no more rows or PEAR_Error on error

fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null)   X-Ref
Fetch a row of data into an existing variable.

param: mixed   &$arr     reference to data containing the row
param: integer $fetchmod format of fetched row
param: integer $rownum   the row number to fetch
return: mixed  DB_OK on success, NULL on no more rows or

numCols()   X-Ref
Get the the number of columns in a result set.

return: int the number of columns, or a DB error

numRows()   X-Ref
Get the number of rows in a result set.

return: int the number of rows, or a DB error

nextResult()   X-Ref
Get the next result if a batch of queries was executed.

return: bool true if a new result is available or false if not.

free()   X-Ref
Frees the resources allocated for this result set.

return: int error code

tableInfo($mode = null)   X-Ref


getRowCounter()   X-Ref
returns the actual row number

return: integer

Classe: DB_row  - X-Ref

Pear DB Row Object

DB_row(&$arr)   X-Ref
constructor

param: resource row data as array



Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics