Bug in GlorpSession>>#writeHomogeneousRows:

17 views
Skip to first unread message

jtuchel

unread,
Mar 6, 2012, 4:17:29 AM3/6/12
to glorp...@googlegroups.com
Hi Alan,

This is probably fixed for quite a few versions already, but maybe you could just check in the latest codebase of Glorp...

DB2 supports grouped writes and therefor Glorp handles commits a bit differently than on Access. So I got an exception on grouped writes because GlorpSession wants to copy the next 250 rows from the collection of rows to insert. Unfortunately, it doesn't check the size of the Collection before building a sub collection, or maybe VW handles the bounds in copyFrom:to: differently than VAST...

I changed GlorpSession>>#writeHomogeneousRows: to the following (Please be aware that I am using that old VAST port...):

writeHomogeneousRows: aCollectionOfDatabaseRows
"Write out a collection of rows belonging to a single table"

| representativeRow succeeded maximumSize start |

aCollectionOfDatabaseRows isEmpty ifTrue: [^true].
representativeRow := aCollectionOfDatabaseRows first.
representativeRow shouldBeWritten ifFalse: [^true].
succeeded := true.
maximumSize := self system maximumSizeToGroupWriteFor: aCollectionOfDatabaseRows.
start := 1.
[start > aCollectionOfDatabaseRows size] whileFalse: [
succeeded := succeeded
& (self writeHomogeneousRows: aCollectionOfDatabaseRows from: start to: ((start + maximumSize - 1) min: aCollectionOfDatabaseRows size)).
start := start + maximumSize].
^succeeded.

Alan Knight

unread,
Mar 6, 2012, 10:02:39 AM3/6/12
to glorp...@googlegroups.com
Yes, it looks like that was a problem but fixed in the latest version. At least there the code looks like

        | end |
        end := (start + maximumSize - 1) min: aCollectionOfDatabaseRows size.
        succeeded := succeeded
            & (self writeHomogeneousRows: aCollectionOfDatabaseRows from: start to: end).


jtuchel wrote:
--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/glorp-group/-/tFnZmK-GF88J.
To post to this group, send email to glorp...@googlegroups.com.
To unsubscribe from this group, send email to glorp-group...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en.

jtuchel

unread,
Mar 7, 2012, 2:46:41 AM3/7/12
to glorp...@googlegroups.com, kni...@acm.org
Thanks Alan, 

I was suspecting it is fixed already, just thought it's a good idea to let you know, just in case...

Joachim
Reply all
Reply to author
Forward
0 new messages