List:MySQL and .NET« Previous MessageNext Message »
From:Reggie Burnett Date:February 23 2005 1:46pm
Subject:RE: What's the right way to store unique strings in both dotnet DataTables and MySQL tables?
View as plain text  
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:banshee@stripped] 
> Sent: Friday, February 18, 2005 3:21 PM
> To: dotnet@stripped
> 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?
> 
>  - James
> 
> 
> --
> MySQL on .NET Mailing List
> For list archives: http://lists.mysql.com/dotnet
> To unsubscribe:    
> http://lists.mysql.com/dotnet?unsub=1
> 

Thread
What's the right way to store unique strings in both dotnet DataTables and MySQL tables?James Moore17 Feb
  • RE: What's the right way to store unique strings in both dotnet DataTables and MySQL tables?Daniel Fisla17 Feb
    • RE: What's the right way to store unique strings in both dotnet DataTables and MySQL tables?James Moore18 Feb
      • RE: What's the right way to store unique strings in both dotnet DataTables and MySQL tables?James Moore18 Feb
        • RE: What's the right way to store unique strings in both dotnet DataTables and MySQL tables?Reggie Burnett23 Feb
          • RE: What's the right way to store unique strings in both dotnet DataTables and MySQL tables?James Moore23 Feb