[Mono-list] switch with strings and Npgsql strong datatype support is now working with Mono :)
Francisco Figueiredo Jr.
Sun, 20 Apr 2003 13:06:19 -0300 (ART)
After some time working with Npgsql strong datatype support I finally got it
working on Mono.
I think I could isolate the problem to switchs with strings I was doing :)
It could be something related with .
I don't know yet why it wasn't working. The problem relied in the
NpgsqlTypesHelper class in the methods which used a switch in a string.
The side-effect was programs hangs and sometimes I got a stacktrace where I
could get line numbers (with mono --debug) up to the method which had the error
Stacktrace didn't show me line number, just the string unmanaged instead.
(Sorry for not sending you the stack strace, I'm not using the machine which I
can generate it. I will send it to you later.)
I could check the .il code generated and it seemed to be good. But as I don't
very much experience with jit, and I hope it has something with , I just
changed my implementation.
In my implementation I changed all string switchs to int switchs. But then, to
do this, I needed one place to use switch with strings. So, with this
experience, I decided to use if else if's...
So, when I got it working, I decided to change it again and replaced the if,
else if code with a switch with strings and it also worked!! Note that I didn't
replace all the code back to string switch, just this new code.
What's the difference between the previous switch which didn't work and the new
which do? Maybe this can give some light on this...:
oidToNameMapping is a Hashtable.
didn't work: switch ((String) oidToNameMapping[typeOid])
s is a single string.
do work: switch (s)
Which leads me to think that the problem cound't be in the switch, may in the
Hashtable lookup, ou maybe the cast... or they all together :)
Sorry if I'm bothering you very much with this. Also, note that I tyried this
with 0.23 release as well as cvs from yesterday (2003-04-19).
I will try to get a test case to reproduce this error. While I don't get it, if
you are interest, grab the source of Npgsql from gborg. The file with the
problem is NpgsqlTypes/NpgsqlTypesHelper.cs revision 1.2. Just compile it and
try a simple task of connecting to the backend.
But the good news is that Npgsql is now working with Mono. :)
I will try to put the new code in the Mono cvs so Mono can ship with the strong
datatype support of Npgsql :)
Francisco Figueiredo Jr.
O melhor e-mail gratuito da internet: 6MB de espašo, antivÝrus, acesso POP3, filtro contra spam.