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

Class: MDB_Manager

Source Location: /MDB-1.3.0/MDB/Manager.php

Class Overview

PEAR
   |
   --MDB_Manager

The database manager is a class that provides a set of database management services like installing, altering and dumping the data structures of databases.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 63]
The database manager is a class that provides a set of database management services like installing, altering and dumping the data structures of databases.


[ Top ]


Class Variables

$database =

[line 67]


Type:   mixed


[ Top ]

$database_definition = array(
        'name' => '',
        'create' => 0,
        'TABLES' => array())

[line 102]


Type:   mixed


[ Top ]

$default_values = array(
        'integer' => 0,
        'float' => 0,
        'decimal' => 0,
        'text' => '',
        'timestamp' => '0001-01-01 00:00:00',
        'date' => '0001-01-01',
        'time' => '00:00:00'
    )

[line 90]


Type:   mixed


[ Top ]

$invalid_names = array(
        'user' => array(),'is'=>array(),'file'=>array('oci'=>array(),'oracle'=>array()),'notify'=>array('pgsql'=>array()),'restrict'=>array('mysql'=>array()),'password'=>array('ibase'=>array()))

[line 73]


Type:   mixed


[ Top ]

$options = array(
            'fail_on_invalid_names' => 1,
            'debug' => 0
        )

[line 69]


Type:   mixed


[ Top ]

$warnings = array()

[line 100]


Type:   mixed


[ Top ]



Method Detail

captureDebugOutput   [line 157]

void captureDebugOutput( string $capture)

set a debug handler
  • See: debug()
  • Access: public

Parameters:

string   $capture   —  name of the function that should be used in debug()

[ Top ]

connect   [line 263]

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

Create a new MDB connection object and connect to the specified database
  • Return: MDB_OK on success, or a MDB error object
  • See: MDB::parseDSN
  • Access: public

Parameters:

mixed   $dbinfo   —  '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. Finally you can also pass an existing db object to be used.
mixed   $options   —  An associative array of option names and their values.
   &$dbinfo   — 

[ Top ]

debugOutput   [line 172]

string debugOutput( )

output debug info
  • Return: content of the debug_output class variable
  • Access: public

[ Top ]

disconnect   [line 290]

void disconnect( )

Log out and disconnect from the database.
  • Access: public

[ Top ]

dumpDatabase   [line 1814]

mixed dumpDatabase( array $arguments, [integer $dump = MDB_MANAGER_DUMP_ALL])

Dump a previously parsed database structure in the Metabase schema XML based format suitable for the Metabase parser. This function may optionally dump the database definition with initialization commands that specify the data that is currently present in the tables.
  • Return: MDB_OK on success, or a MDB error object
  • Access: public

Parameters:

array   $arguments   —  an associative array that takes pairs of tag names and values that define dump options. array ( 'Definition' => Boolean TRUE : dump currently parsed definition default: dump currently connected database 'Output_Mode' => String 'file' : dump into a file default: dump using a function 'Output' => String depending on the 'Output_Mode' name of the file name of the function 'EndOfLine' => String end of line delimiter that should be used default: "\n" );
integer   $dump   —  constant that determines what data to dump MDB_MANAGER_DUMP_ALL : the entire db MDB_MANAGER_DUMP_STRUCTURE : only the structure of the db MDB_MANAGER_DUMP_CONTENT : only the content of the db

[ Top ]

getDefinitionFromDatabase   [line 1642]

mixed getDefinitionFromDatabase( )

Attempt to reverse engineer a schema structure from an existing MDB This method can be used if no xml schema file exists yet.

The resulting xml schema file may need some manual adjustments.

  • Return: MDB_OK or array with all ambiguities on success, or a MDB error object
  • Access: public

[ Top ]

getOption   [line 236]

mixed getOption( string $option)

returns the value of an option
  • Return: the option value or error object
  • Access: public

Parameters:

string   $option   —  option name

[ Top ]

getWarnings   [line 201]

array getWarnings( )

get all warnings in reverse order.

This means that the last warning is the first element in the array


[ Top ]

parseDatabaseDefinitionFile   [line 1446]

mixed parseDatabaseDefinitionFile( string $input_file, array $variables, [bool $fail_on_invalid_names = 1])

Parse a database definition file by creating a Metabase schema format parser object and passing the file contents as parser input data stream.
  • Return: MDB_OK on success, or a MDB error object
  • Access: public

Parameters:

string   $input_file   —  the path of the database schema file.
array   $variables   —  an associative array that the defines the text string values that are meant to be used to replace the variables that are used in the schema description.
bool   $fail_on_invalid_names   —  (optional) make function fail on invalid names

[ Top ]

raiseError   [line 132]

object a &raiseError( [mixed $code = MDB_MANAGER_ERROR], [int $mode = NULL], [mixed $options = NULL], [string $userinfo = NULL], [mixed $nativecode = NULL])

This method is used to communicate an error and invoke error callbacks etc. Basically a wrapper for PEAR::raiseError without the message string.
  • Return: PEAR error object
  • See: PEAR_Error
  • Access: public

Parameters:

mixed   $code   —  integer error code, or a PEAR error object (all other parameters are ignored if this parameter is an object
int   $mode   —  error mode, see PEAR_Error docs
mixed   $options   —  If error mode is PEAR_ERROR_TRIGGER, this is the error level (E_USER_NOTICE etc). If error mode is PEAR_ERROR_CALLBACK, this is the callback function, either as a function name, or as an array of an object and method name. For other error modes this parameter is ignored.
string   $userinfo   —  Extra debug information. Defaults to the last query and native error code.
mixed   $nativecode   —  Native error code, integer or string depending the backend.

[ Top ]

resetWarnings   [line 185]

void resetWarnings( )

reset the warning array
  • Access: public

[ Top ]

setDatabase   [line 308]

string setDatabase( string $name)

Select a different database
  • Return: name of the database previously connected to
  • Access: public

Parameters:

string   $name   —  name of the database that should be selected

[ Top ]

setOption   [line 217]

mixed setOption( string $option, mixed $value)

set the option for the db class
  • Return: MDB_OK or MDB_Error
  • Access: public

Parameters:

string   $option   —  option name
mixed   $value   —  value for the option

[ Top ]

updateDatabase   [line 2093]

mixed updateDatabase( string $current_schema_file, [string $previous_schema_file = FALSE], [array $variables = array()])

Compare the correspondent files of two versions of a database schema definition: the previously installed and the one that defines the schema that is meant to update the database.

If the specified previous definition file does not exist, this function will create the database from the definition specified in the current schema file. If both files exist, the function assumes that the database was previously installed based on the previous schema file and will update it by just applying the changes. If this function succeeds, the contents of the current schema file are copied to replace the previous schema file contents. Any subsequent schema changes should only be done on the file specified by the $current_schema_file to let this function make a consistent evaluation of the exact changes that need to be applied.

  • Return: MDB_OK on success, or a MDB error object
  • Access: public

Parameters:

string   $current_schema_file   —  name of the updated database schema definition file.
string   $previous_schema_file   —  name the previously installed database schema definition file.
array   $variables   —  an associative array that is passed to the argument of the same name to the parseDatabaseDefinitionFile function. (there third param)

[ Top ]


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