Zikula 1.0.1
[ class tree: Zikula 1.0.1 ] [ index: Zikula 1.0.1 ] [ all elements ]

Class: DB

Source Location: /includes/classes/adodb/adodb-pear.inc.php

Class Overview


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.


Methods



Class Details

[line 101]
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.



[ Top ]


Class Methods


method apiVersion [line 199]

int apiVersion( )

Return the DB API version



Tags:

return:  the DB API version number


[ Top ]

method assertExtension [line 361]

bool assertExtension( $name $name)

Load a PHP database extension if it is not loaded already.



Tags:

return:  true if the extension was already or successfully loaded, false if it could not be loaded
access:  public


Parameters:

$name   $name   the base name of the extension (without the .so or .dll suffix)

[ Top ]

method connect [line 139]

object a &connect( $dsn $dsn, [$options $options = false])

Create a new DB object and connect to the specified database



Tags:

return:  newly created DB connection object, or a DB error object on error
see:  DB::isError
see:  DB::parseDSN


Parameters:

$dsn   $dsn   mixed "data source name", see the DB::parseDSN method for a description of the dsn format. Can also be specified as an array of the format returned by DB::parseDSN.
$options   $options   mixed if boolean (or scalar), tells whether this connection should be persistent (for backends that support this). This parameter can also be an array of options, see DB_common::setOption for more information on connection options.

[ Top ]

method factory [line 112]

object a &factory( $type $type)

Create a new DB object for the specified database type



Tags:

return:  newly created DB object, or a DB error code on error


Parameters:

$type   $type   string database type, for example "mysql"

[ Top ]

method isError [line 211]

bool isError( $value $value)

Tell whether a result code from a DB method is an error



Tags:

return:  whether $value is an error


Parameters:

$value   $value   int result code

[ Top ]

method isWarning [line 229]

bool isWarning( $value $value)

Tell whether a result code from a DB method is a warning.

Warnings differ from errors in that they are generated by DB, and are not fatal.




Tags:

return:  whether $value is a warning


Parameters:

$value   $value   mixed result value

[ Top ]

method parseDSN [line 270]

array parseDSN( $dsn $dsn)

Parse a data source name



Tags:

return:  

an associative array with the following keys:

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>


Parameters:

$dsn   $dsn   string Data Source Name to be parsed

[ Top ]


Documentation generated on Fri, 18 Jul 2008 21:41:24 +0200 by phpDocumentor 1.4.1