Retreiving a uuid from a table when the field is setup as a char(16) binary -- error description and fix
Posted by: Jacob
Date: February 21, 2005 05:17PM

I thought about adding this as a bug but instead posted it here first. I can later create a bug for it if needed.


If you do a char(16) binary -- to create a uuid -- it will be returned as a string in all instances. In the case statement of function
internal static MySqlValue GetMySqlValue
that begins on line 112 of MySqlValue.cs, just change the VarChar case to handle the binary value... line it is setup in the default section.

case MySqlDbType.VarChar:
if (binary)
return new MySqlBinary( null, type );
return new MySqlString( null, type );


Also, I have created a MySqlBool type and am contemplating on creating a MySqlUUID type for specific instances of variables of .NET.

Like bool is going to be a Byte of column length 1.
Guid/uuid is going to be a char of length 16 and also binary.

Would you be interested in the source of these?

The reason I am creating then is so I can them auto cast the fields like (bool) drow["ABool"] instead of having to save the value to a variable and then preform logic to get it cast right.

Options: ReplyQuote


Subject
Written By
Posted
Retreiving a uuid from a table when the field is setup as a char(16) binary -- error description and fix
February 21, 2005 05:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.