示例#1
0
 /**
  * Deletes the given Tag2Alls from the database.
  * @param array(Tag2All) $Tag2Alls
  * @param User $CurrentUser
  */
 public static function DeleteMulti($Tag2Alls, $CurrentUser)
 {
     global $dbi;
     $outBool = TRUE;
     if (!is_array($Tag2Alls)) {
         return FALSE;
     }
     foreach ($Tag2Alls as $t2a) {
         $q = sprintf("\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`Tag2All`\n\t\t\t\tWHERE\n\t\t\t\t\t`tag_id` = ?\n\t\t\t\t\tAND `model_id` %1\$s\n\t\t\t\t\tAND `set_id` %2\$s\n\t\t\t\t\tAND `image_id` %3\$s\n\t\t\t\t\tAND `video_id` %4\$s ", $t2a->getModelID() ? '= ?' : 'IS NULL', $t2a->getSetID() ? '= ?' : 'IS NULL', $t2a->getImageID() ? '= ?' : 'IS NULL', $t2a->getVideoID() ? '= ?' : 'IS NULL');
         if (!($stmt = $dbi->prepare($q))) {
             $e = new SQLerror($dbi->errno, $dbi->error);
             Error::AddError($e);
             return FALSE;
         }
         DBi::BindParamsToDeleteT2A($t2a, $stmt);
         $outBool = $stmt->execute();
         if (!$outBool) {
             $e = new SQLerror($dbi->errno, $dbi->error);
             Error::AddError($e);
         }
         $stmt->close();
     }
     return $outBool;
 }