diff options
Diffstat (limited to 'class.db.package.changelog.php')
-rw-r--r-- | class.db.package.changelog.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/class.db.package.changelog.php b/class.db.package.changelog.php new file mode 100644 index 0000000..dccca30 --- /dev/null +++ b/class.db.package.changelog.php @@ -0,0 +1,49 @@ +<? + + class DBPackageChangelog { + + private $package; + private $name; + private $table; + private $arr_keys; + private $arr_db; + + function __construct($package) { + + if(!is_numeric($package)) + $package = 0; + + $db =& MDB2::singleton(); + $this->table = 'package_changelog'; + + // Go ahead and query as much as we can + $sql = "SELECT * FROM ".$this->table." WHERE package = ".$db->quote($package).";"; + $this->arr_db = $db->getRow($sql); + + $this->arr_keys = array_keys($this->arr_db); + unset($this->arr_keys['package']); + + } + + public function __get($var) { + if(in_array($var, $this->arr_keys)) { + return $this->arr_db[$var]; + } else { + return $this->$var; + } + } + + public function __set($var, $value) { + + $db =& MDB2::singleton(); + + if(in_array($var, $this->arr_keys)) { + $arr_update = array($var => $value); + $db->autoExecute($this->table, $arr_update, MDB2_AUTOQUERY_UPDATE, "package = ".$db->quote($this->package)); + $this->arr_db[$var] = $value; + } + } + + } + +?>
\ No newline at end of file |