Jerome, Chris
"Chris Uppal" <
[hidden email]> wrote in message
news:3edf12ce$0$45171$
[hidden email]...
> Jerome Chan wrote:
> > I've just installed the postgresql odbc driver on my xp box and I
> > can't get DBConnection to work. The following throws an exception
> >
> > dbC := DBConnection new.
> > dbC open.
>
> I see the same problem. Which surprised me since I was playing with a
> connection to PostgreSQL just a couple of weeks ago, and that worked OK.
>...
> Alternatively you could change DBConnection class>>connectString:do: to be
> defensive about empty strings:
> --------------------
> ...
> ((aString subStrings: $;) select: [:s | s notEmpty]) do: [:s |
> ...
> --------------------
> which seems like a reasonable change to propose for the base image ?
Yes, this is actually a bug (#1284) in the connection string handling since
the ODBC spec explicitly allows for empty "attributes". Odd but true.
Anyway the proposed patch is below.
Regards
Blair
-------------------------
!DBConnection class methodsFor!
connectString: aString do: aTwoArgBlock
"Private - Interpret the connection string and pass the parameter name and
value from each $; separated
substring to aTwoArgBlock."
(aString subStrings: $;) do:
[:each |
each isEmpty
ifFalse:
[| equals paramName paramValue |
equals := each indexOf: $=.
paramName := each copyFrom: 1 to: equals - 1.
paramValue := each copyFrom: equals + 1 to: each size.
aTwoArgBlock value: paramName value: paramValue]]! !
!DBConnection class categoriesFor: #connectString:do:!operations!private! !