本文整理汇总了PHP中Connection::requestDb方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::requestDb方法的具体用法?PHP Connection::requestDb怎么用?PHP Connection::requestDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection::requestDb方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($I_id)
{
// requète préparée :
$S_sql = 'DELETE FROM team WHERE id = ?';
$A_params = array($I_id);
$O_connection = new Connection();
$O_connection->requestDb($S_sql, $A_params);
return true;
}
示例2: findAll
public function findAll()
{
$S_sql = 'SELECT id, name, safety_norm FROM category_epi';
$O_connection = new Connection();
if ($A_data = $O_connection->requestDb($S_sql, null, self::CLASS_NAME)) {
return $A_data;
} else {
throw new Exception("Une erreur s'est produite lors de la recherche des category");
}
}
示例3: findById
public function findById($id)
{
$S_sql = 'SELECT id, name, length FROM safety_line WHERE id = ?';
$A_params = array($id);
$O_connection = new Connection();
if ($O_data = $O_connection->requestDb($S_sql, $A_params, self::CLASS_NAME, $onlyOneObject = true)) {
return $O_data;
} else {
throw new Exception("une erreur c'est produite lors de la requête");
}
}
示例4: findBySubgroup
public function findBySubgroup($id)
{
$S_sql = 'SELECT s.id, s.name, s.description FROM team AS t
INNER JOIN staff AS s ON s.id = t.staff_id
WHERE subgroup_id = ?';
$A_params = array($id);
$O_connection = new Connection();
if ($A_staff = $O_connection->requestDb($S_sql, $A_params, self::CLASS_NAME)) {
return $A_staff;
} else {
throw new Exception("une erreur c'est produite lors de la requête findByCompany");
}
}
示例5: update
public function update(Profile $O_profile)
{
if (!is_null($O_profile->getId())) {
if (!$O_profile->getName() || !$O_profile->getSlug() || !$O_profile->getLevel()) {
throw new Exception("Des informations obligatoires sont manquantes, nous ne pouvons pas mettre à jour le profile");
}
$I_id = $O_profile->getId();
$S_name = $O_profile->getName();
$S_sql = 'UPDATE profile SET name = ? WHERE id = ?';
$A_params = array($S_name, $I_id);
$O_connection = new Connection();
if ($A_data = $O_connection->requestDb($S_sql, $A_params)) {
return true;
}
}
return false;
}
示例6: findByOperator
public function findByOperator($id)
{
// requête préparée :
$S_sql = 'SELECT c.id, c.name, c.address
FROM user AS u
LEFT JOIN operator AS o ON o.id = u.operator_id
LEFT JOIN team AS t ON t.id = o.team_id
LEFT JOIN subgroup AS s ON s.id = t.subgroup_id
LEFT JOIN company AS c ON c.id = s.company_id
WHERE u.operator_id = ?';
$A_params = array($id);
$O_connection = new Connection();
if ($O_staff = $O_connection->requestDb($S_sql, $A_params, self::CLASS_NAME, $onlyOneObject = true)) {
return $O_staff;
} else {
throw new Exception("une erreur c'est produite lors de la requête");
}
}
示例7: findByCompany
public function findByCompany($id)
{
$S_sql = 'SELECT * FROM subgroup WHERE company_id = ?';
$A_params = array($id);
$O_connection = new Connection();
if ($A_subgroup = $O_connection->requestDb($S_sql, $A_params, self::CLASS_NAME)) {
$A_subgroups = array();
foreach ($A_subgroup as $O_subgroup) {
$O_companyMapper = new CompanyMapper();
$O_company = $O_companyMapper->findById($id);
$O_subgroup->setCompany($O_company);
$A_subgroups[] = $O_subgroup;
}
return $A_subgroup;
} else {
throw new Exception("une erreur c'est produite lors de la requête findByCompany");
}
}
示例8: changePassword
public function changePassword($O_user, $S_password)
{
$S_passwordSha1 = sha1($S_password);
$S_sql = 'UPDATE user SET password = ? WHERE id = ?';
$A_params = array($S_passwordSha1, $O_user->getId());
$O_connection = new Connection();
if ($A_data = $O_connection->requestDb($S_sql, $A_params)) {
return true;
}
}
示例9: insert
public function insert(Epi $O_epi)
{
if (!is_null($O_epi->getDealer() && $O_epi->getOrderNumber() && $O_epi->getManufactureDate() && $O_epi->getPurchaseDate() && $O_epi->getProfile() && $O_epi->getInternalReference() && $O_epi->getCommissioningDate() && $O_epi->getLastCheckDate() && $O_epi->getNextCheckDate() && $O_epi->getEndOfLifeDate() && $O_epi->getLabelEpiId())) {
// var_dump($O_epi);
$S_dealer = $O_epi->getDealer();
$S_order_number = $O_epi->getOrderNumber();
$D_manufacture_date = $O_epi->getManufactureDate()->format('Y-m-d H:i:s');
$D_purchase_date = $O_epi->getPurchaseDate()->format('Y-m-d H:i:s');
$S_profile = $O_epi->getProfile();
$S_internal_reference = $O_epi->getInternalReference();
$D_commissioning_date = $O_epi->getCommissioningDate()->format('Y-m-d H:i:s');
$D_last_check_date = $O_epi->getLastCheckDate()->format('Y-m-d H:i:s');
$D_next_chack_date = $O_epi->getNextCheckDate()->format('Y-m-d H:i:s');
$D_end_of_life_date = $O_epi->getEndOfLifeDate()->format('Y-m-d H:i:s');
$I_label_epi_id = $O_epi->getLabelEpiId();
$I_team_id = $O_epi->getTeamId();
$S_sql = 'INSERT INTO `epi` (`dealer`, `order_number`, `manufacture_date`, `purchase_date`, `profile`, `internal_reference`, `commissioning_date`, `last_check_date`, `next_check_date`, `end_of_life_date`, `label_epi_id`, `team_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
$A_params = array($S_dealer, $S_order_number, $D_manufacture_date, $D_purchase_date, $S_profile, $S_internal_reference, $D_commissioning_date, $D_last_check_date, $D_next_chack_date, $D_end_of_life_date, $I_label_epi_id, $I_team_id);
$O_connection = new Connection();
if ($I_epiId = $O_connection->requestDb($S_sql, $A_params)) {
return $I_epiId;
} else {
throw new Exception("Des informations obligatoires sont manquantes, nous ne pouvons pas créer le modèle");
}
}
}
示例10: insert
public function insert(Check $O_check)
{
$epi_id = $O_check->getEpiId();
$inspector_id = $O_check->getInspectorId();
$control_date = $O_check->getControlDate()->format('Y-m-d H:i:s');
$conform = $O_check->getConform();
$comment = $O_check->getComment();
$S_sql = 'INSERT INTO check_epi (epi_id, inspector_id, control_date, conform, comment) VALUES (?, ?, ?, ?, ?)';
$A_params = array($epi_id, $inspector_id, $control_date, $conform, $comment);
$O_connection = new Connection();
if ($I_checkId = $O_connection->requestDb($S_sql, $A_params)) {
return $I_checkId;
}
}
示例11: findAll
public function findAll()
{
$S_sql = 'SELECT `id`, `label`, `model`, `reference`, `description`, `lifetime`, `control_cycle`, `notice`, `procedure`, `image`, `size`, `color`, `category_epi_id` FROM `label_epi`';
$O_connection = new Connection();
if ($A_data = $O_connection->requestDb($S_sql, null, self::CLASS_NAME)) {
return $A_data;
} else {
throw new Exception("Une erreur s'est produite");
}
}