Thanks Igor. I also noticed that the Linux ODBC Driver deserializes the
Ignite UUID data type into a byte[] instead of the .Net Guid type. That is
contrary to what is stated in the documentation (
https://apacheignite-sql.readme.io/docs/data-types#section-uuid).

SQL Example:
CREATE TABLE MyTable (Id INT not null, myUUID UUID, PRIMARY KEY (Id));
INSERT INTO MyTable (Id, myUUID) VALUES (0,
'24E4A97A-96DC-47EB-89C0-9C44E60DC048');
SELECT myUUID FROM MyTable;

C#:
using System;
using System.Data.Odbc;

namespace IgniteUUIDWrongDataTypeReproducer {
    internal class Program {
        private static void Main(string[] args) {
            var connectionString =
Environment.GetEnvironmentVariable("IGNITE_CONNECTION_STRING");

            using (var conn = new OdbcConnection(connectionString)) {
                conn.Open();

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "DROP TABLE IF EXISTS MyTable;";
                    cmd.ExecuteNonQuery();
                }

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "CREATE TABLE MyTable (Id INT not
null, myUUID UUID, PRIMARY KEY (Id));";
                    cmd.ExecuteNonQuery();
                }

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "INSERT INTO MyTable (Id, myUUID)
VALUES (0, '24E4A97A-96DC-47EB-89C0-9C44E60DC048');";
                    cmd.ExecuteNonQuery();
                }

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "SELECT myUUID FROM MyTable;";
                    using (var rdr = cmd.ExecuteReader()) {
                        rdr.Read();
                        var value = rdr[0];
                        Console.WriteLine($"{rdr.GetName(0)}='{value}'
DotnetType='{value.GetType()}' DBType='{rdr.GetDataTypeName(0)}'");
                    }
                }
            }
        }
    }
}

Console Output:
MYUUID='System.Byte[]' DotnetType='System.Byte[]' DBType='VARBINARY'

Should be: (According to
https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/sql-data-types?view=sql-server-2017
)
MYUUID='24E4A97A-96DC-47EB-89C0-9C44E60DC048' DotnetType='System.Guid'
DBType='GUID'





On Mon, May 13, 2019 at 9:55 AM Igor Sapego <[email protected]> wrote:

> It seems like some encoding related issue to me.
> Added a Jira ticket: [1].
>
> [1] - https://issues.apache.org/jira/browse/IGNITE-11845
>
> Best Regards,
> Igor
>
>
> On Thu, May 2, 2019 at 1:15 AM Charles Rene <[email protected]>
> wrote:
>
>> Hello,
>>
>> I'm having trouble using the Apache Ignite 2.7.0 Linux built ODBC driver.
>> I'm running a .Net Core 2.2 console application in a Linux environment in
>> Docker.
>>
>> The problem is that when I run a SELECT statement through .Net's
>> System.Data.Odbc, I get back "bad data". It looks like a mismatch in
>> encoding.
>>
>> The data looks like  "8\00\05\07\09\0d\09\08\0-\0" where as it should be
>> "80579d98-9010-4610-b12e-ed33ed7d3c62".
>>
>> Details about my investigation can be found here:
>>
>> https://stackoverflow.com/questions/55875927/apache-ignite-2-7-odbc-linux-bad-data-returned
>>
>>
>> Any idea what the problem might be?
>>
>> Thank you,
>> Charlie
>>
>

Reply via email to