Smutty_Object
|
+--Smutty_Database
|
+--Smutty_Database_MySQL
public class Smutty_Database_MySQL
extends Smutty_Database
| Field Summary | |
|---|---|
| mixed | the db connection */ |
| Method Summary | |
|---|---|
| boolean | connect() connects to the database. |
| String | escape(String string) takes a string and escapes any characters in it that need to be for the current database |
| String | returns the current date/time, formatted properly for the current database |
| String | returns the date format for this db. |
| String | getError() returns the last error to occur |
| String | getFieldsSql(String table) returns the sql used to eatract field information the resultset should have the fields: - name (field name) - type (field type) - nullable (yes/no string) |
| int | getInsertId(String table) returns the auto generated id for the last record inserted. |
| Smutty_Database_Result | query(String sql) executes a query on the database. |
| boolean | script(String file) run an sql script against the database. |
| boolean | update(String sql) executes an sql statement on the database and returns a boolean indicating if it went well or not |
| Methods inherited from Smutty.Smutty_Database | |
|---|---|
| connect, escape, getCurrentDate, getDateFormat, getError, getFieldsSql, getInsertId, getInstance, query, script, update | |
public mixed $cnn = null
the db connection */
public boolean connect()
connects to the database. db config information could be db independent so this method must read this info from the Smutty_Config class itself.
public String escape(String string)
takes a string and escapes any characters in it that need to be for the current database
public String getCurrentDate()
returns the current date/time, formatted properly for the current database
public String getDateFormat()
returns the date format for this db. the format should be ready for the date() function to use
public String getError()
returns the last error to occur
public String getFieldsSql(String table)
returns the sql used to eatract field information
the resultset should have the fields: - name (field name) - type (field type) - nullable (yes/no string)
public int getInsertId(String table)
returns the auto generated id for the last record inserted. for compat you need to specify the table the record was inserted for (though this is not used for some dbs)
public Smutty_Database_Result query(String sql)
executes a query on the database. it should return an class which extends the Smutty_Database_Result class
public boolean script(String file)
run an sql script against the database. returns a boolean indicating success.
public boolean update(String sql)
executes an sql statement on the database and returns a boolean indicating if it went well or not
an implementation of the database class for MySQL
/