# Copyright 2002-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. UserTag record addAttr UserTag record attrAlias column col UserTag record attrAlias code key UserTag record attrAlias field col UserTag record PosNumber 0 UserTag record Version 1.4 UserTag record Routine <{table}}; return undef if ! $db; $db = $db->ref(); # This can be called from Perl my (@cols, @vals); my $hash = $opt->{col}; my $filter = $opt->{filter}; return undef unless defined $opt->{key}; my $key = $opt->{key}; return undef unless ref $hash; undef $filter unless ref $filter; @cols = keys %$hash; @vals = values %$hash; RESOLVE: { my $i = -1; for(@cols) { $i++; if(! defined $db->test_column($_) ) { splice (@cols, $i, 1); my $tmp = splice (@vals, $i, 1); ::logError("bad field %s in record update, value=%s", $_, $tmp); redo RESOLVE; } next unless defined $filter->{$_}; $vals[$i] = filter_value($filter->{$_}, $vals[$i], $_); } } my $status; eval { my $status = $db->set_slice($key, \@cols, \@vals); }; if($@) { return $@ if $opt->{show_error}; } return $status; } EOR