dotConnect for MySQL - Incorrect param direct identification

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
zag164
Posts: 2
Joined: Tue 27 Dec 2011 17:34

dotConnect for MySQL - Incorrect param direct identification

Post by zag164 » Tue 27 Dec 2011 17:50

Hi,

I am evaluating dotConnect for MySQL with a view to purchasing for a project but have hit an issue. I have a simple stored procedure which takes an ID as an input param and returns 3 output params.

In Visual Studio 2010 I have created a DevArt LinqConnect model and method has been created for the stored procedure. The issue I have is that the generated method for calling the stored procedure incorrectly identifies the 3 output params as input params which causes an exception at runtime. I can manually go in and edit the 3 parameter directions in the generated method to be output params and all works perfectly, but the next time I try to update the model from the database, the method is identified as not matching the database and updated again (setting all the params to input params again which is wrong).

This appears to be a bug - can you help please? I am running v6.60.268.

MySQL version is 5.5.19

Regards
Mike

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Wed 28 Dec 2011 15:44

Could you please specify the definition of the procedure, with which the issue occurs, and the code generated for it?

We couldn't reproduce the issue in our environment. For example, I created the following procedure and added it to a LinqConnect model:

Code: Select all

CREATE PROCEDURE TestOutParams(IN In1 INT, OUT Out1 INT, OUT Out2 INT, OUT out3 INT)
BEGIN
  SET out1 = in1 + 1;
  SET out2 = in1 + 2;
  SET out3 = in1 + 3;
END;
The code Entity Developer generated for it is

Code: Select all

[Function(Name=@"TestOutParams")]
public System.Int32 TestOutParam(
  [Parameter(Name="in1", DbType="int")] System.Nullable in1,
  [Parameter(Name="out1", DbType="int")] out System.Nullable out1,
  [Parameter(Name="out2", DbType="int")] out System.Nullable out2,
  [Parameter(Name="out3", DbType="int")] out System.Nullable out3
) {
    
  IExecuteResult _TestOutParamResult = 
    this.ExecuteMethodCall(
      this,
      ((MethodInfo)(MethodInfo.GetCurrentMethod())),
      in1,
      null,
      null,
      null
    );
  out1 = ((System.Nullable)(_TestOutParamResult.GetParameterValue(1)));
  out2 = ((System.Nullable)(_TestOutParamResult.GetParameterValue(2)));
  out3 = ((System.Nullable)(_TestOutParamResult.GetParameterValue(3)));
  return ((System.Int32)(_TestOutParamResult.ReturnValue));
}

zag164
Posts: 2
Joined: Tue 27 Dec 2011 17:34

Post by zag164 » Wed 28 Dec 2011 16:15

Hi Thanks for your reply. Here is the stored proc code (from Fusion).

USE test;
DELIMITER $$
CREATE DEFINER = 'root'@'localhost'
PROCEDURE spGetPersonByID(IN pPersonID INT, OUT pFirstName VARCHAR(50), OUT pLastName VARCHAR(50), OUT pDOB DATE)
READS SQL DATA
COMMENT 'Now returns the DOB too'
BEGIN
SELECT
FirstName,
LastName,
DOB
INTO
pFirstName, pLastName, pDOB
FROM
people
WHERE
PersonID = pPersonID;
END$$
DELIMITER ;


This is the VB code generated by Entity Developer
_
Public Function SpGetPersonByID( pPersonID As System.Nullable(Of Integer), pFirstName As String, pLastName As String, pDOB As System.Nullable(Of System.DateTime)) As System.Int32
Dim _SpGetPersonByIDResult As IExecuteResult = Me.ExecuteMethodCall(Me, CType(MethodInfo.GetCurrentMethod(), MethodInfo), pPersonID, pFirstName, pLastName, pDOB)
Return CType(_SpGetPersonByIDResult.ReturnValue, System.Int32)
End Function

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 29 Dec 2011 14:00

Thank you for your assistance, we have reproduced the issue. We will analyze it and inform you when it is fixed.

As a temporary workaround, you can manually change the parameters' direction in the model. To save these changes when updating the model from the database, ensure that you clear the check boxes corresponding to such procedures at the 'Choose change actions' wizard step.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Mon 16 Jan 2012 08:24

We have fixed the problem, the fix is available in the latest 6.60.283 build of dotConnect for MySQL. The new build can be downloaded from
http://www.devart.com/dotconnect/mysql/download.html
(the trial only) or from Registered Users' Area (provided that you have an active subscription).

For the detailed information about the fixes and improvements available in dotConnect for MySQL 6.60.283, please refer to
http://www.devart.com/forums/viewtopic.php?t=23130

Post Reply