UDBC SQLite3 booleans in Glorp

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

UDBC SQLite3 booleans in Glorp

alistairgrant
Hi Pierce,

Now that the UDBC SQLite3 driver returns real booleans instead of an
integer I believe we need to update Glorp to match the change.

Adding the following method seems to be all that's required:


UDBCSQLite3Platform>>boolean
^self typeNamed: #boolean ifAbsentPut: [GlorpBooleanType new typeString: 'boolean'].


If there aren't any objections in the next few days I'll update pharo-rdbms on github.

Cheers,
Alistair

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: UDBC SQLite3 booleans in Glorp

Pierce Ng-3
On Mon, Jun 11, 2018 at 02:45:30AM -0700, [hidden email] wrote:
> Now that the UDBC SQLite3 driver returns real booleans instead of an
> integer I believe we need to update Glorp to match the change.
>
> Adding the following method seems to be all that's required:
>
> UDBCSQLite3Platform>>boolean
> ^self typeNamed: #boolean ifAbsentPut: [GlorpBooleanType new typeString:
> 'boolean'].

Hi Alistair,

Thanks for looking into this. I did make a corresponding change in
Glorp, in UDBCSQLite3Platform>>convertIntegerToBoolean:for:. My pull
request was merged by Esteban on 22 May. Please see if that is
sufficient.

Cheers,
Pierce

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: UDBC SQLite3 booleans in Glorp

alistairgrant
Hi Pierce,

On Monday, 11 June 2018 14:19:09 UTC+2, Pierce Ng wrote:
On Mon, Jun 11, 2018 at 02:45:30AM -0700, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="TmnkpxpyBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">akgra...@... wrote:
> Now that the UDBC SQLite3 driver returns real booleans instead of an
> integer I believe we need to update Glorp to match the change.
>
> Adding the following method seems to be all that's required:
>
> UDBCSQLite3Platform>>boolean
> ^self typeNamed: #boolean ifAbsentPut: [GlorpBooleanType new typeString:
> 'boolean'].

Hi Alistair,

Thanks for looking into this. I did make a corresponding change in
Glorp, in UDBCSQLite3Platform>>convertIntegerToBoolean:for:. My pull
request was merged by Esteban on 22 May. Please see if that is
sufficient.

 
Right, that does the conversion, but attempts to retrieve the field fail in the field mapping because DatabasePlatform>>boolean expects booleans to be encoded as integers, thus the need to override in UDBCSQLite3Platform:

True(Object)>>doesNotUnderstand: #asNumber
UDBCSQLite3Platform(DatabasePlatform)>>convertToInteger:for:
DelegatingDatabaseConverter>>convert:fromDatabaseRepresentationAs:
DirectMapping>>convertedStValueOf:
DirectMapping>>valueInBuilder:as:
DirectMapping>>valueInBuilder:
DirectMapping>>mapObject:inElementBuilder:
[ :each | 
each stopIfDebuggingRead.
each mapObject: anObject inElementBuilder: anElementBuilder ] in Descriptor>>populateObject:inBuilder: in Block: [ :each | ...
Array(SequenceableCollection)>>do:
Descriptor>>populateObject:inBuilder:
ObjectBuilder>>populateInstance
ObjectBuilder>>buildObjectFrom:
[ :each | each buildObjectFrom: aRow ] in GlorpCursoredStream>>buildObjectsForRow: in Block: [ :each | each buildObjectFrom: aRow ]
Array(SequenceableCollection)>>do:
GlorpCursoredStream>>buildObjectsForRow:
GlorpCursoredStream>>nextAnswerFromUnderlyingCursor
GlorpCursoredStream>>nextAnswer
GlorpCursoredStream>>next
SimpleQuery(AbstractReadQuery)>>readFromDatabaseWithParameters:
SimpleQuery(AbstractReadQuery)>>executeWithParameters:in:
GlorpSession>>execute:
GlorpSession>>readOneOf:where:
FinanceSideBySideTransactionAnalysis>>incomeTransactionsForYear:
FinanceSideBySideTransactionAnalysis>>totalIncomeGraph
[ self latest totalIncomeGraph inspect ] in FinanceSideBySideTransactionAnalysis class>>financeCommandOn: in Block: [ self latest totalIncomeGraph inspect ]
BlockClosure>>cull:
[ | selArgCount |
"show cursor in case item opens a new MVC window"
(selArgCount := selector numArgs) = 0
ifTrue: [ target perform: selector ]
ifFalse: [ selArgCount = arguments size
ifTrue: [ target perform: selector withArguments: arguments ]
ifFalse: [ target perform: selector withArguments: (arguments copyWith: evt) ] ].
self showShortcut.
self changed ] in ToggleMenuItemMorph(MenuItemMorph)>>invokeWithEvent: in Block: [ | selArgCount |...
BlockClosure>>ensure:
CursorWithMask(Cursor)>>showWhile:
ToggleMenuItemMorph(MenuItemMorph)>>invokeWithEvent:


PR: https://github.com/pharo-rdbms/glorp/pull/6

Cheers,
Alistair

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: UDBC SQLite3 booleans in Glorp

Pierce Ng-3
On Mon, Jun 11, 2018 at 06:16:45AM -0700, [hidden email] wrote:
> > Thanks for looking into this. I did make a corresponding change in
> > Glorp, in UDBCSQLite3Platform>>convertIntegerToBoolean:for:. My pull
> > request was merged by Esteban on 22 May. Please see if that is
> > sufficient.
> >  
> Right, that does the conversion, but attempts to retrieve the field fail in
> the field mapping because DatabasePlatform>>boolean expects booleans to be
> encoded as integers, thus the need to override in UDBCSQLite3Platform:

Got it. I didn't test the earlier change enough. :-P

Cheers,
Pierce

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/glorp-group.
For more options, visit https://groups.google.com/d/optout.