Alive Fields
1.01
|
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) |
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
escape_field_name | ( | $ | field, |
$ | add_quotes = true |
||
) |
Escape a field name in a way to prevent SQL injection
type | The field to escape |
type | Whether or not to add quotes |
Implements AcAdapter_Interface.
escape_field_value | ( | $ | field, |
$ | add_quotes = true |
||
) |
Escape a field value in a way to prevent SQL injection
type | The value to escape |
type | Whether or not to add quotes |
Implements AcAdapter_Interface.
escape_field_value_mysql | ( | $ | val, |
$ | add_quotes = true |
||
) |
Escape a field value in a way appropriate for a mysql database
type | $field |
escape_table_name | ( | $ | field, |
$ | add_quotes = true |
||
) |
Escape a table name in a way to prevent SQL injection
type | The table to escape |
type | Whether or not to add quotes |
Implements AcAdapter_Interface.
handleError | ( | $ | x | ) |
Handle Error,
$x | str, 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.
string | $query | The SQL query that communicates how we want this adapter to change its data. |
type | $limit_rows_affected | a safety precaution which isn't strictly necessary if this tool is used properly, but certainly is recommended. |
Implements AcAdapter_Interface.