[ic] Accessing $Db or $Sql in Jobs?

Jeff Fearn jefffearn at gmail.com
Thu Jan 6 22:39:51 EST 2005

Ok, after _much_ confusion on my part, I have finally figured out how
to get a ref to the DB ... or maybe just the table, either way I can
run select statements via $db->query.

However when I try to update the table I get "Attempt to write
read-only table orderline" errors.

Here is part of the code I am using:

my $tablename = "orderline";
$Tag->perl({tables => $tablename});

my $db = database_exists_ref( $tablename ) or die "Couldn't get handle
to table  $tablename'!";

$db = $db->ref();

# Works fine
$sql = "select code from $tablename where order_number = '$order_num'";
my @result = $db->query({type => 'row_count', sql => $sql});
my $num_lines = $result[0];

my $code = 'TEST0061-1';
$sql = "update $tablename set status = 'shipped' where code = '$code'";

# Both of these fail!
$db->set_field($temp, 'status', 'shipped');
$db->query({sql => $sql}) || die("Couldn't update orderline: $_");

$_ is NULL in the above die, how do I get the error message?

If the tag is setup as a global tag, as suggested befor, why does it
have access restrictions?

If it's not a global tag why does $Tag->perl... have no effect?

Where are you supposed to locate local usertags? i.e. which directory

Where are database_exists_ref and the like documented? I have searched
the website and RTFM site and have only found references in the change

Thanks for you help and patience :)


More information about the interchange-users mailing list