Combu Server  3.1.1
PHP API Documentation
GameMatch_CustomData.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Combu;
4 
11 
12  const TABLE_NAME = "Match_CustomData";
13 
14  public $IdMatch = 0;
15  public $DataKey = "";
16  public $DataValue = "";
17 
21  public function __construct($src = null, $stripSlashes = false) {
22  if ($src == null)
23  return;
24  if (is_array($src)) {
25  // Load by array
26  $this->_loadByRow($src, $stripSlashes);
27  }
28  }
29 
37  public static function Load ($idMatch, $returnArray = false) {
38  $where = sprintf("IdMatch = %d", $idMatch);
39  return self::_load(self::GetTableName(__CLASS__), ($returnArray ? "" : __CLASS__), $where);
40  }
41 
47  public function Save() {
48  global $Database;
49  $query = sprintf("REPLACE INTO %s (IdMatch, DataKey, DataValue) VALUES (%d, '%s', '%s')",
50  self::GetTableName(__CLASS__),
51  $this->IdMatch,
52  $Database->Escape($this->DataKey),
53  $Database->Escape($this->DataValue));
54  return $Database->Query($query);
55  }
56 
62  public function Delete() {
63  global $Database;
64  if ($this->IdMatch > 0 && $this->DataKey) {
65  return $this->_Delete(self::GetTableName(__CLASS__), sprintf("IdMatch = %d AND DataKey = '%s'", $this->IdMatch, $Database->Escape($this->DataKey)));
66  }
67  return FALSE;
68  }
69 }
__construct($src=null, $stripSlashes=false)
static Load($idMatch, $returnArray=false)
Definition: Account.php:3