Alive Fields  1.01
Public Member Functions
AcAdapterMysql Class Reference
Inheritance diagram for AcAdapterMysql:
AcAdapter_Interface

Public Member Functions

 __construct ($host, $user_readonly, $pass_readonly, $db, $user_readwrite=null, $pass_readwrite=null)
 handleError ($x)
 query_read ($query, $limit_rows_returned=0)
 query_write ($query, $limit_rows_affected=0)
 escape_field_name ($field, $add_quotes=true)
 escape_table_name ($field, $add_quotes=true)
 escape_field_value ($field, $add_quotes=true)
 escape_field_value_mysql ($val, $add_quotes=true)

Detailed Description

An adapter for a Mysql database

* This file needs to do is initialize a database connection and define a function call_query which takes SQL and returns an array (rows) of associative arrays (fieldname => fieldvalue). It also provides information on the database connection and database-specific sql-injection prevention.

Last Revision: Date: January 2011

Author:
Alex Rohde

Member Function Documentation

escape_field_name ( field,
add_quotes = true 
)

Escape a field name in a way to prevent SQL injection

Parameters:
typeThe field to escape
typeWhether or not to add quotes
Returns:
Escaped field name

Implements AcAdapter_Interface.

escape_field_value ( field,
add_quotes = true 
)

Escape a field value in a way to prevent SQL injection

Parameters:
typeThe value to escape
typeWhether or not to add quotes
Returns:
Escaped field value

Implements AcAdapter_Interface.

escape_field_value_mysql ( val,
add_quotes = true 
)

Escape a field value in a way appropriate for a mysql database

Parameters:
type$field
Returns:
type
escape_table_name ( field,
add_quotes = true 
)

Escape a table name in a way to prevent SQL injection

Parameters:
typeThe table to escape
typeWhether or not to add quotes
Returns:
Escaped table name

Implements AcAdapter_Interface.

handleError ( x)

Handle Error,

Parameters:
$xstr, the error message

This function will be called by Alive Fields in the event a library error occurs. You can adapt it to handle errors in whichever way you want.

query_write ( query,
limit_rows_affected = 0 
)

Execute an UPDATE, INSERT, or DELETE query allows write access.

Parameters:
string$queryThe SQL query that communicates how we want this adapter to change its data.
type$limit_rows_affecteda safety precaution which isn't strictly necessary if this tool is used properly, but certainly is recommended.

Implements AcAdapter_Interface.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables