Working on code that has been working for months without any problems. Now the RowSet isn't being set. I've checked the latest update docs, but it doesn't seem this code has been modified.

The fix is attached. Replace the body of the _arrayInit method in RowSet.a4l with the code within.

Note that the behavior has changed in that all arrays are resized to the size of the first array, not the largest one (for the sake of efficiency). In the vast majority of cases you are passing arrays of the same size, so this shouldn't be a problem.

Also please note that as of v4 if you are batching array-based RowSets it is much more efficient to create the batch first and then pass the batch to the RowSet constructor. See the documentation for info.

Regards,

   Aparajita
   www.aparajitaworld.com

   "If you dare to fail, you are bound to succeed."
   - Sri Chinmoy   |   www.srichinmoylibrary.com


method "_arrayInit"($self; $inColumnMap)
        
        // Because this method relies on global access to local variables,
        // to be safe we will prefix all local variables with an underscore
        // to decrease the chances of a name clash.
        
        array string(255; $_columns; 0)
        c_longint($_numColumns; $_i; $_size)
        $_numColumns := split string($inColumnMap; ";:"; $_columns)
        $self{"_columnMap"} := choose($self{"_isPersistent"}; new global 
collection; new collection)
        c_string(255; $_arrayName; $_columnName)
        
        $_size := -1
        
        for ($_i; 1; $_numColumns; 2)
                $_columnName := trim($_columns{$_i})
                $self{"_columns"}{} := $_columnName
                $_arrayName := trim($_columns{$_i + 1})
                
                if ($_arrayName[[1]] = "$")
                        // Split the variable name from any indexes
                        execute("global(%s)" % slice string($_arrayName; "{"))
                end if
                
                if ($_i = 1)
                        // Normalize the size of all arrays to the first one
                        execute("$_size := size of array(%s)" % $_arrayName)
                        _normalize($self; $_size)
                end if
                
                $_exec := 'copy array($_arrayName; 
\$self{"_columnMap"}{"$_columnName"}; $self{"_start"}; $self{"_end"})'
                execute($_exec)
        end for
        
        // Normalize the sizes of the arrays
        for each ($self{"_columnMap"}; $_columnName)
                resize array($self{"_columnMap"}{$_columnName}; $self{"_count"})
        end for each
        
end method
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to