ARSperl
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
example/ars_QualDecode.pl view on Meta::CPAN
elsif(defined($h->{DB_fieldId})) {
print "\tDB_fieldId: $h->{DB_fieldId}\n" if $debug;
$e = "'DB.".$fids{$h->{DB_fieldId}}."'";
}
# a value
elsif(exists($h->{value})) {
if(! defined($h->{value})) {
# this is a NULL
$e = NULL;
}
elsif($h->{value} =~ /^\000/) {
# this is a keyword
$h->{value} =~ s/\000/\$/g;
$h->{value} =~ tr [a-z] [A-Z];
$e = $h->{value};
}
elsif($h->{value} =~ /\D/) {
# this is an alphanum string
$e = '"'.$h->{value}.'"';
}
else {
# this is a number
$e = "$h->{value}";
}
}
# an arithmetic expression
# not implemented. see code in GetField.pl for
# example of decoding. i dont think ARS allows
# arith in the qualification (i think aradmin will
# give an error) so this is irrelevant to this
# demo.
elsif(defined($h->{arith})) {
# addition by "David Adams" <D.J.Adams@soton.ac.uk>
local($ar) = $h->{arith};
$e .= "(".Decode_FVoAS($ar->{left}, $fids)." ".$ar->{oper}." ".Decode_FVoAS($ar->{right}, $fids).")";
}
# a set of values (used for the "IN" operator)
# i've never really seen the "IN" keyword used
# either.. so i'll just flag it and dump something
# semi-appropriate.
elsif(defined($h->{valueSet})) {
$e = "valueSet(".join(',', @{$h->{valueSet}}).")";
}
# a local variable. this is in the API, but i dont think
# it's a real feature that is available.. perhaps
# something that remedy is working on? hmm..
elsif(defined($h->{variable})) {
$e = "variable($h->{variable})";
}
# an external query on another schema. not sure
# how this works so we'll let it go for now..
# i can't think of how this works for a filter
# or active link.. perhaps this is more "in development"
# stuff at remedy? either that or this structure is also
# used for query menus maybe..
elsif(defined($h->{queryValue})) {
$e = "external_query";
}
# comparing against the status history. useful,
# but i dont think i'll bother to decode it here.
#
# you would need to examine the statHistory which
# contains "userOrTime" and "enumVal". you will then
# contruct "StatusHistory.USER.[enum]" or "..TIME.[enum]"
# where enum is the name of the enumerated value (like
# "Closed" or whatever). USER or TIME keywords are
# determined from the userOrTime value (1 or 2).
elsif(defined($h->{statHistory})) {
$e = "[statusHistory]";
}
# a query against a value of a field in
# the current schema
elsif(defined($h->{queryCurrent})) {
if($fids{$h->{queryCurrent}} ne "") {
$e = "current('".$fids{$h->{queryCurrent}}."')";
} else {
$e = "current('".$h->{queryCurrent}."')";
}
}
else {
print "WARNING: unknown FieldValueOrArithStruct hash key\n";
printf ("{%s}\n", keys %{$h});
}
return $e;
}
1;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.531 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )