Class PhpFunk_DB_MySQLDriver

Description

Implements interfaces:

Interface to MySQL databases

Query caching is NOT implemented!

PHP version 5

Copyright 2006-2007 Salvador T. Pimienta All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of the phpfunk.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

  • version: CVS: $Id: MySQLDriver.php,v 1.3 2007/12/24 19:26:00 tom Exp $
  • copyright: Copyright 2006-2008 Tom Pimienta
  • license: BSD

Located in /DB/MySQLDriver.php (line 47)


	
			
Variable Summary
 mixed $db
 mixed $prepared
Method Summary
 void affectedRows ()
 void commit ()
 bool connect (string $host, string $user, string $password, string $database)
 void disconnect ()
 void escape ( $arg)
 string escapeString ( $sql,  $args)
 mixed execute (string $sql, [mixed $args = ''], [ $FILE = ''], [ $LINE = ''])
 void executePrepared ( $args)
 bool isConnected ()
 void lastError ()
 void lastInsertID ()
 void MySQLDriver ([bool $useQueryCache = FALSE], [int $queryCacheSize = 0])
 void prepare ( $sql)
 void rollback ()
 void selectColumn ( $sql, [ $args = ''], [ $FILE = ''], [ $LINE = ''])
 mixed selectOne (string $sql, [mixed $args = ''], [ $FILE = ''], [ $LINE = ''])
 mixed selectRows (string $sql, [mixed $args = ''], [ $FILE = ''], [ $LINE = ''])
Variables
mixed $db = FALSE (line 50)
mixed $prepared (line 51)
mixed $queryCacheSize (line 53)
mixed $useQueryCache (line 52)
Methods
affectedRows (line 262)
void affectedRows ()

Implementation of:
PhpFunk_DB_DBWrapper::affectedRows()
commit (line 303)

mysql will always return TRUE even if engine is not transaction-safe

void commit ()

Implementation of:
PhpFunk_DB_DBWrapper::commit()
Returns FALSE if unable to commit
connect (line 87)
  • return: TRUE upon successful connection
bool connect (string $host, string $user, string $password, string $database)
  • string $host
  • string $user
  • string $password
  • string $database

Implementation of:
PhpFunk_DB_DBWrapper::connect()
Returns TRUE on successful connection
disconnect (line 107)
void disconnect ()

Implementation of:
PhpFunk_DB_DBWrapper::disconnect()
escape (line 316)
void escape ( $arg)
  • $arg

Implementation of:
PhpFunk_DB_DBWrapper::escape()
Escape an argument so it can be safely inserted into database
escapeString (line 276)
  • return: mysql real escaped string, also add 's around values
  • todo: BAD '?' is a valid SQL string used in searches! Solution is to make that part of query be one of the $args
  • access: private
string escapeString ( $sql,  $args)
  • $sql
  • $args
execute (line 216)

Perform an sql query (non-select)

  • return: number of rows affected or FALSE on error
mixed execute (string $sql, [mixed $args = ''], [ $FILE = ''], [ $LINE = ''])
  • string $sql
  • mixed $args: single value or ordered array
  • $FILE
  • $LINE

Implementation of:
PhpFunk_DB_DBWrapper::execute()
executePrepared (line 236)
void executePrepared ( $args)
  • $args

Implementation of:
PhpFunk_DB_DBWrapper::executePrepared()
Execute a prepared statement.
isConnected (line 118)
  • return: TRUE if connected
bool isConnected ()

Implementation of:
PhpFunk_DB_DBWrapper::isConnected()
lastError (line 249)
void lastError ()

Implementation of:
PhpFunk_DB_DBWrapper::lastError()
Returns last error msg or FALSE if there was none
lastInsertID (line 257)
void lastInsertID ()

Implementation of:
PhpFunk_DB_DBWrapper::lastInsertID()
The driver will attempt to return the last insert ID.
MySQLDriver (line 60)
  • todo: specify TRUE and non-zero cache size to actually use caching
void MySQLDriver ([bool $useQueryCache = FALSE], [int $queryCacheSize = 0])
  • bool $useQueryCache: if you want to use mysql query cache
  • int $queryCacheSize: size of query cache to use
prepare (line 231)
void prepare ( $sql)
  • $sql

Implementation of:
PhpFunk_DB_DBWrapper::prepare()
Prepare a statement for execution w/ executePrepared()
rollback (line 311)

mysql will always return TRUE even if engine is not transaction-safe

void rollback ()

Implementation of:
PhpFunk_DB_DBWrapper::rollback()
Returns FALSE if unable to rollback!
selectColumn (line 185)
void selectColumn ( $sql, [ $args = ''], [ $FILE = ''], [ $LINE = ''])
  • $sql
  • $args
  • $FILE
  • $LINE

Implementation of:
PhpFunk_DB_DBWrapper::selectColumn()
Get first column of each row in result set.
selectOne (line 129)

Fetches a row or a single value from database.

  • return: an array or scalar or FALSE on error
mixed selectOne (string $sql, [mixed $args = ''], [ $FILE = ''], [ $LINE = ''])
  • string $sql
  • mixed $args: array
  • $FILE
  • $LINE

Implementation of:
PhpFunk_DB_DBWrapper::selectOne()
selectRows (line 160)
  • return: array of rows or NULL if no matches or FALSE on error
mixed selectRows (string $sql, [mixed $args = ''], [ $FILE = ''], [ $LINE = ''])
  • string $sql
  • mixed $args: array of values
  • $FILE
  • $LINE

Implementation of:
PhpFunk_DB_DBWrapper::selectRows()
Returns rows of assoc array or NULL if no matches are found.
startTransaction (line 295)

mysql will always return TRUE even if engine is not transaction-safe

void startTransaction ()

Implementation of:
PhpFunk_DB_DBWrapper::startTransaction()
Returns FALSE if unable to start transaction
_disableQueryCache (line 75)
void _disableQueryCache ()
_enableQueryCache (line 68)
void _enableQueryCache ()

Documentation generated on Sun, 08 Jun 2008 22:21:24 -0700 by phpDocumentor 1.4.0