Hello all,
I'm running a C#/.NET 3.5 App that uses the MySQL .NET Connector (6.2.3.0) to return data from a 64 Bit MySQL Server running on CentOS 5.
By and large, this works out pretty well. My problem is when I execute queries (procedures mostly) that contain SQL Like this:
SELECT
t.id AS ID
,COUNT(t.item) AS ItemCount
FROM
tbl AS t
GROUP BY t.item;
From a table created like this:
CREATE TABLE tbl (
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`item` INT NOT NULL
) Engine=InnoDB;
I receive back ID as the underlying INT column data type, but ItemCount comes back as System.Int64, which loves to blow up some of my ORM code since the class is defined like this:
public class SomeObject {
public int ID { get; set; }
public int ItemCount { get; set; }
}
I have a few ways to address this in my ORM code, but I'd like to see if there's a way to address this in the Procedure since this seems to be come up with any Computed field that's returned including COUNT(), etc.
I have tried to use MySQL's CAST(), but that only leaves me converting TO a 64 bit int which doesn't buy me anything. Thoughts?
Cheers, Robby