MySQLCommunityServer now returns a nil DatabaseField?

Is it just me or does the MySQLCommunityServer now return a nil DatabaseField object when the value of a database column is null. It used to return a valid DatabaseField with a value that was nil.

For example the following code used to work without a problem but now it throws a NilObjectException

  oRecordSet = MyDB.SQLSelect( "Select UserID, Name from MyUserTable;" )
  if oRecordSet <> nil then
    cName = oRecordSet.Field( "Name" ).StringValue // *****
  end if

The line marked ***** throws an exception if the column called Name contains a null value. Previously .Value would return nil and .StringValue would return “”.

In other words it used to do this:

oRecordSet.Field( “Name” ) => a Valid databasefield object
oRecordSet.Field( “Name” ).value => nil
oRecordSet.Field( “Name” ).StringValue => “”

and now it does this:

oRecordSet.Field( “Name” ) => nil
oRecordSet.Field( “Name” ).value => Exception
oRecordSet.Field( “Name” ).StringValue => Exception

Started a bug report for this: <https://xojo.com/issue/31754>

I have the feeling that this has been changed in 4.0 or 4.1, but can’t access any change-log right now.
This may be an intended behavior.

If it is intended I would need a very good reason to think it was a wise move. It breaks all sorts of code, including all of the examples in the Language Reference.

BTW: I would generally recommend to use “If oRecordSet <> Nil And Not oRecordSet.EOF Then”.

Maybe your NOE is because the SQLSelect Statement gave a valid result but the Database Pointer is already at EOF, thus giving a NIL Object for the Field?

The is only example code. It is not due to that problem. I was simply trying to be very clear about the cause. This error happens half way down the rows (as soon as you get to a row with a null value).