This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, I think I found a bug when using MySQL5 provider with TINYINT(1) When I add a table with this field type to the model it assigns the equivalent type SByte, which should be fine. I can successfully create records using the model generated, however when attempting to read the data LightSpeed throws an exception. Unable to materialize field - The inner exception is: "Object of type 'System.Boolean' cannot be converted to type 'System.SByte'." I can resolve this by changing SByte to an Integer type but changing my model for all references of TINYINT isn't ideal. Thanks, any input would be greatly appreciated. Scott |
|
|
Thanks for drawing our attention to this. I've updated the designer so that tinyint(1) columns will now be inferred as Boolean instead of SByte. This change will be included in nightly builds dated 24 Mar 2010 and above, available from about 1500 GMT. Please let us know if you still see problems. |
|
|
Hi Ivan I have tried the fix but still getting the error. Have installed the nightly build 25 Mar 2010 and referenced it. (3.0.1168.13375) I then recreated the model but when trying to return records from a table with TINYINT(1) fields I am still getting the same error. ---- [ArgumentException: Object of type 'System.Boolean' cannot be converted to type 'System.SByte'.] --- When I recreated the model the designer still inferred as SByte. But I think it should for TINYINT(1). I think the designers inferred type of SByte is correct. I think the problem lies in the inferred type in the returned result set. So because TINYINT(1) can store from -9 to 9 in terms of values - it shouldn't be inferred as Boolean as this is equiv. of -1 or 0. The LightSpeed designer knows to convert TINYINT(1) to SByte; but when there is a TINYINT(1) in a result set its being typed to Boolean not SByte which would not only loose the range of -9 to 9 but also not match the SByte type of the entity. Thanks Scott |
|
|
Hello Just wondered if there was any progress on this - even its it's just some thoughts on what might be happening, its becoming a bit of a problem. Many thanks again. Cheers, Scott |
|
|
See previous message - we believe this was fixed in the 24 March nightly. (Forums notification emails are not 100% reliable unfortunately, but you can check for updates using the View Complete Thread button.) |
|
|
Hi Ivan, Thanks for getting back to me, but my previous post was the resulting error after installing the nightly build. Unfortunately it is still an issue.
Thanks Scott |
|
|
Oops, I need to take my own advice -- hadn't seen your second error report. According to the MySQL manual, " So our understanding is that the designer should infer Boolean for TINYINT(1) columns, because that is what MySQL will give us at runtime. However, you say that TINYINT(1) can actually contain the values -9 to 9 and should therefore be mapped to SByte. This makes sense... but since the MySQL driver is giving us only a System.Boolean, I can't see any way to obtain that -9 to 9 value. The mapping to boolean appears to be happening below the level of LightSpeed. Given the constraint that the MySQL driver seems to be mapping TINYINT(1) to Boolean before we can get to it, I'm not sure there's any way around it. Do you know of a MySQL configuration or connection string setting that we can use to force it to present TINYINT(1) values as SBytes instead of Booleans? |
|
|
Thanks for that link, I didn't realize it was at MySQL level - but it does seem to be some backward compatibility thats going on. I think then for the sake of simplicity I will be removing the size from my TINYINT this should then bring the necessary SByte to the surface. I will be trying in a few hours to see how it goes. After reading I think TINYINT(1) should be avoided unless being used as Boolean. I had a bit of a look about but can't find any setting to force out a SByte. Thanks for all your help. Scott |
|