Smutty_Object
|
+--Smutty_Database
public abstract class Smutty_Database
extends Smutty_Object
| Method Summary | |
|---|---|
| protected abstract boolean | connect() connects to the database. |
| abstract String | escape(String string) takes a string and escapes any characters in it that need to be for the current database |
| abstract String | returns the current date/time, formatted properly for the current database |
| abstract String | returns the date format for this db. |
| abstract String | getError() returns the last error to occur |
| abstract 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) |
| abstract int | getInsertId(String table) returns the auto generated id for the last record inserted. |
| static Smutty_Database | method for getting a handle to the current database connection. |
| abstract Smutty_Database_Result | query(String sql) executes a query on the database. |
| abstract boolean | script(String file) run an sql script against the database. |
| abstract boolean | update(String sql) executes an sql statement on the database and returns a boolean indicating if it went well or not |
protected abstract 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 abstract String escape(String string)
takes a string and escapes any characters in it that need to be for the current database
public abstract String getCurrentDate()
returns the current date/time, formatted properly for the current database
public abstract String getDateFormat()
returns the date format for this db. the format should be ready for the date() function to use
public abstract String getError()
returns the last error to occur
public abstract 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 abstract 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 static Smutty_Database getInstance()
method for getting a handle to the current database connection. of none has been created then this will try and read the config to find out what and how to create.
public abstract 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 abstract boolean script(String file)
run an sql script against the database. returns a boolean indicating success.
public abstract boolean update(String sql)
executes an sql statement on the database and returns a boolean indicating if it went well or not
this is the base class which all database implementations need to extend and implement. it controls access to these implementations however and getting a db handle should be done by using the
getInstance()method.
/