Documentation » API Reference

Application:

Class: MySQL_DatabaseTable extends DatabaseTable

  • Package: saf.Database
  • Author: John Luxford <lux@simian.ca>
  • Copyright: Copyright (C) 2001-2003, Simian Systems Inc.
  • License: http://www.sitellite.org/index/license Simian Open Software License
  • Version: 1.0, 2002-08-07, $Id: MySQL.php,v 1.4 2007/09/01 17:02:17 lux Exp $
  • Access: public

MySQL_DatabaseTable provides all of the MySQL-specific functionality
for the saf.Database.Table package.


Usage Example


<?php

$dt 
= new MySQL_DatabaseTable ($db'tablename''pkeycolumn');

if (
$res $dt->fetchAll ()) {
    
// do something with $res
} else {
    echo 
$dt->error;
}

?>

Return to Top



Properties


$connection

  • Access: public

Contains the database connection resource.


$path

  • Access: public

Path to the Berkeley Database.


$mode

  • Access: public

Mode to use when opening the database (corresponds to
the modes available to the dba_open () function.


$handler

  • Access: public

The database implementation used (db2, db3, gdbm, etc.).


$persistent

  • Access: public

A 1 or 0 (true or false, and true by default), specifying whether
to establish a persistent connection or not.


$transactions 0

  • Access: public

Boolean value denoting whether to enable transactions in the
current database.


$driver

  • Access: public

Contains the name of the database driver being used.


$host

  • Access: public

Contains the name of the database host.


$name

  • Access: public

Contains the name of the database being used.


$user

  • Access: public

Contains the username used to connect to the current database.


$pass

  • Access: public

Contains the password used to connect to the current database.


$dbd

  • Access: private

Contains the loaded database driver.


$error false

  • Access: public

Contains connection error information.


$sql ''

  • Access: public

Contains the SQL query to be executed.


$rows

  • Access: public

Contains the number of rows returned by the previous fetch() call.


$lastid

  • Access: public

Contains the lastid() of the last insert query sent to the execute()
method.


$tables false

  • Access: public

Contains a list of tables in the database. Set by getTables().


$pearEmu false


$sequenceFormat '%s_seq'


$fetchMode DB_FETCHMODE_OBJECT


$result ''

  • Access: public

Contains the result identifier for the current execution.


$field ''

  • Access: public

Currently unused.


$_fetchModeFunctions = array (
        
DB_FETCHMODE_ASSOC        => 'mysql_fetch_array',
        
DB_FETCHMODE_OBJECT        => 'mysql_fetch_object',
    )


$typemap = array (
        
'(var)?char\(([0-9]+)\)'    => 'text',
        
'text'                        => 'textarea',
        
'mediumtext'                => 'textarea',
        
'longtext'                    => 'textarea',
        
'date'                        => 'date',
        
'time'                        => 'time',
        
'datetime'                    => 'datetime',
        
'timestamp\([0-9]+\)'            => 'datetime',
        
'enum\((.+)\)'                => 'select',
        
'set\((.+)\)'                => 'multiple',
        
'int\(([0-9]+)\)'            => 'text',
        
'blob'                        => 'textarea',
        
'.*'                            => 'text',
    )

  • Access: public

Contains a key/value list of database types (regular
expressions are used here to save repeating ourselves) and their
corresponding MailForm widget types.

Return to Top



Methods


getInfo () 

  • Access: public
  • Return: boolean

Gets all the info it can from the database about this table and
its columns, stores it in the $info property, and parses it into an
associative array ($columns) of MailForm widgets.


getPkey () 

  • Access: public
  • Return: string

Gets the name of the primary key field for this table using the
results of getInfo() (see below). Used by the constructor method to
set the $pkey property if a primary key column was not specified.
Returns false on failure.


getRefInfo ($name$table

  • Access: public
  • Return: boolean

Uses the global $tables array (Sitellite CMS specific) to get
the primary key, referencing column, display column, and a true or false
self-reference value, when given a Ref column name and its corresponding
table.

Return to Top