powered by Jive Software

CustomDatabase with Triggers...I need help :(

Hello everybody,

I am currently developing quite a few plugins.

Now I have a table which I want to enhance by using triggers.

My Creation Script will try to add the triggers like this:

– ******** –

– TRIGGERS –

– ******** –

DELIMITER |

– ofUser

CREATE TRIGGER ofUser_TRIGGER_CREATE AFTER INSERT ON openfire.ofUser

FOR EACH ROW BEGIN

INSERT INTO paUserDetails (userID, firstname, lastname, street, zip, gender, nickname, image, city) VALUES (NEW.username, ‘’, ‘’, ‘’, ‘’, 0, ‘User’, ‘’, ‘’);

END;

|

CREATE TRIGGER ofUser_TRIGGER_DELETE BEFORE DELETE ON openfire.ofUser

FOR EACH ROW BEGIN

DELETE FROM paAccountUnlockCodes WHERE userID = OLD.username;

DELETE FROM paUserDetails WHERE userID = OLD.username;

DELETE FROM ofGroupUser WHERE username = OLD.username;

DELETE FROM paUserPrivacyPolicyAccepted WHERE username = OLD.username;

DELETE FROM paUserTermsAndConditionsAccepted WHERE username = OLD.username;

END;

|

DELIMITER ;

Howver, since the “DELIMITER” statement is not supported I can not have those triggers.

Is there any other way for me to get the desired result?

I really need this to work. I could just add the triggers manually, but this is no solution for a real deployment.

Thanks in advance!

Hopefully http://docs.oracle.com/javase/tutorial/jdbc/basics/storedprocedures.html#create_ jdbc_mysql helps.