MySQL data type support

Posts   
 
    
cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 20-May-2014 15:02:20   

Hello,

we are using latest LLBLGenPro (4.1-Final) with model first and adapter scenario. When trying to create entities I do not see Binary type in Field mapping->Edit mapping dialog. Is this by design or a designer bug?

Another problem is with DateTime type. MySQL (and MariaDB) already has a support for DateTime type with fractional settings:

http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html

Seems that LLBLGenPro designer generates scripts without supporting fractional seconds. I was able to modify templates to generate database fields with hardcoded precision, however would be nice to have this support also in designer.

Still another problem remains - queries shown in the trace are without fractional seconds (however - data inserted in db correctly).

any ideas?

with best regards Mantas

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 20-May-2014 17:24:58   

cerberis wrote:

Hello,

we are using latest LLBLGenPro (4.1-Final) with model first and adapter scenario. When trying to create entities I do not see Binary type in Field mapping->Edit mapping dialog. Is this by design or a designer bug?

You work with type shortcuts in the designer, which are type shortcuts for .NET types. 'Binary' is a db type so this isn't usable in .NET. Binary is converted/mapped as byte[], and therefore you should use the byte[] type shortcut.

Another problem is with DateTime type. MySQL (and MariaDB) already has a support for DateTime type with fractional settings:

http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html

Seems that LLBLGenPro designer generates scripts without supporting fractional seconds. I was able to modify templates to generate database fields with hardcoded precision, however would be nice to have this support also in designer.

Thanks, we'll look into whether we can still include this before 4.2 goes beta simple_smile

Still another problem remains - queries shown in the trace are without fractional seconds (however - data inserted in db correctly).

any ideas?

with best regards Mantas

The trace logs do a simple ToString() on the value, so the datetime value is emitted in the trace log as datetime.ToString(), which might not be as precise as wanted. We'll look into changing this to emitting the standardized default.

Frans Bouma | Lead developer LLBLGen Pro
cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 21-May-2014 08:08:29   

Are we talking about same dialog? simple_smile I understand that there is no .NET type binary and it is represented as byte[]. However, DB type is Binary and it is not available for selection simple_smile I added screenshot with it.

Attachments
Filename File size Added on Approval
MySQL DB Types.png 15,295 21-May-2014 08:08.53 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 21-May-2014 09:20:00   

Hmm. that's odd indeed, the type isn't defined in our driver at all. It might be due to the fact the ADO.NET provider we use (dotconnect for mysql) will return the results as a string, but I'll look into it.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 21-May-2014 10:26:01   

It's a blur to me how this has gone unnoticed since forever! Binary type added to driver and DDL SQL template. I've given it a lower precedence as varbinary though you can give your preference for fixed length vs. variable length types in the project properties. This is for model first, so if you prefer fixed length types, it will pick binary(n) if the .net type is byte[] and the length doesn't fit a blob (so is > 1 and < 64KB).

Likely it wasn't added in the time it wasn't supported by the ado.net provider or it was introduced in mysql v5, but still it's odd it's not in the driver. Anyway, it's in the next build, which will likely be uploaded later today.

Frans Bouma | Lead developer LLBLGen Pro
cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 21-May-2014 11:06:43   

Thank you very much simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 21-May-2014 16:54:04   

It's available. We did change one Mysql DDL SQL script, the fieldcreation template, where we added support for Binary. You said you altered the templates so that's the one which you have to port back to your altered set simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-May-2014 16:03:04   

With the fractional seconds: it's a bit of a problem. The value for the fractional scale has to be stored somewhere. This is doable in the field itself (although that looks like a hack, it's nowhere obvious that a scale value in a datetime/timestamp field will result in fractional seconds), however the engine ignores this value when it creates target field types as time/datetime values don't have a scale, obviously. Mysql is also the only db which has this problem, and that wouldn't be so bad was it not that they solved it in a not that great way: instead of making '6' the default, and configurable on the DB level, they forced '0' as default and make it mandatory to specify the fraction, which is something one never should have to do.

Frans Bouma | Lead developer LLBLGen Pro
cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 09-Jul-2014 16:09:14   

Hello,

we came up witn another data type which is missing: BIT. It seams that MySQL has this type since 5.0.3 version, however I do not see it in field mapping dialog. We are using tinyint(1) for now, however probably makes sense to use native db types here simple_smile

Using LLBLGenPro 4.2 (updated yesterday).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 09-Jul-2014 16:39:46   

MySQLConnect from devart, the ado.net provider we use, doesn't support it as bit/bool, but as int64, so there's nothing we can do without a type converter.

Frans Bouma | Lead developer LLBLGen Pro