bcom/clazz/2/Message.class.php

33 lines
909 B
PHP

<?php
class Message{
public static function postMessage($sid,$mdp,$did,$text){
$req = $GLOBALS['bdd']->prepare('CALL `PostMessage`(:sid,:mdp,:did,:text,@o);');
$req->bindValue(':sid', $sid);
$req->bindValue(':mdp', $mdp);
$req->bindValue(':did', $did);
$req->bindValue(':text', $text);
$req->execute();
$rep = $GLOBALS['bdd']->query('SELECT @o AS outputCode')->fetch();
if($rep['outputCode'] != 42)throw new SQLProcessingException($rep['outputCode']);
}
public static function deleteMessage($sid,$mdp,$mid){
$req = $GLOBALS['bdd']->prepare('CALL `DeleteMessage`(:sid,:mdp,:mid,@o);');
$req->bindValue(':sid', $sid);
$req->bindValue(':mdp', $mdp);
$req->bindValue(':mid', $mid);
$req->execute();
$rep = $GLOBALS['bdd']->query('SELECT @o AS outputCode')->fetch();
if($rep['outputCode'] != 42)throw new SQLProcessingException($rep['outputCode']);
}
}