Search found 6 matches

by SquishyZA
Wed 28 Jul 2021 17:52
Forum: dotConnect for MySQL
Topic: Updates fail if a column name starts with 'Names'
Replies: 1
Views: 20483

Updates fail if a column name starts with 'Names'

Reproduced using Devart.Data.MySql.EFCore 8.8.1759 and interestingly enough dbForge Studio 2020 for MySQL 9.0.636.

Any Column that has a name that start with 'Names' can reproduce this issue.

It is easier to reproduce in dbForge so I will first provide steps for that:

1. Create a schema test
2. Create a table

Code: Select all

CREATE TABLE test.test (
  Id int UNSIGNED NOT NULL AUTO_INCREMENT,
  Names2 bit(1) DEFAULT NULL,
  PRIMARY KEY (Id)
)
ENGINE = INNODB,
AUTO_INCREMENT = 2,
CHARACTER SET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
3. Insert a row with an Id of 1 and any value for Names2
4. Run the following query (This query was extracted from the Entity Framework debugging message) :

Code: Select all

UPDATE test.test set Names2 = 0 
 WHERE Id = 1;
5. It fails with an error message of "Character set '2 = 0
where id = 1' is not supported"

The same can be reproduced in Entity Framework in .NET Core 3.1 using the mentioned Devart.Data.MySql.EFCore. That is how I found this issue initially and when I tried to reproduce it in dbForge saw the same issue there. That query works in Workbench.

In Core it would be something like:

Code: Select all

var item = dbCtx.Test.FirstOrDefault();
item.Names2 = 0;
dbCtx.SaveChanges();
The SaveChanges generates the same error message as dbForge.

Interesting enough in dbForge if you quote the name you can work around it. I have not seen a similar option for Entity Framework.
by SquishyZA
Mon 08 Feb 2021 21:42
Forum: dotConnect for MySQL
Topic: MySqlConnectionStringBuilder breaks License Key
Replies: 1
Views: 12727

MySqlConnectionStringBuilder breaks License Key

The license key I have contains '\n'. When I build a connection string using MySqlConnectionStringBuilder it creates a string that looks like "\"random\nmorerandon\"". The quoted escape characters then prevent the license from being validated. I have to manually append a "License Key=...." to get a workable connection string if I use MySqlConnectionStringBuilder and not set the license key through the builder.

As an added bonus some methods in other libraries will escape the '\n' to "\\n" and that breaks the license key checking too. This I can work around too.

So maybe the license key verifier is a bit too sensitive to escaping/quoting ? Or MySqlConnectionStringBuilder should be more aware of not breaking license key validation?
by SquishyZA
Wed 15 Jul 2020 16:03
Forum: dotConnect for MySQL
Topic: MySqlLoader and binary data
Replies: 3
Views: 3575

Re: MySqlLoader and binary data

Thank you, it did work.
by SquishyZA
Wed 01 Jul 2020 16:01
Forum: dotConnect for MySQL
Topic: MySqlLoader and binary data
Replies: 3
Views: 3575

Re: MySqlLoader and binary data

More information. So it is not actually truncating the binary data. It is storing the string ‘System.byte[]’ as bytes. I assume it is just doing a item.Data.ToString() type conversion.
by SquishyZA
Tue 30 Jun 2020 15:57
Forum: dotConnect for MySQL
Topic: MySqlLoader and binary data
Replies: 3
Views: 3575

MySqlLoader and binary data

I am using MySqlLoader to load a large number of rows into a table and the performance is awesome, but it does not seem to handle binary data properly.

I followed the example from the documentation.

Some pseudo code to illustrate:

Var loader = new MySqlLoader(...);
Loader.CreateColumns();
Loader.Open();
Foreach (var item in distinctItems)
{
loader.SetValue(“Size”, item.Size); // item.Size is a long
loader.SetValue(“Data”, item.Data); // item.Data is a byte[16]
loader.NextRow();
}
loader.Close();

What I observe:
1. Item.Data is truncated to 13 bytes on the first loop, most likely because it is not properly escaped. But I don’t see a way to escape it.
2. On the next loop the “Data” column is not updated so it properly inserts rows with new “Size” values but all the “Data” values matches the first row value

I tried representing item.Data as “X’[hex representation of item.Data]’” but that complained about the string being too long.

Any ideas would be appreciated.

Thank you
by SquishyZA
Tue 30 Jun 2020 15:46
Forum: Entity Framework support
Topic: MySql Binary as Guid = yes
Replies: 2
Views: 4039

MySql Binary as Guid = yes

It seems like if for DevArt.Data.MySql.EFCore that if you specify “Binary as Guid=yes” in the connection string that all BINARY(16) fields are assumed to be a Guid/UUID. Is there a way to convince EF that it is not a Guid? My definition of the offending property is:

[Column(TypeName=“BINARY(16)”)]
[Required]
Public byte[] Data {get; set;}

Depending on what I try I get different errors. The only way to make it work is to remove “Binary as Guid” from the connection string. But I really need to have binary Guid’s, so a way to make this work would be appreciated.

Thank you