コード例 #1
0
ファイル: DataType.inc.php プロジェクト: alcexhim/PhoenixSNS
 /**
  * Retrieves a single DataType with the given name
  * @param string $name The name used in code to identify this DataType
  * @return NULL|\PhoenixSNS\Objects\DataType The DataType with the given name, or null if no DataType with the given name was found
  */
 public static function GetByName($name)
 {
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "DataTypes WHERE datatype_Name = '" . $MySQL->real_escape_string($name) . "'";
     $result = $MySQL->query($query);
     if ($result === false) {
         return null;
     }
     $count = $result->num_rows;
     if ($count == 0) {
         PhoenixSNS::Log("No data type with the specified name was found.", array("DataType" => $name));
         return null;
     }
     $values = $result->fetch_assoc();
     return DataType::GetByAssoc($values);
 }