1 # Copyright 2002-2007 Interchange Development Group and others
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version. See the LICENSE file for details.
8 # $Id: record.coretag,v 1.4 2007-03-30 23:40:49 pajamian Exp $
10 UserTag record addAttr
11 UserTag record attrAlias column col
12 UserTag record attrAlias code key
13 UserTag record attrAlias field col
14 UserTag record PosNumber 0
15 UserTag record Version $Revision: 1.4 $
16 UserTag record Routine <<EOR
19 my $db = $Vend::Database{$opt->{table}};
20 return undef if ! $db;
22 # This can be called from Perl
24 my $hash = $opt->{col};
25 my $filter = $opt->{filter};
27 return undef unless defined $opt->{key};
28 my $key = $opt->{key};
29 return undef unless ref $hash;
30 undef $filter unless ref $filter;
32 @vals = values %$hash;
38 if(! defined $db->test_column($_) ) {
39 splice (@cols, $i, 1);
40 my $tmp = splice (@vals, $i, 1);
41 ::logError("bad field %s in record update, value=%s", $_, $tmp);
44 next unless defined $filter->{$_};
45 $vals[$i] = filter_value($filter->{$_}, $vals[$i], $_);
51 my $status = $db->set_slice($key, \@cols, \@vals);
54 return $@ if $opt->{show_error};