8.5.2 enhancement to optionally answer database CHARACTER(1) columns as a String instead of Character

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

8.5.2 enhancement to optionally answer database CHARACTER(1) columns as a String instead of Character

Wayne Johnston
I didn't know Instantiations was making that change, but I was glad to see that.

However, is there a reason this was implemented just for DB2?  (#keepSingleCharStringsAsString: etc. is only in AbtIbmCliDatabaseConnection, not the superclass AbtOdbcDatabaseConnection, so it won't work for SQL Server, for instance).

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/92w9c9GUmbIJ.
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/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: 8.5.2 enhancement to optionally answer database CHARACTER(1) columns as a String instead of Character

jtuchel
Hi Wayne,

here's why it was added: http://joachimtuchel.wordpress.com/2012/03/05/dont-use-glorp-type-resolvers-with-char1-fields-in-db2-on-va-smalltalk/

There you can also see why Instantiations added a setting instead of changing the default behavior. If I remember correctly, the special behavior was only present in DB2 nut not in any other DB interface. Since I found the bug through the fact that all was fine on Access but broken on DB2, I'd dare to say that SQL Server and Access never had the problem... Do you know any better or are you just asking because the docs say "we changed this for DB2"?

Joachim

Am Donnerstag, 20. September 2012 22:24:12 UTC+2 schrieb Wayne Johnston:

I didn't know Instantiations was making that change, but I was glad to see that.

However, is there a reason this was implemented just for DB2?  (#keepSingleCharStringsAsString: etc. is only in AbtIbmCliDatabaseConnection, not the superclass AbtOdbcDatabaseConnection, so it won't work for SQL Server, for instance).

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/cmLowXInI6kJ.
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/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: 8.5.2 enhancement to optionally answer database CHARACTER(1) columns as a String instead of Character

Wayne Johnston
You are right.  I forgot that the irrationality was limited to DB2, so there was nothing to fix anywhere else.  And note to self - it was indeed only CHARACTER(1) columns and not VARCHAR(1) columns.  

The slight problem is our general code that works with DB2 or SQL Server (meaning ODBC).  When we connect, we will send #keepSingleCharStringsAsString: (true) to the connection.  But that will blow up if it happens to not be a DB2 connection.  So we need a #isKindOf: or #canUnderstand: there.  What might be best is us implementing a do-nothing #keepSingleCharStringsAsString: in AbtOdbcDatabaseConnection.  Instantiations could do that too, but then someone might ask them to implement the irrationality if false was the parameter...  ;-)

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/v0uiahJv96EJ.
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/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: 8.5.2 enhancement to optionally answer database CHARACTER(1) columns as a String instead of Character

jtuchel
Hi Wayne,

you somewhere create the DB2 connection, right? I mean, you create an instance that you use to connect to. That's the place where you may find a practical place for such a difference rather than the place where you connect to "some generic DB connection". The final resort might be to use some DB connection factory object that handles this difference.

To be honest, I am not sure why you see a problem at all: the way it worked up to now has been as it is for almost 20 years now....

I remember discussing this change with Bob and we also talked about some setting that could be made in the ini file or at least through some class method. I have not yet had the time to download or install 8.5.2, so I can't check if it was implemented, but I somewhat seem to remember I liked the idea and somehow thought it's going to be there. Maybe it is, can you check for senders of the setter?

Joachim


Am Freitag, 21. September 2012 15:32:42 UTC+2 schrieb Wayne Johnston:
You are right.  I forgot that the irrationality was limited to DB2, so there was nothing to fix anywhere else.  And note to self - it was indeed only CHARACTER(1) columns and not VARCHAR(1) columns.  

The slight problem is our general code that works with DB2 or SQL Server (meaning ODBC).  When we connect, we will send #keepSingleCharStringsAsString: (true) to the connection.  But that will blow up if it happens to not be a DB2 connection.  So we need a #isKindOf: or #canUnderstand: there.  What might be best is us implementing a do-nothing #keepSingleCharStringsAsString: in AbtOdbcDatabaseConnection.  Instantiations could do that too, but then someone might ask them to implement the irrationality if false was the parameter...  ;-)

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/_2fM9F5KZtAJ.
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/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: 8.5.2 enhancement to optionally answer database CHARACTER(1) columns as a String instead of Character

Wayne Johnston
No, I don't see any callers other than my own.

Our code calls various methods but would expand in-line to be like this:

| connection connectionSpec dbManagerClass |
dbManagerClass := self iniSettingsSayDB2
ifTrue: [AbtIbmCliDatabaseManager]
ifFalse: [AbtOdbcDatabaseManager].
connectionSpec := AbtDatabaseConnectionSpec
forDbmClass: dbManagerClass
dataSourceName: self dataSourceName.
connection := connectionSpec
connectUsingAlias: self connectionName
logonSpec: self logonSpec
ifError: errorBlock.
connection isAbtError ifTrue: [^conn].
connection keepSingleCharStringsAsString: true.


So one way to fix the slight problem I'm reporting is to add a "self iniSettingsSayDB2" before the last line.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/4Gomi0497LwJ.
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/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: 8.5.2 enhancement to optionally answer database CHARACTER(1) columns as a String instead of Character

Bob Brodd
Hi Wayne,

As Joachim noted, this behavior only effects DB2 CLI character fields, so it only makes sense to set it for  DB2 CLI connections.  I  chose the default behavior of having  it continue to return a Character to avoid having to respond to a endless 'string' of error reports :-)  That is why no senders are found in the base image.  Fwiw, I think your solution of  testing 'self iniSettingsSayDB2' after you create the connection but before you set the setting makes perfectly good sense.  

Bob

On Friday, September 21, 2012 10:16:39 AM UTC-4, Wayne Johnston wrote:
No, I don't see any callers other than my own.

Our code calls various methods but would expand in-line to be like this:

| connection connectionSpec dbManagerClass |
dbManagerClass := self iniSettingsSayDB2
ifTrue: [AbtIbmCliDatabaseManager]
ifFalse: [AbtOdbcDatabaseManager].
connectionSpec := AbtDatabaseConnectionSpec
forDbmClass: dbManagerClass
dataSourceName: self dataSourceName.
connection := connectionSpec
connectUsingAlias: self connectionName
logonSpec: self logonSpec
ifError: errorBlock.
connection isAbtError ifTrue: [^conn].
connection keepSingleCharStringsAsString: true.


So one way to fix the slight problem I'm reporting is to add a "self iniSettingsSayDB2" before the last line.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/T6Y0KPxIZo0J.
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/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: 8.5.2 enhancement to optionally answer database CHARACTER(1) columns as a String instead of Character

jtuchel
Hi Bob,

otoh, I think some general setting wouldn't hurt... maybe you could consider adding for the next release...

Joachim

Am Freitag, 21. September 2012 22:45:16 UTC+2 schrieb Bob Brodd:
Hi Wayne,

As Joachim noted, this behavior only effects DB2 CLI character fields, so it only makes sense to set it for  DB2 CLI connections.  I  chose the default behavior of having  it continue to return a Character to avoid having to respond to a endless 'string' of error reports :-)  That is why no senders are found in the base image.  Fwiw, I think your solution of  testing 'self iniSettingsSayDB2' after you create the connection but before you set the setting makes perfectly good sense.  

Bob

On Friday, September 21, 2012 10:16:39 AM UTC-4, Wayne Johnston wrote:
No, I don't see any callers other than my own.

Our code calls various methods but would expand in-line to be like this:

| connection connectionSpec dbManagerClass |
dbManagerClass := self iniSettingsSayDB2
ifTrue: [AbtIbmCliDatabaseManager]
ifFalse: [AbtOdbcDatabaseManager].
connectionSpec := AbtDatabaseConnectionSpec
forDbmClass: dbManagerClass
dataSourceName: self dataSourceName.
connection := connectionSpec
connectUsingAlias: self connectionName
logonSpec: self logonSpec
ifError: errorBlock.
connection isAbtError ifTrue: [^conn].
connection keepSingleCharStringsAsString: true.


So one way to fix the slight problem I'm reporting is to add a "self iniSettingsSayDB2" before the last line.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/c01TXCr9ueUJ.
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/va-smalltalk?hl=en.