[Mono-list] MySQL and NULL values

Reggie Burnett rykr@bellsouth.net
Fri, 7 Feb 2003 21:15:54 -0600


Derek

I am not sure what is going on here.  I am using the driver in a site of
mine and certainly have nulls in that database.  I'll take a look and
post what I find.

Reggie

> -----Original Message-----
> From: mono-list-admin@lists.ximian.com [mailto:mono-list-
> admin@lists.ximian.com] On Behalf Of Derek Hamilton
> Sent: Friday, February 07, 2003 6:05 PM
> To: mono-list@ximian.com
> Subject: Re: [Mono-list] MySQL and NULL values
> 
> Sorry to reply to my own post so quickly.  I'm not sure exactly who to
> send
> this to (never worked with open source before) but I found the line of
> code
> that is causing NULL values to fail in the BtyeFX code.
> 
> In the datareader.cs page if this:
> 
> public bool IsDBNull(int i)
> {
>      return DBNull.Value == GetValue(i);
> }
> 
> is changed to
> 
> public bool IsDBNull(int i)
> {
>      return GetValue(i) == null;
> }
> 
> then the IsDBNull will actually catch NULL values where as before it
would
> not (at least in my case).  I'm not really sure why the System.DBNull
> wouldn't catch this.
> 
> Thanks,
> Derek Hamilton
> 
> ----- Original Message -----
> From: "Derek Hamilton" <derek@capweb.com>
> To: <mono-list@ximian.com>
> Sent: Friday, February 07, 2003 3:35 PM
> Subject: [Mono-list] MySQL and NULL values
> 
> 
> > Hello all,
> >
> > I am using the ByteFX library for MySQL db access and am
experiencing
> > trouble with NULL.  I am wondering if this is a MySQL problem (I
> remember
> > something about null handling being a problem in that past) or a
> BtyeFX/mono
> > problem.
> >
> > Specifically, if I create a MySQLDataReader and Read() through the
> results
> > where the results all have values it works fine.  If I try reading
> through
> a
> > result set with any kind of NULL I get a "Object reference not set
to an
> > instance of an object."
> >
> > If I change all the nulls in my db to be an empty string the problem
> doesn't
> > occur.  I'm just not sure how feasible that is.
> >
> > Any advice?
> >
> > Thanks,
> > Derek Hamilton
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> >
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list