12 const TABLE_NAME =
"CustomData";
14 public $IdAccount = 0;
16 public $DataValue =
"";
21 public function __construct($src = null, $stripSlashes =
false) {
26 $this->_loadByRow($src, $stripSlashes);
37 public static function Load ($idAccount, $returnArray =
false) {
38 $where = sprintf(
"IdAccount = %d", $idAccount);
39 return self::_load(self::GetTableName(__CLASS__), ($returnArray ?
"" : __CLASS__), $where);
49 $query = sprintf(
"REPLACE INTO %s (IdAccount, DataKey, DataValue) VALUES (%d, '%s', '%s')",
50 self::GetTableName(__CLASS__),
52 $Database->Escape($this->DataKey),
53 $Database->Escape($this->DataValue));
54 return $Database->Query($query);
64 if ($this->IdAccount > 0 && $this->DataKey) {
65 return $this->_Delete(self::GetTableName(__CLASS__), sprintf(
"IdAccount = %d AND DataKey = '%s'", $this->IdAccount, $Database->Escape($this->DataKey)));
73 public static function Prune() {
74 self::TruncateClass(__CLASS__);
86 $data->IdAccount = $idAccount;
87 $data->DataKey = $key;
88 $data->DataValue = $value;
99 if (!is_array($keys)) {
100 $keys = array($keys);
103 foreach ($keys as $key) {
105 $data->IdAccount = $idAccount;
106 $data->DataKey = $key;
107 if ($data->Delete()) {
static Load($idAccount, $returnArray=false)
static DeleteCustomData($idAccount, $keys)
__construct($src=null, $stripSlashes=false)
static SetCustomData($idAccount, $key, $value)