Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: Problems with GT::SQL::Table->delete: Edit Log

Here is the list of edits for this post
Problems with GT::SQL::Table->delete
Hi, I have a table with combination primary key (tid, pid), I want to delete all records where tid = x how can I do this? Is there an easy way?

I have tried using a condition object but it failed:
$cond = GT::SQL::Condition->new('tid', '=', $tid);
doesn't work.

I have also tried select all pid where tid = $tid, looping through the results and calling delete on each iteration as follows:
$handle = $table->select( { tid => $tid }, ['pid'] );
while(my $row = $handle->fetchrow_hashref) {
$table->delete( { tid => $tid, pid => $row->{'pid'} } );
}

And it fails saying it cannot make a condition object. Besides this is not very efficient.

Does anyone have any ideas?

Thanks in advance, regards,
Tommy

Last edited by:

tommyfotak: Sep 26, 2002, 1:00 PM

Edit Log: