Hello,
Short introduction:
Every time when a thread is posted in a specific node, I want a poll to be added automatically.
I have already added a Procedure that adds the Poll with the following parameters: (ThreadID, Question, Answer 1, Answer 2, Answer 3). This Procedure has been tested and is working smoothly.
Now to automatize this, I wanted to add an After Insert Trigger on xf_thread. But this runs into an error.
My trigger is the following (we're using MySql if relevant):
In my procedure I edit the following tables: xf_thread, xf_poll, xf_poll_response
Creating Threads in node != 4 works fine. But when I create a thread in node 4, I'm experiencing an error. The call FSuggestionPolls Procedure was tested on already existing threads and worked perfectly fine.
Do I possibly have to set the trigger to another database because xf_table might be too early in the thread creation process?
Best regards
Ferity
Short introduction:
Every time when a thread is posted in a specific node, I want a poll to be added automatically.
I have already added a Procedure that adds the Poll with the following parameters: (ThreadID, Question, Answer 1, Answer 2, Answer 3). This Procedure has been tested and is working smoothly.
Now to automatize this, I wanted to add an After Insert Trigger on xf_thread. But this runs into an error.
My trigger is the following (we're using MySql if relevant):
Code:
delimiter //
create trigger xftables_Trig_SugPolls
after insert
on xf_thread
for each row
begin
if(new.node_id = 4) then
call FSuggestionPolls(new.thread_id,'Do you think that these suggestions should be implemented?','Yes','No','I don\'t care');
end if;
end //
delimiter ;
In my procedure I edit the following tables: xf_thread, xf_poll, xf_poll_response
Creating Threads in node != 4 works fine. But when I create a thread in node 4, I'm experiencing an error. The call FSuggestionPolls Procedure was tested on already existing threads and worked perfectly fine.
Do I possibly have to set the trigger to another database because xf_table might be too early in the thread creation process?
Best regards
Ferity
Last edited: