MDB
[ class tree: MDB ] [ index: MDB ] [ all elements ]

Class: MDB

Source Location: /MDB-1.3.0/MDB.php

Class Overview


The main 'MDB' 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.


Author(s):

Version:

  • $Id: MDB.php,v 1.59.4.12 2004/02/28 10:37:54 quipo Exp $

Methods


Inherited Variables

Inherited Methods


Class Details

[line 188]
The main 'MDB' 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):

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

MDB_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. | +-MDB_mysql The DB implementation for MySQL. Inherits MDB_Common. When calling MDB::factory or MDB::connect for MySQL connections, the object returned is an instance of this class. +-MDB_pgsql The DB implementation for PostGreSQL. Inherits MDB_Common. When calling MDB::factory or MDB::connect for PostGreSQL connections, the object returned is an instance of this class.

MDB_Date This class provides several method to convert from and to MDB timestamps.

MDB_Manager This class handles the xml schema management.

  • Author: Lukas Smith <smith@backendmedia.com>
  • Version: $Id: MDB.php,v 1.59.4.12 2004/02/28 10:37:54 quipo Exp $


[ Top ]


Method Detail

apiVersion   [line 426]

int apiVersion( )

Return the MDB API version
  • Return: the MDB API version number
  • Access: public

[ Top ]

connect   [line 289]

mixed &connect( mixed $dsn, [mixed $options = FALSE])

Create a new MDB connection object and connect to the specified database

IMPORTANT: In order for MDB to work properly it is necessary that you make sure that you work with a reference of the original object instead of a copy (this is a PHP4 quirk).

For example: $mdb =& MDB::connect($dsn); ^^ And not: $mdb = MDB::connect($dsn); ^^

  • Return: a newly created MDB connection object, or a MDB error object on error
  • See: MDB::parseDSN
  • Access: public

Parameters:

mixed   $dsn   —  'data source name', see the MDB::parseDSN method for a description of the dsn format. Can also be specified as an array of the format returned by MDB::parseDSN.
mixed   $options   —  An associative array of option names and their values.

[ Top ]

errorMessage   [line 495]

string errorMessage( int $value)

Return a textual error message for a MDB error code
  • Return: error message, or false if the error code was not recognized
  • Access: public

Parameters:

int   $value   —  error code

[ Top ]

factory   [line 249]

mixed &factory( string $type)

Create a new DB connection object for the specified database

type IMPORTANT: In order for MDB to work properly it is necessary that you make sure that you work with a reference of the original object instead of a copy (this is a PHP4 quirk).

For example: $mdb =& MDB::factory($dsn); ^^ And not: $mdb = MDB::factory($dsn); ^^

  • Return: a newly created MDB connection object, or a MDB error object on error
  • Access: public

Parameters:

string   $type   —  database type, for example 'mysql'

[ Top ]

isConnection   [line 457]

bool isConnection( mixed $value)

Tell whether a value is a MDB connection
  • Return: whether $value is a MDB connection
  • Access: public

Parameters:

mixed   $value   —  value to test

[ Top ]

isError   [line 441]

boolean isError( int $value)

Tell whether a result code from a MDB method is an error
  • Return: whether $value is an MDB_Error
  • Access: public

Parameters:

int   $value   —  result code

[ Top ]

isManip   [line 474]

boolean isManip( string $query)

Tell whether a query is a data manipulation query (insert, update or delete) or a data definition query (create, drop, alter, grant, revoke).
  • Return: whether $query is a data manipulation query
  • Access: public

Parameters:

string   $query   —  the query

[ Top ]

loadFile   [line 412]

$file loadFile( $file)

load a file (like 'Date.php' or 'Manager.php')
  • Return: name of the file to be included from the MDB dir without the '.php' extension (like 'Date' or 'Manager')
  • Access: public

Parameters:

   $file   — 

[ Top ]

parseDSN   [line 581]

array parseDSN( string $dsn)

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

  • Return: an associative array
  • Author: Tomas V.V.Cox <cox@idecnet.com>
  • Access: public

Parameters:

string   $dsn   —  Data Source Name to be parsed

[ Top ]

setOptions   [line 201]

void setOptions( &$db, mixed $options, object $db)

set option array in an exiting database object
  • Access: public

Parameters:

object   $db   —  MDB object
mixed   $options   —  An associative array of option names and their values.
   &$db   — 

[ Top ]

singleton   [line 365]

mixed &singleton( [mixed $dsn = NULL], [mixed $options = FALSE])

Returns a MDB connection with the requested DSN.

A newnew MDB connection object is only created if no object with the reuested DSN exists yet.

IMPORTANT: In order for MDB to work properly it is necessary that you make sure that you work with a reference of the original object instead of a copy (this is a PHP4 quirk).

For example: $mdb =& MDB::sngleton($dsn); ^^ And not: $mdb = MDB::singleton($dsn); ^^

  • Return: a newly created MDB connection object, or a MDB error object on error
  • See: MDB::parseDSN
  • Access: public

Parameters:

mixed   $dsn   —  'data source name', see the MDB::parseDSN method for a description of the dsn format. Can also be specified as an array of the format returned by MDB::parseDSN.
mixed   $options   —  An associative array of option names and their values.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 10:15:26 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.