view release on metacpan or search on metacpan
ARS/OOform.pm view on Meta::CPAN
my ($allfields) = 1;
if(defined($fields)) {
$allfields = 0;
foreach (@{$fields}) {
push @fieldlist, $this->getFieldID($_);
}
}
# what we want to do is: retrieve all of the values, but for
# certain datatypes (attachments) we want to insert
# an object instead of the field value. for enum types,
# we want to decode the value.
#print "("; print $this->{'form'}; print ", $eid, @fieldlist)\n";
my @v;
if($allfields == 0) {
@v = ARS::ars_GetEntry($this->{'connection'}->{'ctrl'},
$this->{'form'},
$eid, @fieldlist);
} else {
@v = ARS::ars_GetEntry($this->{'connection'}->{'ctrl'},
$this->{'form'},
$eid);
}
my @rv;
for(my $i = 0 ; $i <= $#v ; $i += 2) {
if($this->getFieldType(-id => $v[$i]) eq "attach") {
push @rv, $v[$i+1]; # "attach";
}
elsif($this->getFieldType(-id => $v[$i]) eq "enum") {
push @rv, $this->internal2value(-id => $v[$i],
-value => $v[$i+1]);
}
else {
push @rv, $v[$i+1];
}
}
ARS/OOform.pm view on Meta::CPAN
@v = ARS::ars_GetEntry($this->{'connection'}->{'ctrl'},
$this->{'form'},
$eid, @fieldlist);
} else {
@v = ARS::ars_GetEntry($this->{'connection'}->{'ctrl'},
$this->{'form'},
$eid);
}
for(my $i = 0 ; $i <= $#v ; $i += 2) {
if($this->getFieldType(-id => $v[$i]) eq "attach") {
#$v[$i+1] = "attach";
}
elsif($this->getFieldType(-id => $v[$i]) eq "enum") {
$v[$i+1] = $this->internal2value(-id => $v[$i],
-value => $v[$i+1]);
}
$v[$i] = $this->getFieldName(-id => $v[$i]);
}
return @v;
}
# getAttachment(-entry => eid, -field => fieldname, -file => filename)
# if file isnt specified, the attachment is returned "in core"
sub getAttachment {
my $this = shift;
my ($eid, $field, $file) = ARS::rearrange([ENTRY,FIELD,FILE],@_);
if(!defined($eid) && !defined($field)) {
$this->{'connection'}->pushMessage(&ARS::AR_RETURN_ERROR,
81000,
"usage: getAttachment(-entry => eid, -field => fieldname, -file => filename)\nentry and field parameters are required.");
}
Released: 04/7/99 Version: 1.6403 BETA
(JCM) tested/fixed compiling against pre-4.0 apis.
(JCM) OO: now checks named params to ensure you don't
mis-spell them.
(JCM) attachment allows specify a 'name' hash key so you can
customize the name that appears in the attachment field
in the usertool. (Nick Stoughton {NickS at ISRWORLD.com})
(JCM) OO: form->setSort method added
(JCM) OO: better error handling/catching
(JCM) OO: fixed bug in value2internal
(JCM) fixed NTRegisterServer(), fixed example/3.x/Notifier.pl
(JCM) fixed bug in ars_GetListServer() for api >= 4.0
Released: 03/12/99 Version: 1.6400 BETA
(JCM) added new LIBS line to Makefile.PL to cover NCR Unix
("Hill, David K" {david.k.hill at intel.com})
(JCM) added ars_GetEntryBLOB (attachment field handling)
thanks to "Kaelin Colclasure" {kaelin at talarian.com}
for supplying part of the code for the BLOB functions.
(JCM) simplified Makefile.PL configuration steps
(JCM) added attachment example scripts
(JCM) added basic OO layer
(JCM) added small test suite
(JCM) fixed some broken 4.0 related conditional compilation
stuff
(JCM) makefile now automatically converts C header files into
perl files so that all constants (C 'defines') are
html/manual/ds_charmenu_sql_hash.html
html/manual/ars_CreateEntry.html
html/manual/ds_bytelist_hash.html
html/manual/ars_GetMultipleEntries.html
html/manual/ars_ExecuteProcess.html
html/manual/ds_msgstruct_hash.html
html/manual/ars_GetActiveLink.html
html/manual/ars_DateToJulianDate.html
html/manual/ds_getlistgroup_hash.html
html/manual/ars_CreateImage.html
html/manual/ds_attach_hash.html
html/manual/ds_shv.html
html/manual/ds_fc.html
html/manual/ds_dsl_hash.html
html/manual/ars_SetVUI.html
html/manual/ars_DeleteEscalation.html
html/manual/ds_statstruct_hash.html
html/manual/ars_GetListEntry.html
html/manual/ars_SetContainer.html
html/manual/ars_SetEscalation.html
html/manual/AR_HOUR.html
example/ars_GetListEntry.pl
example/getAttachment-OO.pl
example/00-ReadMe
example/ars_GetListContainer.pl
example/Show_ALink.pl
example/ars_GetListEntryWithMultiSchemaFields.pl
example/GetFilter.pl
example/Show_Menu.pl
example/Dump_Setup.pl
example/ars_GetListGroup.pl
example/attachTest.pl
example/ars_GetControlStructFields.pl
example/ars_decodeStatusHistory.pl
example/ars_GetListSQL.pl
example/ars_DateToJulianDate.pl
example/ars_SetServerInfo.pl
example/AddUsersToGroup.pl
example/WhoUsesIt.pl
example/List_Entries.pl
example/GetField.pl
example/del_all.pl
don't retrieve the actual definitions of these objects in their
scripts.
In addition, ars_Import() has changed. It now has a different
parameter list. This means that existing scripts will need to
be updated. See the documentation on this function for details.
When compiling against an API revision prior to ARS4.5, the hashes returned
by the above functions include a "schema" key which denotes which schema
the object is "attached" to. As of 4.5, it is possible to attach an object
to multiple schemas. The hash key has changed from a scalar (string) to an
array of (one or more) scalars and the name of the key has changed to
"schemaList".
On an unrelated note, the ars_GetCharMenu() call now decodes the "menuType"
hash key. Previously it was returned as a number (a raw enumeration value)
and you had to figure out on your own what that number meant. Now we decode
it so you get a string telling you what sort of menu it is. This change was
made to bring this function inline with how the other ARSperl functions
operate. Again, you might need to update some of your scripts. This change
StructDef.pl view on Meta::CPAN
_min_version => '5.0.0',
_type => 'AREnumLimitsStruct',
_data => 'p->u.enumLimits',
},
AR_DATA_TYPE_DECIMAL => {
_type => 'ARDecimalLimitsStruct',
_data => 'p->u.decimalLimits',
},
AR_DATA_TYPE_ATTACH => {
_type => 'ARAttachLimitsStruct',
_data => 'p->u.attachLimits',
},
AR_DATA_TYPE_CURRENCY => {
_min_version => '5.1.0',
_type => 'ARCurrencyLimitsStruct',
_data => 'p->u.currencyLimits',
},
AR_DATA_TYPE_DATE => {
_min_version => '5.1.0',
_type => 'ARDateLimitsStruct',
_data => 'p->u.dateLimits',
StructDef.pl view on Meta::CPAN
},
},
},
},
},
ARAttachLimitsStruct => {
maxSize => {
_type => 'unsigned long',
_data => 'p->maxSize',
},
attachType => {
_type => 'unsigned int',
_data => 'p->attachType',
},
},
ARTableLimitsStruct => {
numColumns => {
_type => 'unsigned int',
_data => 'p->numColumns',
},
qualifier => {
_type => 'ARQualifierStruct',
_data => 'p->qualifier',
StructDef.pl view on Meta::CPAN
#print evalTemplate( 'COPY', 'char[10]', 'p->charVal', 'buffer' ), "\n";
#print evalTemplate( 'COPY', 'unsigned char', 'p->unique', 'buffer' ), "\n";
#ARIntegerLimitsStruct intLimits;
#ARRealLimitsStruct realLimits;
#ARCharLimitsStruct charLimits;
#ARDiaryLimitsStruct diaryLimits;
#AREnumLimitsStruct enumLimits;
#AREnumLimitsStruct maskLimits;
#ARAttachLimitsStruct attachLimits;
#ARTableLimitsStruct tableLimits;
#ARColumnLimitsStruct columnLimits;
#ARDecimalLimitsStruct decimalLimits;
#ARViewLimits viewLimits;
#ARDisplayLimits displayLimits;
#ARDateLimitsStruct dateLimits;
#ARCurrencyLimitsStruct currencyLimits;
changes.dat view on Meta::CPAN
released=11/23/99 version=1.65
JCM added better support for decoding filters/activelinks
for arsystem 4.0 (not finished yet)
JCM added support for data type "decimal" when performing
(Set|Create)Entry
released=04/7/99 version=1.6403 BETA
JCM tested/fixed compiling against pre-4.0 apis.
JCM OO: now checks named params to ensure you don't
mis-spell them.
JCM attachment allows specify a 'name' hash key so you can
customize the name that appears in the attachment field
in the usertool. (Nick Stoughton {NickS at ISRWORLD.com})
JCM OO: form->setSort method added
JCM OO: better error handling/catching
JCM OO: fixed bug in value2internal
JCM fixed NTRegisterServer(), fixed example/3.x/Notifier.pl
JCM OO: fixed ARS::AR_RETURN_* bugs { erik.dorfman at intelsat.int }
JCM fixed bug in ars_GetListServer() for api >= 4.0
released=03/12/99 version=1.6400 BETA
JCM added new LIBS line to Makefile.PL to cover NCR Unix
("Hill, David K" {david.k.hill at intel.com})
JCM added ars_GetEntryBLOB (attachment field handling)
thanks to "Kaelin Colclasure" {kaelin at talarian.com}
for supplying part of the code for the BLOB functions.
JCM simplified Makefile.PL configuration steps
JCM added attachment example scripts
JCM added basic OO layer
JCM added small test suite
JCM fixed some broken 4.0 related conditional compilation
stuff
JCM makefile now automatically converts C header files into
perl files so that all constants (C 'defines') are
available.
released=01/04/99 version=1.63
JCM fixed some missing conditional compilation #if's in code
example/WhoUsesIt.pl view on Meta::CPAN
foreach $filter (split(/,/, substr($users{$schema}, 0, length($users{$schema})-1))) {
print "\t\t$filter\n";
}
}
} elsif($opt_m) {
# find any schema that uses this menu.
# this particular routine will take longer, because we
# need to open each schema, and then retrieve all field
# definitions and finally flip thru each field and see
# what menus (if any) are attached.
print "Searching for Menu \"$opt_m\" in schema \"$opt_s\"...\n";
print "(this may take some time)\n";
foreach $schema (@schemas) {
if($schema =~ /$SCHEMA/) {
print "Searching schema: $opt_s\n" if $debug;
@fields = ars_GetListField($ctrl, $schema);
foreach $field (@fields) {
$finfo = ars_GetField($ctrl, $schema, $field);
example/ars_GetEntryBLOB.pl view on Meta::CPAN
ars_Logoff($c);
exit 0;
#sub AR_LOC_FILENAME { 1;}
#sub AR_LOC_BUFFER { 2;}
sub ra {
my $fid = shift;
print "\t[Retrieving attachment.]\n";
# file: $a = 0 || 1
# buff: $a = undef || attachment
unlink('/tmp/attachtest', '/tmp/attachtest2');
ars_GetEntryBLOB($c, $schema, $entry,
$fid,
ARS::AR_LOC_FILENAME,
"/tmp/attachtest") ||
die ("GetEntryBLOB: $ars_errstr");
my $a = ars_GetEntryBLOB($c, $schema, $entry,
$fid,
ARS::AR_LOC_BUFFER);
die "GetEntryBLOB: $ars_errstr" if(!defined($a));
print "\tattachment size = ".length($a)."\n";
open(FD, ">/tmp/attachtest2") || die "open: $!";
print FD $a;
close(FD);
}
sub dh {
my $h = shift;
foreach (keys %$h) {
print "\t$_ = $h->{$_}\n";
}
}
example/attachTest.pl view on Meta::CPAN
#!/oratest/perl/bin/perl
use ARS;
$c = ars_Login(shift, shift, shift);
%f = ars_GetFieldTable($c, "ARSperl Test");
foreach (keys %f) {
$r{$f{$_}} = $_;
}
print "Creating new entry with an attachment..\n";
($id = ars_CreateEntry($c, "ARSperl Test",
$f{'Attachment Field'}, { file => "/tmp/test", size => 0 },
#$f{'Attachment Field'}, { buffer => "/tmp/test", size => 9 },
$f{'Submitter'}, "jeff",
$f{'Status'}, 1,
$f{'Short Description'}, "none")) ||
die "CreateEntry: $ars_errstr";
print "Created entry $id\n";
example/attachTest.pl view on Meta::CPAN
ars_Logoff($c);
exit 0;
#sub AR_LOC_FILENAME { 1;}
#sub AR_LOC_BUFFER { 2;}
sub ra {
my $fid = shift;
print "\t[Retrieving attachment.]\n";
# file: $a = 0 || 1
# buff: $a = undef || attachment
ars_GetEntryBLOB($c, "ARSperl Test", $id,
$fid,
ARS::AR_LOC_FILENAME,
"/tmp/attachtest") ||
die ("GetEntryBLOB: $ars_errstr");
my $a = ars_GetEntryBLOB($c, "ARSperl Test", $id,,
$fid,
ARS::AR_LOC_BUFFER);
die "GetEntryBLOB: $ars_errstr" if(!defined($a));
print "\tattachment size = ".length($a)."\n";
open(FD, ">/tmp/attachtest2") || die "open: $!";
print FD $a;
close(FD);
}
sub dh {
my $h = shift;
foreach (keys %$h) {
print "\t$_ = $h->{$_}\n";
}
}
example/getAttachment-OO.pl view on Meta::CPAN
use ARS;
$c = new ARS(shift, shift, shift);
$s = $c->openForm("ARSperl Test");
%v = $s->getAsHash(-entry => "000000000000002");
print "field/value dump:\n";
foreach (keys %v) {
print "$_ = $v{$_}\n";
dh($v{$_}) if $s->getFieldType(-field => $_) eq "attach";
ra($_) if $s->getFieldType(-field => $_) eq "attach";
}
exit 0;
sub ra {
my $field = shift;
print "\t[Retrieving attachment.]\n";
# file: $a = 0 || 1
# buff: $a = undef || attachment
$s->getAttachment(-entry => "000000000000002",
-field => $field,
-file => "/tmp/attachtest");
my $a = $s->getAttachment(-entry => "000000000000002",
-field => $field);
print "\tattachment size = ".length($a)."\n";
open(FD, ">/tmp/attachtest2") || die "open: $!";
print FD $a;
close(FD);
# if you "cmp" the files, they should be identical.
}
sub dh {
my $h = shift;
foreach (keys %$h) {
print "\t$_ = $h->{$_}\n";
html/changes.html view on Meta::CPAN
BGCOLOR='lightblue'>
<tr><td colspan='2'>
<table width='100%' border='0'><tr>
<td width='50%'>Released: <B>04/7/99</B></td>
<td width='50%'>Version: <B>1.6403 BETA
</B></td>
</tr></table></td>
</tr><tr bgcolor='#eeeeee'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>tested/fixed compiling against pre-4.0 apis.
</font></td></tr>
<tr bgcolor='#dddddd'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>OO: now checks named params to ensure you don't
mis-spell them. </font></td></tr>
<tr bgcolor='#eeeeee'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>attachment allows specify a 'name' hash key so you can
customize the name that appears in the attachment field in the usertool. (Nick Stoughton {NickS at ISRWORLD.com}) </font></td></tr>
<tr bgcolor='#dddddd'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>OO: form->setSort method added
</font></td></tr>
<tr bgcolor='#eeeeee'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>OO: better error handling/catching
</font></td></tr>
<tr bgcolor='#dddddd'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>OO: fixed bug in value2internal
</font></td></tr>
<tr bgcolor='#eeeeee'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>fixed NTRegisterServer(), fixed example/3.x/Notifier.pl
</font></td></tr>
<tr bgcolor='#dddddd'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>OO: fixed ARS::AR_RETURN_* bugs { erik.dorfman at intelsat.int }
</font></td></tr>
html/changes.html view on Meta::CPAN
<TD width='100%'>
<TABLE CELLSPACING='0' CELLPADDING='3' WIDTH='100%' BORDER='0'
BGCOLOR='lightblue'>
<tr><td colspan='2'>
<table width='100%' border='0'><tr>
<td width='50%'>Released: <B>03/12/99</B></td>
<td width='50%'>Version: <B>1.6400 BETA
</B></td>
</tr></table></td>
</tr><tr bgcolor='#eeeeee'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>added new LIBS line to Makefile.PL to cover NCR Unix
("Hill, David K" {david.k.hill at intel.com}) </font></td></tr>
<tr bgcolor='#dddddd'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>added ars_GetEntryBLOB (attachment field handling)
thanks to "Kaelin Colclasure" {kaelin at talarian.com} for supplying part of the code for the BLOB functions. </font></td></tr>
<tr bgcolor='#eeeeee'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>simplified Makefile.PL configuration steps
</font></td></tr>
<tr bgcolor='#dddddd'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>added attachment example scripts
</font></td></tr>
<tr bgcolor='#eeeeee'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>added basic OO layer
</font></td></tr>
<tr bgcolor='#dddddd'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>added small test suite
</font></td></tr>
<tr bgcolor='#eeeeee'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>fixed some broken 4.0 related conditional compilation
stuff </font></td></tr>
<tr bgcolor='#dddddd'><td width='10%'>(JCM)</td><td width='90%'><font color='black'>makefile now automatically converts C header files into
perl files so that all constants (C 'defines') are available. </table></td></tr></table>
html/copying.html view on Meta::CPAN
POSSIBILITY OF SUCH DAMAGES.<p>
</dl>
<center><p align=center>END OF TERMS AND CONDITIONS</p></center>
<hr>
<center><h2 align=center>Appendix: How to Apply These Terms to Your New Programs</h2></center>
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.<p>
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.<p>
<dl>
<dd><one line to give the program's name and a brief idea of what it does.><br>
Copyright (C) 19yy <name of author><p>
<dd>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
html/manual/OO/form.html view on Meta::CPAN
<PRE>
$id = $f->create(-values => { field1 => value1, ... });
</PRE>
This function allows you to create a new entry in this form. You can
specify field name to field value mappings with out regard for the
field ID or enumeration types. Behind the scenes magic occurs to hide
this from you. <P>
Eventually, it will obey the VUI you specified.
<P>
In order to create an entry with an attachment, you should use the
following format:
<PRE>
$id = $f->create(-values => {
"Attachment Field Name" => { file => scalar filename,
OR
buffer => scalar,
AND
size => scalar
}
});
</PRE>
Note that the size field must correspond to either the length of the
in-core buffer or the size of the file you wish to attach. Specifying
and incorrect length will result in a truncated attachment. See the
<code>t/entry.t</code> file in the source distribution for an example
of adding attachments to records.
<P>
<DT><A NAME="delete"><B>delete()</B></A>
<PRE>
$f->delete(-entry => scalar string);
</PRE>
This method will delete a given entry from the form. It does not "pad
out" the entry id for you currently. So if there are leading zeros, you
must add them.
html/manual/OO/form.html view on Meta::CPAN
the return value into an array instead of a hash.
<P>
<DT><A NAME="getAttachment"><B>getAttachment()</B></A>
<PRE>
$v = $f->getAttachment(-entry => scalar string,
-field => [ field1 ],
-file => scalar string);
</PRE>
This method allows you to retrieve an attachment from the given
record. You must specify both the record's entry ID and the attachment
field name. The <code>file</code> parameter is optional. If specified,
the attachment will be written to the given filename. If not specified,
the attachment is returned as a scalar value.
<P>
<DT><A NAME="value2internal"><B>value2internal()</B></A>
<PRE>
$v = value2internal(-field => scalar, -value => value);
</PRE>
This is an internal routine used to translate enumeration values into
text for a given field.
<P>
html/manual/ars_GetEntry.html view on Meta::CPAN
%vals = ars_GetEntry($ctrl, $schema, $entry_id, $diaryfield_fid);
foreach $diary_entry (@{$vals{$diaryfield_fid}}) {
print "$diary_entry->{timestamp}\n";
print "$diary_entry->{user}\n";
print "$diary_entry->{value}\n";
}
</PRE>
See Also: <A HREF="ds_diaryentry_hash.html">Diary Entry Hash
Values</A> and <A href="ds_attach_hash.html">Attachment Hash Values</a>
<P>
<HR WIDTH="30%">
<P>
<A HREF="toc.html"><IMG ALT="<--" SRC="arrow.gif" ALIGN=CENTER> Table of Contents </A>
<p>
<address>
Last changes to this page 26th June 1997 by d.j.adams@soton.ac.uk<br>
© J.C.Murphy, J.W.Murphy 1997 arsperl@arsperl.org
</address>
html/manual/ars_GetEntryBLOB.html view on Meta::CPAN
<HTML>
<HEAD>
<TITLE>ARSperl Manual - ars_GetEntryBLOB</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H2><CODE>ars_GetEntryBLOB(ctrl,schema,entry_id,field_id,locType,locFile)</CODE></H2>
This function retrieves an attachment from the specified schema
entry. The field ID specified should be an attachment field type. The
<code>locType</code> parameter can be used to specify whether you want
the attachment returned incore (ARS::AR_LOC_BUFFER) or written to a file
(ARS::AR_LOC_FILENAME). If you choose to write it to a file, you must
specify the <CODE>locFile</CODE> parameter. <P>
<DL>
<DT><B>On success</B><DD>
returns 1 if locType == AR_LOC_FILENAME <BR>
returns a scalar buffer if locType == AR_LOC_BUFFER <BR>
<DT><B>On failure</B><DD>
Returns <CODE>undef</CODE>.
</DL>
<P>Example:
<PRE>
ars_GetEntryBLOB($c, "00-Test", "000000000000001",
$fid,
ARS::AR_LOC_FILENAME,
"/tmp/attachtest") ||
die ("GetEntryBLOB: $ars_errstr");
my $a = ars_GetEntryBLOB($c, "00-Test", "000000000000001",
$fid,
ARS::AR_LOC_BUFFER);
die "GetEntryBLOB: $ars_errstr" if(!defined($a));
print "blob size = ".length($a)."\n";
open(FD, ">/tmp/attachtest2") || die "open: $!";
print FD $a;
close(FD);
</PRE>
<P>
A subsequent comparison of the two files <CODE>/tmp/attachtest</code>
and <code>/tmp/attachtest2</code> should show that they are identical.
<HR WIDTH="30%">
<P>
<A HREF="toc.html"><IMG ALT="<--" SRC="arrow.gif" ALIGN=CENTER> Table of
Contents </A>
<p>
<address>
Last changes to this page 9th March 1999 by jeff murphy <BR>
© J.C.Murphy, J.W.Murphy 1997 arsperl@arsperl.org
</address>
html/manual/ars_GetListField.html view on Meta::CPAN
<li>Bit 5: Retrieve table fields (AR_FIELD_TYPE_TABLE).
</li>
<li>Bit 6: Retrieve column fields (AR_FIELD_TYPE_COLUMN).
</li>
<!-- <li>Bit 8: Retrieve vendor type fields
(AR_FIELD_TYPE_VENDOR).
</li> -->
<li>Bit 7: Retrieve attachment type fields
(AR_FIELD_TYPE_ATTACH).
</li>
<li>Bit 8: Retrieve attachement pool type fields
(AR_FIELD_TYPE_ATTACH_POOL)
</li>
</ul>
<br>
Ergo, fieldType = 6 will return trim and control fields.
</ul>
html/manual/ars_GetListSQL.html view on Meta::CPAN
<HTML>
<HEAD>
<TITLE>ARSperl Manual - ars_GetListSQL</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H2><CODE>ars_GetListSQL(ctrl, sqlCommand, maxRetriev=AR_NO_MAX_LIST_RETRIEVE)</CODE></H2>
Execute the given sqlCommand on the database that the server is attached to.
sqlCommand executes with privs associated with the ARAdmin database user.
<P> See also:
<A HREF="ds_getlistsql_hash.html">GetListSQL Hash Values</A>.
<P>
<DL>
<DT><B>On success</B><DD>
Returns a HASH.
<DT><B>On failure</B><DD>
Returns undef.
html/manual/ars_GetListUser.html view on Meta::CPAN
<HTML>
<HEAD>
<TITLE>ARSperl Manual - ars_GetListUser</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H2><CODE>ars_GetListUser(ctrl, userListType=AR_USER_LIST_MYSELF)</CODE></H2>
Retrieve information about users. Can be restricted to the current
user (AR_USER_LIST_MYSELF), all registered users (AR_USER_LIST_REGISTERED)
or currently attached users (AR_USER_LIST_CURRENT).
<P> See also:
<A HREF="ds_getlistuser_hash.html">GetListUser Hash Values</A>.
<P>
<DL>
<DT><B>On success</B><DD>
Returns an array of HASH references.
<DT><B>On failure</B><DD>
Returns undef.
html/manual/ds_attach_hash.html view on Meta::CPAN
<HTML>
<HEAD>
<TITLE>ARSperl Manual - Attachment Hash Values</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H2>Attachment Hash Values</H2>
This is returned by <A HREF="ars_GetEntry.html">ars_GetEntry</A> when
you retrieve an attachment field.
<p>
<PRE>
{
"name" => the original filename of the attachment,
"compSize" => the compressed size of the attachment,
"origSize" => the original size of the attachment,
"value" => "Use ars_GetEntryBLOB or OO->getAttachment to extract the attachment"
}
</PRE>
<P>
<HR WIDTH="30%">
<P>
<A HREF="toc.html"><IMG ALT="<--" SRC="arrow.gif" ALIGN=CENTER> Table of Contents </A>
<p>
<address>
case AR_DATA_TYPE_DATE:
return newSViv(in->u.dateVal);
case AR_DATA_TYPE_CURRENCY:
return perl_ARCurrencyStruct(ctrl, in->u.currencyVal);
case AR_DATA_TYPE_VIEW:
case AR_DATA_TYPE_DISPLAY:
return newSVpv(in->u.charVal, 0);
#endif
#if AR_EXPORT_VERSION >= 4
case AR_DATA_TYPE_ATTACH:
return perl_ARAttach(ctrl, in->u.attachVal);
case AR_DATA_TYPE_DECIMAL:
return newSVpv(in->u.decimalVal, 0);
#endif
case AR_DATA_TYPE_NULL:
return newSVsv(&PL_sv_undef);
default:
{
char dt[128];
sprintf(dt, "%u (in function perl_ARValueStruct_Assign)", in->dataType);
ARError_add(AR_RETURN_WARNING, AP_ERR_DATATYPE);
return newSViv(in->u.ulongVal); /* FIX -- does perl have
* unsigned long? */
case AR_DATA_TYPE_COORDS:
return perl_ARList(ctrl,
(ARList *) in->u.coordListVal,
(ARS_fn) perl_ARCoordStruct,
sizeof(ARCoordStruct));
#endif
#if AR_EXPORT_VERSION >= 4
case AR_DATA_TYPE_ATTACH:
return perl_ARAttach(ctrl, in->u.attachVal);
case AR_DATA_TYPE_DECIMAL:
return newSVpv(in->u.decimalVal, 0);
#endif
#if AR_EXPORT_VERSION >= 7L
case AR_DATA_TYPE_TIME_OF_DAY:
return newSViv(in->u.timeOfDayVal);
case AR_DATA_TYPE_DATE:
return newSViv(in->u.dateVal);
case AR_DATA_TYPE_CURRENCY:
return perl_ARCurrencyStruct(ctrl, in->u.currencyVal);
case AR_DATA_TYPE_BYTES:
return &PL_sv_undef;
case AR_DATA_TYPE_DECIMAL:
hv_store(hash, "rangeLow", strlen("rangeLow") , newSVpv(in->u.decimalLimits.rangeLow, 0), 0);
hv_store(hash, "rangeHigh", strlen("rangeHigh") , newSVpv(in->u.decimalLimits.rangeHigh, 0), 0);
hv_store(hash, "precision", strlen("precision") , newSViv(in->u.decimalLimits.precision), 0);
return newRV_noinc((SV *) hash);
case AR_DATA_TYPE_ATTACH:
hv_store(hash, "maxSize", strlen("maxSize") , newSViv(in->u.attachLimits.maxSize), 0);
hv_store(hash, "attachType", strlen("attachType") , newSViv(in->u.attachLimits.attachType), 0);
return newRV_noinc((SV *) hash);
#if AR_EXPORT_VERSION >= 7
case AR_DATA_TYPE_CURRENCY:
hv_store(hash, "rangeLow", strlen("rangeLow") , newSVpv(in->u.currencyLimits.rangeLow, 0), 0);
hv_store(hash, "rangeHigh", strlen("rangeHigh") , newSVpv(in->u.currencyLimits.rangeHigh, 0), 0);
hv_store(hash, "precision", strlen("precision") , newSViv(in->u.currencyLimits.precision), 0);
hv_store(hash, "functionalCurrencies", strlen("functionalCurrencies"), perl_ARCurrencyDetailList(ctrl,&(in->u.currencyLimits.functionalCurrencies)), 0 );
hv_store(hash, "allowableCurrencies", strlen("allowableCurrencies"), perl_ARCurrencyDetailList(ctrl,&(in->u.currencyLimits.allowableCurrencies)), 0 );
return newRV_noinc((SV *) hash);
#if AR_EXPORT_VERSION >= 4
SV *
perl_ARAttach(ARControlStruct * ctrl, ARAttachStruct * in)
{
HV *hash = newHV();
SV *buffer;
SV *name;
SV *size;
SV *csize;
char *str = "Use ars_GetEntryBLOB or OO->getAttachment to extract the attachment";
/*
* at this point, the loc structure is not actually used ...
*/
buffer = newSVpv( str, strlen(str) );
name = newSVpv( in->name, strlen(in->name) );
size = newSViv(in->origSize);
csize = newSViv(in->compSize);
* ulong ? */
break;
#if AR_EXPORT_VERSION >= 4
case AR_DATA_TYPE_DECIMAL:
out->u.decimalVal = strdup(SvPV(in, PL_na));
break;
case AR_DATA_TYPE_ATTACH:
/* value must be a hash reference */
if (SvROK(in)) {
if (SvTYPE(hash = (HV *) SvRV(in)) == SVt_PVHV) {
ARAttachStruct *attachp = MALLOCNN(sizeof(ARAttachStruct));
ARLocStruct *locp = &(attachp->loc);
long size = 0;
SV *name = NULL;
/*
* the hash should contain keys:
* file (a filename) or
* buffer (a buffer)
* and all of:
* size (length of file or buffer)
* name (the name to give the attachment)
* name defaults to the filename or "Anonymous Incore Buffer"
*/
/* first: decode the size key */
fetch = hv_fetch(hash, "size", strlen("size") , FALSE);
if (!fetch) {
AP_FREE(attachp);
ARError_add(AR_RETURN_ERROR, AP_ERR_ATTACH,
"Must specify 'size' key.");
return -1;
}
if (!(SvOK(*fetch) && SvTYPE(*fetch) < SVt_PVAV)) {
AP_FREE(attachp);
ARError_add(AR_RETURN_ERROR, AP_ERR_ATTACH,
"'size' key does not map to scalar value.");
return -1;
}
size = SvIV(*fetch);
/* now get the name, if any */
fetch = hv_fetch(hash, "name", strlen("name") , FALSE);
if( !fetch)
fetch = hv_fetch(hash, "file", strlen("file") , FALSE);
fetch2 = hv_fetch(hash, "buffer", strlen("buffer") , FALSE);
/*
* either/or must be specifed: not
* both and not neither
*/
if ((!fetch && !fetch2) || (fetch && fetch2)) {
AP_FREE(attachp);
ARError_add(AR_RETURN_ERROR, AP_ERR_ATTACH,
"Must specify one either 'file' or 'buffer' key.");
return -1;
}
/* we've been given a filename */
if (fetch) {
char *filename;
STRLEN filenamelen;
if (!(SvOK(*fetch) && SvTYPE(*fetch) < SVt_PVAV)) {
AP_FREE(attachp);
ARError_add(AR_RETURN_ERROR, AP_ERR_ATTACH,
"'file' key does not map to scalar value.");
return -1;
}
locp->locType = AR_LOC_FILENAME;
filename = SvPV(*fetch, filenamelen);
/* if we have an explicitly set name, use it, else use the filename */
if (name) {
STRLEN __len; /* because some perls have "na" and others "PL_na" */
attachp->name = strdup(SvPV(name, __len));
} else {
attachp->name = MALLOCNN(filenamelen + 1);
memcpy(attachp->name, filename, filenamelen);
}
locp->u.filename = MALLOCNN(filenamelen + 1);
memcpy(locp->u.filename, filename, filenamelen);
attachp->origSize = size;
}
/* else we've been given a buffer */
else {
STRLEN __len; /* dummy variable */
if (!(SvOK(*fetch2) && SvTYPE(*fetch2) < SVt_PVAV)) {
AP_FREE(attachp);
ARError_add(AR_RETURN_ERROR, AP_ERR_ATTACH,
"'buffer' key does not map to scalar value.");
return -1;
}
if (name)
attachp->name = strdup(SvPV(name, __len));
else
attachp->name = strdup("Anonymous In-core Buffer");
locp->locType = AR_LOC_BUFFER;
locp->u.buf.bufSize = size;
locp->u.buf.buffer = MALLOCNN(size);
memcpy(locp->u.buf.buffer, SvPV(*fetch2, __len), size);
}
out->u.attachVal = attachp;
break;
}
}
ARError_add(AR_RETURN_ERROR, AP_ERR_ATTACH,
"Non hash-reference passed as attachment value.");
return -1;
break;
#endif
case AR_DATA_TYPE_COORDS:
if (SvTYPE(array = (AV *) SvRV(in)) == SVt_PVAV) {
len = av_len(array) + 1;
out->u.coordListVal = MALLOCNN(sizeof(ARCoordList));
out->u.coordListVal->numItems = len;
out->u.coordListVal->coords = MALLOCNN(sizeof(ARCoordStruct) * len);
supportrev_generated.c view on Meta::CPAN
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"maxSize\"" );
return -1;
}
}
{
SV **val;
strncpy( k, "attachType", 255 );
val = hv_fetch( h, "attachType", 10, 0 );
if( val && *val && SvOK(*val) ){
{
p->attachType = SvIV(*val);
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"attachType\"" );
return -1;
}
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARAttachLimitsStruct: hash value is not a hash reference" );
return -1;
}
supportrev_generated.c view on Meta::CPAN
case AR_DATA_TYPE_COLUMN:
{
rev_ARColumnLimitsStruct( ctrl, h, k, &(p->u.columnLimits) );
}
break;
case AR_DATA_TYPE_ATTACH:
{
rev_ARAttachLimitsStruct( ctrl, h, k, &(p->u.attachLimits) );
}
break;
#if AR_CURRENT_API_VERSION >= 8
case AR_DATA_TYPE_DISPLAY:
{
rev_ARDisplayLimits( ctrl, h, k, &(p->u.displayLimits) );
}
break;
#endif
t/01import.t view on Meta::CPAN
my($ctrl) = ars_Login(&CCACHE::SERVER, &CCACHE::USERNAME, &CCACHE::PASSWORD, "", "", &CCACHE::TCPPORT);
if(!defined($ctrl)) {
print "not ok (login $ars_errstr)\n";
exit 0;
}
my $d = "aptest.def";
# if we're compiled against 4.0, we'll import a schema
# with an attachment field so we can test that out.
if(ars_APIVersion() >= 6) {
$d = "aptest51.def";
}elsif(ars_APIVersion() >= 4) {
$d = "aptest50.def";
}
# delete the schema (assuming it already exists). if it doesnt,
# we ignore the error.
t/10entry.t view on Meta::CPAN
# test 4: retrieve the value and check it
$v = $s->get(-entry => $id, -field => [ 'Status' ] );
if($v ne "Rejected") {
print "not ok [6 $v]\n";
} else {
print "ok [6 get]\n";
}
# test 6: add an attachment to the existing entry
if(ars_APIVersion() >= 4) {
my $filename = "t/aptest40.def";
$s->set(-entry => $id,
"-values" => { 'Attachment Field' =>
{ file => $filename,
size => (stat($filename))[7]
}
}
t/10entry.t view on Meta::CPAN
open(FD, $filename) || die "not ok [open $!]\n";
binmode FD;
my $fc;
while(<FD>) {
$fc .= $_;
}
close(FD);
if($fc ne $ic) {
print "not ok [attach (create) cmp] fc ", length($fc), " ic ", length($ic), "\n";
} else {
print "ok [attach (set) test ; fclen=", length($fc),
" iclen=", length($ic), "]\n";
}
}
# test 7: create a new entry with an attachment
if(ars_APIVersion() >= 4) {
my $filename = "t/aptest40.def";
my $nid = $s->create(
"-values" => { 'Attachment Field' =>
{ file => $filename,
size => (stat($filename))[7]
},
'Submitter' => &CCACHE::USERNAME,
'Status' => 'Assigned',
'Short Description' => 'attach-create'
}
);
# retrieve it "in core"
my $ic = $s->getAttachment(-entry => $nid,
-field => 'Attachment Field');
open(FD, $filename) || die "not ok [open $!]";
binmode FD;
my $fc;
while(<FD>) {
$fc .= $_;
}
close(FD);
if($fc ne $ic) {
print "not ok [attach (create) cmp]\n";
} else {
print "ok [attach (create) test ; fclen=", length($fc),
" iclen=", length($ic), "]\n";
}
# retrieve it as a file
my $ga_rv = $s->getAttachment(-entry => $nid,
-field => 'Attachment Field',
-file => 'attach.txt');
open(FD, 'attach.txt') || die "not ok [open $!]";
binmode FD;
my $fc2;
while(<FD>) {
$fc2 .= $_;
}
close(FD);
if ($fc2 ne $ic) {
print "not ok [get attach to file]\n";
} else {
print "ok [get attach to file]\n";
}
# cleanup
unlink ('attach.txt');
$s->delete(-entry => $nid);
}
# test 8: finally, delete the newly created entry
$s->delete(-entry => $id);
print "ok [delete]\n";
t/aptest40.def view on Meta::CPAN
id : 536870913
name : Attachment Field
datatype : 11
fieldtype : 1
create-mode : 2
option : 2
timestamp : 921173122
owner : jcmurphy
last-changed : jcmurphy
maxsize : 0
attachtype : 1
display-instance : 536870912\13\3\41\2\7380\26243\27360\36236\4\6\1\5\6\2\9\6\4\41\40\2\1\6\2\21\41\2\0\0\0\0\7\40\2147483648\143\40\4294967295\170\40\0\151\41\2\0\0\0\0\65\41\&
display-instance : 2\0\0\0\0\66\41\2\0\0\0\0\
}
end
t/aptest45.def view on Meta::CPAN
id : 536870913
name : Attachment Field
datatype : 11
fieldtype : 1
create-mode : 2
option : 2
timestamp : 1003943015
owner : jcmurphy
last-changed : jcmurphy
maxsize : 0
attachtype : 1
display-instance : 536870912\13\3\41\2\7380\26243\27360\36236\4\6\1\5\6\2\9\6\4\41\40\2\1\6\2\21\41\2\0\0\0\0\7\40\2147483648\143\40\4294967295\170\40\0\151\41\2\0\0\0\0\65\41\&
display-instance : 2\0\0\0\0\66\41\2\0\0\0\0\
}
end
begin filter
name : ARSperl Test-Filter1
timestamp : 1003945011
owner : jcmurphy
last-changed : jcmurphy
filter-op : 6
t/aptest50.def view on Meta::CPAN
id : 536870913
name : Attachment Field
datatype : 11
fieldtype : 1
create-mode : 2
option : 2
timestamp : 1049205529
owner : jcmurphy
last-changed : jcmurphy
maxsize : 0
attachtype : 1
display-instance : 536870912\1\170\40\536870914\
}
field {
id : 536870914
name : Attachment Pool
datatype : 37
fieldtype : 1
create-mode : 2
option : 4
timestamp : 1049205534
t/aptest50.def view on Meta::CPAN
datatype : 11
fieldtype : 2
mapschema : 0
mapfield : 536870913
create-mode : 2
option : 2
timestamp : 1049205538
owner : jcmurphy
last-changed : jcmurphy
maxsize : 0
attachtype : 1
display-instance : 536870912\1\170\40\536871017\
}
field {
id : 536870914
name : Request ID2
datatype : 4
fieldtype : 2
mapschema : 0
mapfield : 1
create-mode : 2
t/aptest51.def view on Meta::CPAN
id : 536870913
name : Attachment Field
datatype : 11
fieldtype : 1
create-mode : 2
option : 2
timestamp : 1049205529
owner : jcmurphy
last-changed : jcmurphy
maxsize : 0
attachtype : 1
display-instance : 536870912\1\170\40\536870914\
}
field {
id : 536870914
name : Attachment Pool
datatype : 37
fieldtype : 1
create-mode : 2
option : 4
timestamp : 1049205534
t/aptest51.def view on Meta::CPAN
datatype : 11
fieldtype : 2
mapschema : 0
mapfield : 536870913
create-mode : 2
option : 2
timestamp : 1049205538
owner : jcmurphy
last-changed : jcmurphy
maxsize : 0
attachtype : 1
display-instance : 536870912\1\170\40\536871017\
}
field {
id : 536870914
name : Request ID2
datatype : 4
fieldtype : 2
mapschema : 0
mapfield : 1
create-mode : 2
t/aptest51.def view on Meta::CPAN
id : 536880923
name : Attachment 1
datatype : 11
fieldtype : 1
create-mode : 2
option : 2
timestamp : 1225458855
owner : Demo
last-changed : Demo
maxsize : 1000000
attachtype : 1
permission : 0\1
display-instance : 536870912\4\4\6\1\20\4\12\Attachment 1\170\40\536880922\143\40\1\
}
field {
id : 536880924
name : Attachment 2
datatype : 11
fieldtype : 1
create-mode : 2
option : 2
timestamp : 1225458855
owner : Demo
last-changed : Demo
maxsize : 0
attachtype : 1
permission : 0\1
display-instance : 536870912\4\4\6\1\20\4\12\Attachment 2\170\40\536880922\143\40\2\
}
field {
id : 536880912
name : Column
datatype : 34
fieldtype : 1
create-mode : 2
option : 4