Class: MySQL_Driver

  • 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.2, 2002-07-16, $Id: MySQL.php,v 1.4 2007/09/01 17:02:17 lux Exp $
  • Access: public

MySQL_Driver provides all of the MySQL-specific functionality
for Database objects. It is accessed through the Database class API.

New in 1.2:
- Added a close() method.


Usage Example


<?php

$db 
= new MySQL_Driver ("name""host""user""pass"1);

if (
$db->connection) {
    
// connection worked
} else {
    
// connection failed
}

?>

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',
    )

Return to Top



Methods


MySQL_Driver ($name = "", $host = "", $user = "", $pass = "", $persistent = 1)

  • Access: public

Constructor method.


connect ()

  • Access: public

Establishes a connection with the database


query ($sql = "")

  • Access: public
  • Return: object

Creates and returns a Query object.

$sql is the SQL query you wish to execute with this object.


close ()

  • Access: public
  • Return: boolean

Disconnects from the database. This method is usually unnecessary
since connections should be automatically terminated or should persist after
the script finishes executing, depending on your settings.


getTables (&$db)

  • Access: public
  • Return: array

Retrieves a list of tables in the database and places them in the
$tables property, which is an array. Returns the list of names on
success and false on failure.


raiseError ($msg)


quote ($str)


createSequence ($seq_name)

Return to Top

Copyright © 2008 Sitellite CMS Project

Powered by Sitellite 5.0 Content Management System