<?
/*#############################################
MySql Table object
this is definetly a work in progress - the idea behind this
is to create an easy way to access MySql via objects that
hide all SQL code from the programmer
this class should represent a selected mysql table
and offer an easy interface to select, insert, update and delete
data.
In future versions of this class it should be possible to easily
access field meta information
----------------------------------------------------------------------------
public methods:
RESOURCE IDENTIFIER = MySqlTable->select(STRING what, STRING filter, STRING order);
RESOURCE IDENTIFIER = MySqlTable->insert(STRING||ARRAY cols, STRING vals);
RESOURCE IDENTIFIER = MySqlTable->update(STRING||ARRAY cols_vals, STRING filter);
RESOURCE IDENTIFIER = MySqlTable->del(STRING filter);
RESOURCE IDENTIFIER = MySqlTable->emptyTable();
----------------------------------------------------------------------------
code broken by Björn Puttmann, hide@address.com
please feel free to mail any comment or ideas to the above
email adress
version 0.1
#############################################*/
class MySqlTable extends MySqlDB {
var $table;
var $connection;
function MySqlTable($table_name, &$connection) {
$this->connection = &$connection;
$this->table = $table_name;
}
/* */
function select($what,$filter,$order) { return MySqlDB::select($what,$this->table,$filter,$order); }
function insert($cols,$vals) { return MySqlDB::insert($this->table,$cols,$vals); }
function update($cols_vals,$where) { return MySqlDB::update($this->table,$cols_vals,$where); }
function del($filter) { return MySqlDB::delete($this->table,$filter); }
function emptyTable() { return MySqlDB::emptyTable($this->table); }
}
?>