Name

record —

ATTRIBUTES

Attribute Pos. Req. Default Description
table
col
filter
key
show_error
interpolate     0 interpolate output?
hide     0 Hide the tag return value?

DESCRIPTION

BEHAVIOR

This tag does not appear to be affected by, or affect, the rest of Interchange.

EXAMPLES

No examples are available at this time. We do consider this a problem and will try to supply some.

NOTES

AVAILABILITY

record is available in Interchange versions:

4.6.0-5.7.0 (git-head)

SOURCE

Interchange 5.7.0:

Source: code/SystemTag/record.coretag
Lines: 58


# 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.
# 
# $Id: record.coretag,v 1.4 2007-03-30 23:40:49 pajamian Exp $

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      $Revision: 1.4 $
UserTag record              Routine      <<EOR
sub {
my ($opt) = @_;
my $db = $Vend::Database{$opt->{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

AUTHORS

Interchange Development Group

SEE ALSO

DocBook! Interchange!