refresh model mysql gives error

Posts   
 
    
Martin1
User
Posts: 10
Joined: 10-Nov-2011
# Posted on: 13-Nov-2011 15:22:57   

Hi there,

I have succesfully reverse engineered a mysql database. I have added a stored procedure and clicked refresh relational model. I then get the following error:

Exception type: InvalidCastException Object must implement IConvertible.

The new stored procedure is not found.

I am using:

LLBLGENPRO 3.1 Final - TRIAL (target: LLBLGEN runtime framework, template: SelfServicing) MySQL 5.5 DevArt DotConnect 6.5

Very best regards, Martin van der Linden.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-Nov-2011 21:29:46   

Please post the full exception stack trace and the script of your stored procedure, as I think this could be something about the SP's parameters types.

I get the feeling this is something about Devart, but I'm not sure. Could you please open a new HelpDesk thread (which is private) with a repro solution? That is: your db schema script (including the offending stored procedure) and your .llblgenproj file.

David Elizondo | LLBLGen Support Team
Martin1
User
Posts: 10
Joined: 10-Nov-2011
# Posted on: 14-Nov-2011 12:25:35   

I can't use the support yet because I am still evaluating LLBLGEN for a customer so I still have a trial version. However I can post the stored procedure:

CREATE PROCEDURE ign_admin_test.GetNewProjectCode( IN relnr int, IN opdrnr int, INOUT projectcode int ) BEGIN select max(project.PRJCTCODE) FROM project where RELNRP = @relnr AND OPDRNR = @opdrnr INTO @projectcode; set @projectcode = @projectcode + 1; END;

Now I have to say that I am not a MySQL expert and I had some trouble creating a stored procedure that returns a value. There could well be something wrong with it but Toad did except it as being valid.

Thanks, Martin.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 14-Nov-2011 14:23:19   

The stack trace is very important too.

Also you may attach a dummy repro that produces the same error, so you won't be needing the helpdesk forum.

Martin1
User
Posts: 10
Joined: 10-Nov-2011
# Posted on: 14-Nov-2011 15:53:57   

OK. You can create the database with the create script. Then create the stored proc with the other create script. Create new project with LLBLGEN. Select Add model data from database. Select MySQL and select the database. This is where I get the error message. The error message is also attached.

If you need any more info please let me know.

Martin.

Attachments
Filename File size Added on Approval
DDLSQL_CreateScript_ign_admin_test_sp.sql 26,571 14-Nov-2011 15:54.17 Approved
Martin1
User
Posts: 10
Joined: 10-Nov-2011
# Posted on: 14-Nov-2011 15:55:57   

OK I can send only one attachement so I will send you the script for the stored proc with this one and will give you the stack trace here:

Exception information.

LLBLGen Pro version: v3.1. Build: September 30th, 2011

Exception details:

Message: Object must implement IConvertible. Source: mscorlib Stack trace: at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at SD.Tools.BCLExtensions.DataRelated.DataSetExtensionMethods.Value[TValue](DataRow row, String

columnName) in C:\Myprojects\VS.NET Projects\BCLExtensions_hg\DataRelated\DataSetExtensionMethods.cs:line 79 at SD.LLBLGen.Pro.DBDrivers.MySql.MySqlDBDriver.<GetAllStoredProcedureNames>b__22(DataRow row) in c:

\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Drivers 3.1\MySql\MySqlDBDriver.cs:line 591 at SD.LLBLGen.Pro.DBDrivers.MySql.MySqlDBDriver.<>c__DisplayClass2d.<GetAllElementNames>b__29

(<>f__AnonymousType0`2 <>h__TransparentIdentifier26) in c:\Myprojects\VS.NET Projects\LLBLGen Pro

v3.1\Drivers 3.1\MySql\MySqlDBDriver.cs:line 687 at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at SD.LLBLGen.Pro.DBDrivers.MySql.MySqlDBDriver.GetAllElementNames(String[] restrictions, String

schemaCollectionName, String nameFieldName, ICollection1 namesToExclude, Func2 commentRetrieverFunc) in c:

\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Drivers 3.1\MySql\MySqlDBDriver.cs:line 684 at SD.LLBLGen.Pro.DBDrivers.MySql.MySqlDBDriver.GetAllStoredProcedureNames(String catalogName, String

schemaName) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Drivers 3.1\MySql\MySqlDBDriver.cs:line 591 at SD.LLBLGen.Pro.Gui.Controls.WizardPages.MetaDataRetrievalWizard_Step_ElementSelection.PopulateSchema

(TreeNode nodeToPopulate, TagEntry`1 tagData)

Inner exception: <null>

Attachments
Filename File size Added on Approval
DDLSQL_CreateScript_sp.sql 256 14-Nov-2011 15:56.04 Approved
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 15-Nov-2011 06:06:11   

Reproduced.

DDL Script (attached)

Test 1 (fails)

LLBLGen Pro Build: 3.1 Final (September 30th, 2011) dotConnect RTL: 6.30.196.0 MySql Server version: 5.5.14.0 Exception Type: InvalidCastException Message: Object must implement IConvertible. Stack trace: (attached)

Test 2 (works)

dotConnect RTL: 5.50.54.0 MySql Server version: 5.0.86

Test 3 (works)

dotConnect RTL: 6.30.196.0 MySql Server version:5.0.86

So, my guess is that is the MySql Server version (5.5.x). We will look into this.

Attachments
Filename File size Added on Approval
repro-case.zip 1,260 15-Nov-2011 06:08.15 Approved
David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 15-Nov-2011 10:50:41   

(we also give support on the trial version wink )

We'll look into what causes this. We hope to have a fix / solution for this tomorrow (wednesday)

Frans Bouma | Lead developer LLBLGen Pro
Martin1
User
Posts: 10
Joined: 10-Nov-2011
# Posted on: 15-Nov-2011 13:53:52   

Hi there,

Thanks a lot for your help. Even on a trial version. I have no doubt that we will be using LLBLGEN soon because it is the only ORM that can properly reverse engineer a MySQL database. Also the support is excellent which is of a crucial importance.

Please keep me informed on any progress made concerning the sp's.

Cheers, Martin.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 16-Nov-2011 11:20:13   

My guess is the mysqlconnect provider returns some weird value for 'Comment' instead of null or string or DBNull.Value, as the lambda in:

return GetAllElementNames(new[] { catalogName, null }, "Procedures", "Name", new List<string>(), (row) => row.Value<string>("Comment") ?? string.Empty);

goes wrong: the value in that column doesn't implement IConvertible, nor is it null....

It's a lambda that's executed over the schema datatable returned by devart's mysql connector which contains the storedprocedure data. Apparently it returns a value that's not convertible to string when connecting to v5.5, while on older mysql db's, it is.

Looking into it.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 16-Nov-2011 13:33:41   

Reproduced on default sakila database of MySQL 5.5.17.

The 'Comment' column contains a byte array of 0 elements (byte[0]) in the datatable provided by devart's connector, not NULL, nor a comment string. I used v6.50.237.0 of Devart's connector. There's a newer version but the changelog doesn't enlist this as fixed in their driver.

So when doing:

var result = mySqlConnection.GetSchema("Procedures", new string[] { "sakila", null});

on a mysql database v5.5 with the example database 'sakila' installed, I get a datatable back with byte arrays in the 'Comment' column, while the column should contain string values or nulls, not byte arrays.

My guess is that the code to obtain the schema data from the mysql server doesn't take into account that the server returns a different value at some spot in the resultset.

It's a bug in the devart connector for mysql. I've reported it with devart.

If they can't / won't fix it, I'll post back and we'll add a workaround to the driver. We are reluctant to add these kind of patches to our code as it's something which should be solved elsewhere but if that won't happen, we'll create a workaround driver for you.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Nov-2011 09:48:29   

I reported it to devart, but haven't heard anything from them. I suggest you report the same error to them as well, perhaps they put more attention to it that way...

Edit: received reply from devart, ticket id: 34339

Frans Bouma | Lead developer LLBLGen Pro
Martin1
User
Posts: 10
Joined: 10-Nov-2011
# Posted on: 17-Nov-2011 14:25:08   

I have also sent in a report to DevArt supporting your bug report.

Martin.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Dec-2011 15:43:57   

After complaining about that they wanted to postpone it, they finally fixed it. It's not yet released, but it should be released in the next MySql connect version by devart.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Oct-2018 12:44:46   

In v8.x of the DevArt provider, they have the same error back. disappointed

Frans Bouma | Lead developer LLBLGen Pro