duplicate posts and copies the postmeta from post to another
-
I am trying to make my site bilingual, so I need to duplicate posts and copies the postmeta from post to another. For this reason, i logged all query inserted to postmeta using trigger, and i try to execute it using this stored procedure but i have this error:
1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(s,concat(‘,’,_ID,’,’),concat(‘,’,_NEWID,’,’)) PREPARE stmt1 FROM s; EXECU’ at line 16DELIMITER \\ DROP PROCEDURE IF EXISTS <code>sp_postmeta_dynamic_sql</code>\\ CREATE PROCEDURE <code>sp_postmeta_dynamic_sql</code> (_ID int, _NEWID int) BEGIN DECLARE s varchar(1024); DECLARE done INT DEFAULT FALSE; DECLARE cur1 CURSOR FOR SELECT fwd_sql FROM logtable WHERE fwd_sql LIKE CONCAT('%,',_ID,',%') and modtable LIKE 'wp_postmeta'; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN cur1; read_loop: LOOP FETCH cur1 INTO s; IF done THEN LEAVE read_loop; END IF; REPLACE(s,concat(',',_ID,','),concat(',',_NEWID,',')) PREPARE stmt1 FROM s; EXECUTE stmt1 ; DEALLOCATE PREPARE stmt1; END LOOP; CLOSE cur1; END\\ DELIMITER ;
can you help me in this problem, Is there another way to resolve this issue? thanks in advance.
- The topic ‘duplicate posts and copies the postmeta from post to another’ is closed to new replies.