based on the sequence in which the fields appear in the IDL file
(rather than from attributes in the <field> elements).
In most cases this change will make no difference, because the
fields appear in sequence. However for classes "brn" and "mvr" the
sequences of fields in the IDL are scrambled. For those classes,
this change will effectively renumber the fields.
This commit does not affect the corresponding Python or Java code.
So don't go editing the IDL yet to remove the array_position
attributes.
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13015
dcc99617-32d9-48b4-a31d-
7c20da2025e4
);
}
+ unsigned int array_pos = 0;
+ char array_pos_buf[ 7 ]; // For up to 1,000,000 fields per class
xmlNodePtr _f = _cur->children;
while(_f) {
osrfHash* field_def_hash = osrfNewHash();
- if( (prop_str = (char*)xmlGetNsProp(_f, BAD_CAST "array_position", BAD_CAST OBJECT_NS)) ) {
- osrfHashSet(
- field_def_hash,
- prop_str,
- "array_position"
- );
- }
+ // Insert array_position
+ snprintf( array_pos_buf, sizeof( array_pos_buf ), "%u", array_pos++ );
+ osrfHashSet( field_def_hash, strdup( array_pos_buf ), "array_position" );
if( (prop_str = (char*)xmlGetNsProp(_f, BAD_CAST "i18n", BAD_CAST PERSIST_NS)) ) {
osrfHashSet(
# Load each field -------------------------------------------
+ my $array_position = 0;
for my $field ( $field_list->childNodes() ) { # For each <field>
if( $field->nodeName eq 'field' ) {
my $attribute_list = $field->attributes();
my $name = get_attribute( $attribute_list, 'name' );
- my $array_position = get_attribute( $attribute_list, 'oils_obj:array_position' );
my $virtual = get_attribute( $attribute_list, 'oils_persist:virtual' );
if( ! defined( $virtual ) ) {
$virtual = "false";
if( defined( $selector ) ) {
$$fieldmap{$fm}{selector} = $selector;
}
+
+ ++$array_position;
}
}
}