[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Delete row
At 04:29 PM 03/14/2001 +0200, you wrote:
>Hi all,
>
>Can anybody give me an example how to delete a specific row of a specific
>table?
>In SQL it would be like DELETE FROM TABLENAME WHERE COLUMNNAME="x";
>But what should I do in [ic] and using non-sql-based table (gdbm)?
>
>I tried:
>[sql interpolate=1]delete from mytable where id="[value em_id]" and
>username="[data session username]"[/sql]
>but nothing happened. (Also no error message in error.log)
>
Here is a Usertag from (from Mike Heins, I believe), orginally for earlier
Minivend versions, but it may work in Interchange, though some tweaking
could be necessary:
#To use it as a tag:
#
# [tag flag write]products[/tag]
# [delete_record table="products" key="00-0011a"]
#
#I will leave the production of a subroutine as an exercise for
#the reader.
#
#Of course [tag flag write] must be at the top of the page. And of
#course this won't work with the old parser.
#
#If you want to update the ASCII source file, of course:
#
# [tag export products][/tag]
################################################################
UserTag delete_record Order table key
UserTag delete_record PosNumber 2
UserTag delete_record Routine <<EOR
sub {
my ($table, $key) = @_;
return "Delete-record requires all information" unless $table and $key;
my $db = Vend::Data::database_exists_ref($table) or return "Bad table
'$table'.";
$db = $db->ref();
$db->record_exists($key) or return "No key '$key' in table '$table'.";
return $db->delete_record($key);
}
EOR
- Ed L.
===============================================================
**** Virtual Hosting w/private IC Installation, $65/month! ****
---------------------------------------------------------------
New Media E.M.S. Software Solutions for Business
463 Main St., Suite D eCommerce | Consulting | Hosting
Placerville, CA 95667 edl@newmediaems.com
(530) 622-9421 http://www.newmediaems.com
(866) 519-4680 Toll-Free (530) 622-9426 Fax
===============================================================
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users