Class Database

Description

The Database class contains information about the specified database

Uses the Table class.

Located in /phpfw.php (line 3497)


	
			
Variable Summary
string $name
array $tables
Method Summary
Database Database (string $adodb, string $type, string $host, string $user, string $pass, string $name, string $sql_file)
void check_schema ()
void get_schema (array $table_names, array $primary_keys)
void &get_table_by_name (string $name)
Variables
string $name (line 3501)
  • var: Name of the database
object Sql $sql (line 3506)
  • var: The Sql object
array $tables (line 3513)
  • var:

    Associative array of Table objects

    $tables['tablename'] = Table object

Methods
Constructor Database (line 3526)

Constructor for the Database class

Database Database (string $adodb, string $type, string $host, string $user, string $pass, string $name, string $sql_file)
  • string $adodb: Path to the ADOdb or ADOdb Lite library
  • string $type: Type of database being used
  • string $host: Hostname of server where database is running
  • string $user: User name to connect with
  • string $pass: Password to connect with
  • string $name: Name of the database to select
  • string $sql_file: Path to the SQL ini file
check_schema (line 3586)

Check the schema of the database and make relevant associations.

This function does the following:

  • Set the type of table : data or link
  • If DATE_ADDED and/or DATE_UPDATED columns exist, verify that they are of type datetime since Phpfw internally maintains them
  • If table type is a link table, update the $links array for the link table and both the linked tables.

void check_schema ()
get_schema (line 3540)

Get the schema for this database

void get_schema (array $table_names, array $primary_keys)
  • array $table_names: Associative array of table names and requested external name
  • array $primary_keys: Associative array of table names and requested primary keys
get_table_by_name (line 3719)

Returns a Table object by its name

void &get_table_by_name (string $name)
  • string $name: The name to look up
load_schema_from_file (line 3662)

Load the schema into the database

This function executes the SQL commands in a file specified in the configuration file under the section 'schema'.

Section 'schema' should contain load = true and path = the location of the schema files.

The SQL file loaded from the above path is constructed based on the database type specified under section 'database'.

E.g. For mysql, schema is loaded from - mysql_schema.sql For sqlite, schema is loaded from - sqlite_schema.sql

void load_schema_from_file ()

Documentation generated on Sat, 23 Jun 2007 21:28:26 -0500 by phpDocumentor 1.3.2