pharo-rdbms / Pharo-SQLite3

Community-owned official SQLite3 binding for Pharo
MIT License
22 stars 20 forks source link

adding SQLite3Cursor>>do: ? opinions? #68

Closed vonbecmann closed 1 year ago

vonbecmann commented 1 year ago

what about adding the following method to SQLite3Cursor? i'm repeating the same code every time i want to read each row of a sql statement.

'From Pharo11.0.0 of 8 July 2023 [Build information: Pharo-11.0.0+build.693.sha.72e9af2815d5e54e8c47110b7a30e43b003cd9d3 (64 Bit)] on 18 August 2023 at 10:41:00.631264 pm'!

!SQLite3Cursor methodsFor: '*HWStore-Core' stamp: 'BernardoContreras 8/18/2023 22:37'!
do: aBlock
    "Evaluate aBlock with each of the receiver's rows as the argument."

    | eachRow |
    [ (eachRow := self next) isNotNil ] whileTrue: [
        aBlock value: eachRow ]! !
astares commented 1 year ago

@vonbecmann Could be helpful - send a PR with tests. Looks like this code is from BernardoContreras - so check the original license