本文整理匯總了PHP中Host::setId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Host::setId方法的具體用法?PHP Host::setId怎麽用?PHP Host::setId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Host
的用法示例。
在下文中一共展示了Host::setId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create
public function create(Host &$host)
{
if ($host == null) {
Utils::log(LOG_DEBUG, "Exception", __FILE__, __LINE__);
throw new Exception("Host object is not valid");
}
$this->db->query("insert into Host set\n \thostname='" . $this->db->escape($host->getHostname()) . "',\n \tip='" . $this->db->escape($host->getIp()) . "',\n \treporterIp='" . $this->db->escape($host->getReporterIp()) . "',\n \treporterHostname='" . $this->db->escape($host->getReporterHostname()) . "',\n \tkernel='" . $this->db->escape($host->getKernel()) . "',\n \tosId=" . $this->db->escape($host->getOsId()) . ",\n \tarchId=" . $this->db->escape($host->getArchId()) . ",\n \tdomainId=" . $this->db->escape($host->getDomainId()) . ",\n \tlastReportId=" . ($host->getLastReportId() == -1 ? "NULL" : $this->db->escape($host->getLastReportId())) . ",\n \ttype='" . $this->db->escape($host->getType()) . "',\n ownRepositoriesDef=" . $this->db->escape($host->getOwnRepositoriesDef()));
# Set the newly assigned id
$host->setId($this->db->getLastInsertedId());
Utils::log(LOG_DEBUG, "Host created", __FILE__, __LINE__);
}