Creating trigger
Posted by: asadilan indrabudi
Date: November 23, 2011 06:21PM

Hi all,

I would like to create a trigger from my code:
wxString queryStr;
queryStr.Printf("\nDelimiter $$ \n"
"Create Trigger `%s`.after_environment_delete \n"
"After DELETE on `%s`.`Environment` \n"
"FOR each row \n"
"BEGIN\n "
"Delete from `%s`.`vehicle selection` where `environment uniqueid` = OLD.EnvironmentUniqueId;\n"
"Delete from `%s`.`testEnvironmentSelection` where `environmentuniqueid` = OLD.EnvironmentUniqueId;\n"
"Delete from `%s`.`SimulatedAutpilotSelection` where `environment uniqueid` = OLD.EnvironmentUniqueId;\n"
"Delete from `%s`.`locListSelection` where `environmentuniqueid` = OLD.EnvironmentUniqueId;\n"
"Delete from `%s`.`iniFileSelection` where `environmentuniqueid` = OLD.EnvironmentUniqueId;\n"
"Delete from `%s`.`flyFileSelection` where `environmentuniqueid` = OLD.EnvironmentUniqueId;\n"
"Delete from `%s`.`calibrationSelection` where `environmentuniqueid` = OLD.EnvironmentUniqueId;\n"
"End $$",
tableName,
tableName,
tableName,
tableName,
tableName,
tableName,
tableName,
tableName,
tableName);
OutputDebugString("\n" + queryStr);

thats the code and i use tiodbc::statement class (stmt.execute_direct(queryStr))

the result after executing the code is trigger is not created.

i use the following text in workbench:

Delimiter $$
Create Trigger `ReconfigurableTester`.after_environment_delete
After DELETE on `ReconfigurableTester`.`Environment`
FOR each row
BEGIN
Delete from `ReconfigurableTester`.`vehicle selection` where `environment uniqueid` = OLD.EnvironmentUniqueId;
Delete from `ReconfigurableTester`.`testEnvironmentSelection` where `environmentuniqueid` = OLD.EnvironmentUniqueId;
Delete from `ReconfigurableTester`.`SimulatedAutpilotSelection` where `environment uniqueid` = OLD.EnvironmentUniqueId;
Delete from `ReconfigurableTester`.`locListSelection` where `environmentuniqueid` = OLD.EnvironmentUniqueId;
Delete from `ReconfigurableTester`.`iniFileSelection` where `environmentuniqueid` = OLD.EnvironmentUniqueId;
Delete from `ReconfigurableTester`.`flyFileSelection` where `environmentuniqueid` = OLD.EnvironmentUniqueId;
Delete from `ReconfigurableTester`.`calibrationSelection` where `environmentuniqueid` = OLD.EnvironmentUniqueId;
End $$

and trigger is created. i dont see any difference between the 2, other than one is from workbench the other is in the code.

Any idea why this is happening?

TIA
Asa

Options: ReplyQuote


Subject
Views
Written By
Posted
Creating trigger
1151
November 23, 2011 06:21PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.