Changeset 921 for trunk/Modules/Network/NetworkModels.php
- Timestamp:
- Feb 25, 2022, 9:30:55 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Network/NetworkModels.php
r911 r921 192 192 $Desc = new ModelDesc(self::GetClassName()); 193 193 $Desc->AddDateTime('Time'); 194 $Desc->Add String('MAC');194 $Desc->AddReference('MAC', NetworkMac::GetClassName()); 195 195 $Desc->AddReference('Interface', NetworkInterface::GetClassName()); 196 196 $Desc->AddInteger('Value'); … … 342 342 } 343 343 } 344 345 class NetworkMac extends Model 346 { 347 static function GetModelDesc(): ModelDesc 348 { 349 $Desc = new ModelDesc(self::GetClassName()); 350 $Desc->AddString('MAC'); // size=17 351 return $Desc; 352 } 353 354 function GetIndex(string $MAC) 355 { 356 $DbResult = $this->Database->select('NetworkMac', 'Id', 'MAC="'.$MAC.'"'); 357 if ($DbResult->num_rows > 0) 358 { 359 $DbRow = $DbResult->fetch_assoc(); 360 return $DbRow['Id']; 361 } else 362 { 363 return $this->Database->insert('NetworkMac', array('MAC' => $MAC)); 364 } 365 } 366 }
Note:
See TracChangeset
for help on using the changeset viewer.