dbTalk Databases Forums  

create trigger syntax

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss create trigger syntax in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
pmeade@gmail.com
 
Posts: n/a

Default create trigger syntax - 08-24-2006 , 02:25 PM






Hello all,

I need to create database triggers from within my c++ code. I've been
having trouble figuring out how to do this with mysql++. The sql code I
would use to do this is as follows:

delimiter $
create trigger init_Real_Cell before insert on Real_Cell
for each row begin
set new.CDate = current_timestamp;
set new.MDate = current_timestamp;
end$
delimiter ;

I've tried building a string containing those lines and then using the
Execute method, but mysql complains about the syntax. I believe the
problem is because I am trying to put a multi line command into a
single line method (Execute or Query).

Has anyone else done this before? I could really use some advice on how
to add these triggers from my code. At this point I'm thinking about
using an external script that I would call from my c++ code but I
_really_ don't want to do that.

Thanks,
Patrick


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.