It appears that there is an issue with the single quotes when creating the trigger, as you end up with 2 single quotes in the table. As mentioned above a shell wrapper would help, with the literal in the shell script. We'll take a look into why the escaped single quote isn't passed through correctly.
But, if I go to my web application and run an update on the users table i get a timeout. The users table gets updated but the triggers table never gets the new data.
the vortex log file gets this error:
000 Jan 23 11:55:32 /vortex/userEditor:144: Timeout
000 Jan 23 11:55:32 [module=/local/sites/board_dev/htdocs/vortex/modules/standard]:703: Timeout
userEditor line 144 is a call to a funtion in the module:
<top>
and line 703 in the module is this sql:
<sql max="1" "select id user_id,password
from users
where username = $User">
</sql>
I'm finally trying this trigger stuff, and having problems. When I try this:
bash-2.00$ texis "create trigger del_patron_orders after delete on patrons for each row shell 'tsql "delete from orders where PID in (select PID from patrons)"'"
I get a syntax error:
bash: syntax error near unexpected token `(s'
When I try this:
bash-2.00$ texis "create trigger del_patron_orders after delete on patrons for each row shell 'tsql ''delete from orders where PID in (select PID from patrons)'''"
the system accepts the trigger, but I get a shell error when the trigger executes:
You're encountering problems with your command interpreter (shell) interpreting quotes. It may be better for you encode your trigger as a shell script as described above to avoid the quoting problems. Otherwise you'll need to do some creative escaping of the quotes with \ so that the correct thing gets passed to each level of shell.
OK, now I've tried it in both a shell script and a vortex script, and I'm still having problems. I've seen references in this thread to "$table". Is that literal or does it stand for the name, which I should use. In others words, what precisely is the SQL syntax for the shell command? I've tried numerous variations, with and without the variable, in shell scripts, in Vortex scripts--and all fail for various reasons. Are there Texis version issues?
I want the trigger, when a record is deleted from the "patrons" table, to delete all related records in the "orders" table.
$db and $table may be used in the create trigger statement and will be replaced with the names of the database and temp table respectively when triggermode is 1. See triggermode http://www.thunderstone.com/site/texisman/node154.html
So your trigger action might be, as above:
... shell '/path/to/script $db $table'
The file /path/to/script might contain
#!/bin/sh
/usr/local/morph3/bin/tsql -q -d "$1" "delete from orders where PID in (select PID from $2)"
I have created an update trigger on a table as suggested in this article. I can see the trigger is being fired when I update a record but I get this error message and the shell script does not run.
002 Can't open KDBF file C:\TEMP\trigAAA.AAA.blb for writing: error 2: No such file or directory
You need to make sure that either you create the C:\TEMP directory, or make sure that the TMP or TEMP environment variables point to an existing directory.