[ODBC-37] Issue reading table data with C# VS2013 Created: 2016-04-25  Updated: 2020-12-08  Resolved: 2016-05-10

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.11

Type: Bug Priority: Major
Reporter: Steven Riat Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None
Environment:

Server Ver 14.14 Distrib 5.5.30, for Win64 (x86) (Windows server 2008 R2 standard), Client running C# application (Windows 7 enterprise)


Attachments: Zip Archive MariaDbCSharpConnectorTest.zip     Microsoft Word fileContentLargeBlobSizes.csv     File maodbc.dll     File maodbc.dll    

 Description   

C# Application gets exceptions reading tables using MariaDB connector ODBC 2.0.10 64bit. No issues running with MySQL connector ODBC.

C# Application included - change DB host, database, username, password before running to point to your database. Application should not have any exceptions reading tables. Works fine with MySQL connector ODBC driver.

Exception:
Arithmetic operation resulted in an overflow.



 Comments   
Comment by Lawrin Novitsky [ 2016-04-25 ]

Thank you for your report. I will look into it. One question - do I understand correctly that this happens with any table?

Comment by Steven Riat [ 2016-04-26 ]

The first exception is from second table read, with field name "id", INT data type, Auto Increment. If you have a database that has all data types, that will be a good test. Below is the first two tables

first table

CREATE TABLE myFirstTable(
`entry` VARCHAR(100) NOT NULL COLLATE 'utf8_unicode_ci'
)
second table
CREATE TABLE mySecondTable(
`id` INT(11) NOT NULL AUTO_INCREMENT,
`jobletId` INT(11) NOT NULL,
`extraId` INT(11) NULL DEFAULT NULL,
`audittime` DATETIME NULL DEFAULT NULL,
`author` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
`detailKey` MEDIUMTEXT NULL COLLATE 'utf8_unicode_ci',
`param0` MEDIUMTEXT NULL COLLATE 'utf8_unicode_ci',
`param1` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
`param2` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
`param3` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
`param4` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
`severity` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci'
)

Comment by Lawrin Novitsky [ 2016-05-03 ]

The problem was in 64bit connector - in SQLGetData variable used for data length had larger size, than "unsigned long" expected for length in MYSQL_BIND structure. That resulted in bogus values eventually returned to the application.

I have attached the dll with the fix. Feel free to re-open this if the problem hasn't gone, or file a new bug report in case of other problems.

Comment by Steven Riat [ 2016-05-03 ]

Got past the first exception, now I get exception "'System.AccessViolationException' when its reading field 7 'hide'

CREATE TABLE file(
`fileName` VARCHAR(255) NOT NULL COLLATE 'utf8_unicode_ci',
`version` INT(11) NOT NULL,
`fileType` VARCHAR(128) NOT NULL COLLATE 'utf8_unicode_ci',
`md5Checksum` VARCHAR(32) NOT NULL COLLATE 'utf8_unicode_ci',
`fileContents` LONGBLOB NOT NULL,
`remoteUNC` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
`isDefault` BIT(1) NULL DEFAULT b'0',
`hide` BIT(1) NULL DEFAULT b'0'
)

Comment by Lawrin Novitsky [ 2016-05-03 ]

Ok, reopening.

Comment by Lawrin Novitsky [ 2016-05-03 ]

Strange passed for me with your table without exception. I will try to figure out from the code what and why could happen with bit field

Comment by Steven Riat [ 2016-05-05 ]

Note: 13 tables were read successful before 'file' table was read and caused the exception with reading 'hide' field using GetValue()

Comment by Lawrin Novitsky [ 2016-05-06 ]

Well, "file" wasn't only/first table in my test database either. There should be smth more for it. Would it be possible to post other 13 tables structure/test data here? Or send to my email @mariadb.com? I have one more idea to check. But I guess with your db structure it would go faster anyway.

Comment by Steven Riat [ 2016-05-06 ]

The table/data are for internal use only, sorry. Is it possible to send pdb's , source or both, for me to debug it and get back to you with exception tree?

Comment by Steven Riat [ 2016-05-06 ]

I narrowed it down to the 'file' table only, I sent earlier. Deleted all the other tables. Then in the 'file' table, deleted all fields except 'filecontent', 'isDefault', and 'hide'. Around the 200 record read, it failed on 'hide' again. I can't send the table, but I believe its related to the LARGEBLOB field 'filecontent'. I exported the table and its around 132 megs. So on average around 664K per record. You might want to create a table and fill with 'filecontent' with random data of about 1 meg per record or so for testing.

Comment by Steven Riat [ 2016-05-06 ]

I attached the 'filecontent' largeblob data sizes in a csv file if that helps any.

Comment by Lawrin Novitsky [ 2016-05-06 ]

Thanks, I guess this can help. I will try to recreate your problem

Comment by Lawrin Novitsky [ 2016-05-09 ]

I could not re-create your problem, but I have some good reasons to think that I have fixed it. I removed old library from this page, and attached the new one. Could you please check if now it works for you?

Comment by Steven Riat [ 2016-05-09 ]

It worked. Can you also give me a 32 bit version? Thank you very much.

Comment by Lawrin Novitsky [ 2016-05-10 ]

Closing. There was combination of bugs here. Most of them was pure 64bit problem. And I guess part of last problem was bug in (old) underlying Connector/C. And partly that was problem in SQLGetData, and I think 32bit was affected by it, too

Comment by Lawrin Novitsky [ 2016-05-10 ]

I attached 32bit dll here as well. But you know, this is not official release or something. Only good for testing purposes. But enjoy

Generated at Thu Feb 08 03:25:46 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.