Combu Server  3.1.1
PHP API Documentation
Tournament_CustomData.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Combu;
4 
11 
12  const TABLE_NAME = "Tournament_CustomData";
13 
14  public $IdTournament = 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 ($idTournament, $returnArray = false) {
38  $where = sprintf("IdTournament = %d", $idTournament);
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 (IdTournament, DataKey, DataValue) VALUES (%d, '%s', '%s')",
50  self::GetTableName(__CLASS__),
51  $this->IdTournament,
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->IdTournament > 0 && $this->DataKey) {
65  return $this->_Delete(self::GetTableName(__CLASS__), sprintf("IdTournament = %d AND DataKey = '%s'", $this->IdTournament, $Database->Escape($this->DataKey)));
66  }
67  return FALSE;
68  }
69 }
static Load($idTournament, $returnArray=false)
__construct($src=null, $stripSlashes=false)
Definition: Account.php:3