blob: daf9f93aa70f42952236d6f3cff2d6f6d0eb0212 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<?
class DBPackageManifest {
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_manifest';
// 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;
}
}
}
?>
|