Bug #36081 Get Unknown Datatype in C# .Net
Submitted: 15 Apr 2008 8:04 Modified: 16 Jun 2008 7:24
Reporter: Aviv Levy Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:5.1.5, 5.2.1 OS:Windows
Assigned to: CPU Architecture:Any
Tags: .net, C#, geometry field, gis

[15 Apr 2008 8:04] Aviv Levy
Description:
When using this server version, on c# connector with the following query:
"select ogc_geom from geometryTable". i get exception which says: "Unknown DataType".

i switched connectors several times and got the same exception. 
Than... i reached version 1.0.7 which worked just fine.

How to repeat:
this is the code:

	    MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(); 
            MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand();
            MySql.Data.MySqlClient.MySqlDataReader myData;

            string querySelect;
            int FileSize;
            byte[] rawData;
            MemoryStream ms; 
            conn.ConnectionString = iMyConnectionString;

            querySelect = "select ogc_geom from Borders"; // this is a geometry field

            try
            {
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandText = querySelect;
                
                myData = cmd.ExecuteReader();

                ms.Close();
                myData.Close();
                conn.Close();
            }
            catch (MySql.Data.MySqlClient.MySqlException ex){}
[23 Apr 2008 19:35] Reggie Burnett
Can you post your schema here?
[27 Apr 2008 8:00] Aviv Levy
the table code as requested:

CREATE TABLE  `borders` (
  `ID` int(11) NOT NULL,
  `ogc_geom` geometry NOT NULL default '',
  PRIMARY KEY  (`ID`),
  SPATIAL KEY `Spatial` (`ogc_geom`(32))
) ENGINE=MyISAM DEFAULT CHARSET=hebrew COMMENT='InnoDB free: 3550208 kB';
[28 Apr 2008 19:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/46137
[28 Apr 2008 19:35] Reggie Burnett
Fixed in 5.1.6 and 5.2.2+
[29 Apr 2008 7:18] Aviv Levy
hi,
thanks for the quick fix. i am impressed...
One thing, where can i download this patch? or else, when will the next version be released?
[29 Apr 2008 7:43] Tonci Grgin
Aviv, you can always get c/NET sources from public SVN repositories. Check that fix for your problem is there and build c/NET yourself. See documentation for details.
[16 May 2008 13:16] MC Brown
A note has been added to the 5.1.6 and 5.2.2 changelogs: 

Tables with GEOMETRY field types would return an unknown datatype exception.
[22 May 2008 8:05] Aviv Levy
Let me understand:
1. Previously, Reggie Burnett has added a comment about a new patch which should fix the problem.
2. Now, you say there is no solution but a comment in the documentaion? 

Aviv.
[22 May 2008 17:55] Reggie Burnett
Aviv

You misunderstand.  The note that was added to the docs was that _before_ you would get an unknown data type error.
[25 May 2008 8:41] Aviv Levy
O.K. thanks. Do you know when would the next version be released?
[27 May 2008 21:17] Reggie Burnett
5.2.2 is out now
[16 Jun 2008 7:24] Aviv Levy
Great, it Seems Fine. 
Thanks a lot.