6 messages in com.mysql.lists.dotnetRE: What's the right way to store uni...
FromSent OnAttachments
James Moore17 Feb 2005 09:58 
Daniel Fisla17 Feb 2005 11:41 
James Moore18 Feb 2005 12:47 
James Moore18 Feb 2005 13:20 
Reggie Burnett23 Feb 2005 05:46 
James Moore23 Feb 2005 12:00 
Subject:RE: What's the right way to store unique strings in both dotnet DataTables and MySQL tables?
From:Reggie Burnett (reg@mysql.com)
Date:02/23/2005 05:46:03 AM
List:com.mysql.lists.dotnet

James

When you say that a column with collate utf8_bin is not treated as a string, what do you mean? Here is a test case that put together that succeeds. Am I doing something different than you? Are you specifying a character set on your connection string?

[Test] public void VarBinary() { execSQL("DROP TABLE IF EXISTS test"); createTable("CREATE TABLE test (id int, name varchar(200) collate utf8_bin) charset utf8", "InnoDB"); execSQL("INSERT INTO test VALUES (1, 'Test1')");

MySqlCommand cmd = new MySqlCommand("SELECT * FROM test", conn); MySqlDataReader reader = null; try { reader = cmd.ExecuteReader(); Assert.IsTrue(reader.Read()); object o = reader.GetValue(1); Assert.IsTrue(o is string); } catch (Exception ex) { Assert.Fail(ex.Message); } finally { if (reader != null) reader.Close(); } }

-----Original Message----- From: James Moore [mailto:bans@banshee.com] Sent: Friday, February 18, 2005 3:21 PM To: dot@lists.mysql.com Subject: RE: What's the right way to store unique strings in both dotnet DataTables and MySQL tables?

As a quick experiment, I replaced IsBinary in Field.cs with

public bool IsBinary { get { return false;} }

And things seem to be working OK. I'm getting the behavior I expect (strings inserting, updating, and selecting correctly).

This isn't anything more than an experiment; certainly it's not a well-designed solution to the issue.

I poked around in the code, and was somewhat surprised to see that there's no instance of the string 'varbinary' - shouldn't it be there in parallel with varchar?