Bug in GlorpSession>>#writeHomogeneousRows:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug in GlorpSession>>#writeHomogeneousRows:

jtuchel
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.

--
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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Bug in GlorpSession>>#writeHomogeneousRows:

Alan Knight-2
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:
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.
--
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 [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en.

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Bug in GlorpSession>>#writeHomogeneousRows:

jtuchel
Thanks Alan, 

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

Joachim

Am Dienstag, 6. März 2012 16:02:39 UTC+1 schrieb AlanKnight:
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:
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.

--
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/-/0k6gKMI3MUwJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en.