fixed the hard coded 15 character entry id problem
--------------------------------cut here-------------------------------
*** 1.1 1996/02/21 20:17:26
--- ARSperl/ARS.xs 1996/02/21 19:56:07
***************
*** 1402,1422 ****
int c = items - 3, i, ret;
ARInternalIdList idList;
int id_len;
- AREntryIdType pad_entry;
ARFieldValueList fieldList;
ARStatusList status;
ARTimestamp v;
- /* pad left of entry_id with zeros */
- memset(pad_entry, '0', AR_MAX_ENTRYID_SIZE);
- pad_entry[AR_MAX_ENTRYID_SIZE] = '\0';
- id_len = strlen(entry_id);
- if (id_len > AR_MAX_ENTRYID_SIZE) {
- ars_errstr = "entry id is too long";
- goto get_entry_end;
- }
- sprintf(pad_entry+(AR_MAX_ENTRYID_SIZE-id_len), "%s", entry_id);
-
if (c < 1) {
idList.numItems = 0; /* get all fields */
} else {
--- 1402,1411 ----
***************
*** 1426,1432 ****
for (i=0; i<c; i++)
idList.internalIdList[i] = SvIV(ST(i+3));
}
! ret = ARGetEntry(ctrl, schema, pad_entry, &idList, &fieldList, &status);
if (ARError(ret, status)) {
FreeARInternalIdList(&idList, FALSE);
goto get_entry_end;
--- 1415,1421 ----
for (i=0; i<c; i++)
idList.internalIdList[i] = SvIV(ST(i+3));
}
! ret = ARGetEntry(ctrl, schema, entry_id, &idList, &fieldList, &status);
if (ARError(ret, status)) {
FreeARInternalIdList(&idList, FALSE);
goto get_entry_end;
*** 1.1 1996/02/21 20:17:54
--- ARSperl/ARS.pm 1996/02/21 20:34:28
***************
*** 54,59 ****
--- 54,61 ----
$AR_EXECUTE_ON_SET_DEFAULT = 512;
$AR_EXECUTE_ON_QUERY = 1024;
+ $field_entryId = 1;
+
sub ars_simpleMenu {
# merges all sub-menus into a single level menu
my $m = shift;
***************
*** 75,80 ****
--- 77,93 ----
}
}
@ret;
+ }
+
+ sub pad_entryid {
+ my $c = shift;
+ my $schema = shift;
+ my $entry_id = shift;
+ my $field;
+
+ ($field = ars_GetField($c, $schema, $field_entryId)) ||
+ return undef;
+ return ("0"x($field->{limit}{maxLength}-length($entry_id))).$entry_id;
}
ARS::__ars_init();
*** 1.1 1996/02/21 20:43:06
--- ARSperl/html/usage.html 1996/02/21 20:40:45
***************
*** 41,46 ****
--- 41,47 ----
<LI><A HREF="#ars_GetListActiveLink">ars_GetListActiveLink</A>
<LI><A HREF="#ars_GetField">ars_GetField</A>
<LI><A HREF="#ars_SetEntry">ars_SetEntry</A>
+ <LI><A HREF="#pad_entryid">ARS::pad_entryid</A>
</UL>
<LI><A HREF="#helper">Perl helper functions</A>
<UL>
***************
*** 485,491 ****
--- 486,496 ----
<PRE>
</PRE>
+
+ <A NAME="pad_entryid"></A>
+ <DT><CODE>ARS::pad_entryid(ctrl,schema,entry_id)</CODE><DD>
+ Pads entry_id with the required number of zeroes.
</DL>
|