Hi,

I've hit a snag using DBLinq with MySQL and timestamp fields. The SQL
being generated for a timestamp select is not in a valid format for
MySQL.

My code generating the query is:

  DataContext context = new DataContext(new MySqlConnection
("Database=database;Data Source=localhost;User
Id=root;Password=password"), new DbLinq.MySql.MySqlVendor());
  context.Log = Console.Out;
  Table<MyItem> table = context.GetTable<MyItem>();
  var list = from item in table where item.Inserted < DateTime.Now
select item;
  Console.WriteLine((list.FirstOrDefault() == null) ? "failed" :
"suceeded");

The inserted property on the MyItem class is defined as:

        [Column(Storage = "_inserted", Name = "inserted", DbType =
"timestamp", CanBeNull = false)]
        public DateTime Inserted {get; set;}

The SQL generated is:

  select inserted from myitems where inserted < '5/06/2009 10:14:46
AM' limit 1

The timestmap format in the above SQL is invalid for MySQL and should
be:

  select inserted from myitems where inserted < '2009-06-05 10:14:46'
limit 1

I'm about to dig into the DBLinq source to try and fix this for my
specific case but was wondering if there is any advice on the correct
remedy instead of just throwing in a possible hack?

Thanks,

Aaron

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to