[ic] Database transaction?

T. Stoffels tstoffels at gmail.com
Mon May 30 15:46:37 EDT 2005


Hi there
I need to delete items from multiple tables in *one* sql query (must
be a transaction).
How can I do that?
The [query] tag only seem sto accept one statement (i.e. max 1 semicolon).

Is there some way to do that from withing a perl tag?

I found this (http://www.icdevgroup.org/interchange-doc-5.2.0/frames/ictemplates_17.html):
--
[perl products]
            my $dbh = $Sql{products}
                or return "Database not shared.";
            my $sth = $dbh->prepare('select * from products')
                or return "Couldn't open database.";
            $sth->execute();
            my @record;
            while(@record = $sth->fetchrow()) {
                foo();
            }
            $sth = $dbh->prepare('select * from othertable')
                or return "Couldn't open database.";
            $sth->execute();
            while(@record = $sth->fetchrow()) {
                bar();
            }
          [/perl]
--

It seems to me, that a query from inside a perl statement is limited
to one table (since the table has to be passed in the [perl] tag.
When I give it a try it always throws the "Database not shared" at me.

thx in advance...



More information about the interchange-users mailing list