Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.14 KB | None | 0 0
  1. use wiekocheich;
  2.  
  3. DELIMITER $$
  4.  
  5. DROP PROCEDURE IF EXISTS `tsc_sp_add_page`$$
  6. CREATE PROCEDURE `tsc_sp_add_page` (in idfolder int(11), in title varchar(65), in template varchar(100))
  7. COMMENT 'creates a new page and adds all wildcards which will be shown infolder,InLanguage,InAll,InPage'
  8. BEGIN
  9.  
  10. --id of the inserted page
  11. DECLARE pageid INT(11);
  12.  
  13. --declarations for the loop
  14. DECLARE done INT DEFAULT 0;
  15. DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
  16.  
  17. --first we create the page record
  18.  
  19. INSERT INTO `tsc_page` (`id` ,`idfolder` , `title` , `template`) VALUES (NULL , idfolder, title , template);
  20. set pageid = LAST_INSERT_ID();
  21. --then we have to link all wildcards with the created page that will be shown infolder
  22.  
  23. --next we have to link all wildcards with the created page that will be shown InLanguage
  24.  
  25. --next we have to link all wildcards with the created page that will be shown InAll
  26.  
  27. declare c_wildcard cursor for SELECT `id` , `name` , `content` FROM `tsc_wildcard` WHERE `InAll` =1;
  28.  
  29.  
  30.  
  31. --next we have to link all wildcards with the created page that will be shown InPage
  32.  
  33.  
  34.  
  35. END$$
  36.  
  37. DELIMITER ;
  38.  
  39. --call tsc_sp_add_page();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement