validate.sql 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. SET ":content" = (
  2. SELECT content
  3. FROM clip
  4. WHERE hash = :hash AND :tool = 'clip'
  5. UNION
  6. SELECT content
  7. FROM goto
  8. WHERE hash = :hash AND :tool = 'goto'
  9. UNION
  10. SELECT content
  11. FROM upload
  12. WHERE hash = :hash AND :tool = 'upload'
  13. );
  14. SET ":qr" = (
  15. SELECT qr
  16. FROM clip
  17. WHERE hash = :hash AND :tool = 'clip'
  18. UNION
  19. SELECT qr
  20. FROM goto
  21. WHERE hash = :hash AND :tool = 'goto'
  22. UNION
  23. SELECT qr
  24. FROM upload
  25. WHERE hash = :hash AND :tool = 'upload'
  26. );
  27. SET ":preview" = (SELECT preview FROM goto WHERE hash = :hash AND :tool = 'goto');
  28. SET ":file_name" = (SELECT name FROM upload WHERE hash = :hash AND :tool = 'upload');
  29. SET ":mime_type" = (SELECT mime FROM upload WHERE hash = :hash AND :tool = 'upload');
  30. SELECT 'dynamic' AS component, sqlpage.run_sql('sqlpage/QR.sql') AS properties
  31. WHERE COALESCE (:hash, '') <> '';
  32. SET ":inner" = CASE COALESCE(:content,'')
  33. WHEN '' THEN 'sqlpage/alert.sql'
  34. ELSE :tool||'/form.sql'
  35. END;
  36. SET ":icon" = 'error-404';
  37. SET ":status" = '404';
  38. SET ":title" = :status||' - Not found';
  39. SET ":description" = 'No such '||:tool||': '||:hash;
  40. SELECT 'dynamic' AS component, sqlpage.run_sql(:inner) AS properties;