Skip to content

Commit 6efc408

Browse files
Fix syntax error when executing stored procedures in MySQL using mysqlconnector.
1 parent 4959fe1 commit 6efc408

File tree

2 files changed

+17
-32
lines changed

2 files changed

+17
-32
lines changed

dotnet/src/dotnetframework/GxClasses/Data/GXDataMysqlConnector.cs

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1+
using System;
2+
using System.Data;
3+
using System.Data.Common;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Security;
7+
using System.Text;
18
using GeneXus.Application;
29
using GeneXus.Cache;
310
using GeneXus.Utils;
11+
using GxClasses.Helpers;
412
using log4net;
513
using MySQLCommand = MySqlConnector.MySqlCommand;
6-
using MySQLParameter = MySqlConnector.MySqlParameter;
714
using MySQLConnection = MySqlConnector.MySqlConnection;
8-
using MySQLException = MySqlConnector.MySqlException;
9-
using MySQLDbType = MySqlConnector.MySqlDbType;
1015
using MySQLDataAdapter = MySqlConnector.MySqlDataAdapter;
11-
using System.IO;
12-
using GxClasses.Helpers;
13-
using System.Reflection;
14-
using System;
15-
using System.Data;
16-
using System.Data.Common;
17-
using System.Text;
18-
using System.Collections.Generic;
19-
using System.Security;
16+
using MySQLDbType = MySqlConnector.MySqlDbType;
17+
using MySQLException = MySqlConnector.MySqlException;
18+
using MySQLParameter = MySqlConnector.MySqlParameter;
2019

2120
namespace GeneXus.Data
2221
{
23-
22+
2423
public class GxMySqlConnector : GxDataRecord
2524
{
2625
static readonly ILog log = log4net.LogManager.GetLogger(typeof(GeneXus.Data.GxMySqlConnector));
@@ -49,27 +48,9 @@ public override GxAbstractConnectionWrapper GetConnection(bool showPrompt, strin
4948
return new MySqlConnectorConnectionWrapper(m_connectionString, connectionCache, isolationLevel);
5049
}
5150

52-
string convertToMySqlCall(string stmt, GxParameterCollection parameters)
53-
{
54-
if (parameters == null)
55-
return "";
56-
string pname;
57-
StringBuilder sBld = new StringBuilder();
58-
for (int i = 0; i < parameters.Count; i++)
59-
{
60-
if (i > 0)
61-
sBld.Append(", ");
62-
pname = "@" + parameters[i].ParameterName;
63-
sBld.Append(pname);
64-
parameters[i].ParameterName = pname;
65-
}
66-
return "CALL " + stmt + "(" + sBld.ToString() + ")";
67-
}
6851
[SecuritySafeCritical]
6952
public override IDbCommand GetCommand(IGxConnection con, string stmt, GxParameterCollection parameters, bool isCursor, bool forFirst, bool isRpc)
7053
{
71-
if (isRpc)
72-
stmt = convertToMySqlCall(stmt, parameters);
7354
MySQLCommand mysqlcmd = (MySQLCommand)base.GetCommand(con, stmt, parameters.Distinct());
7455
if (isCursor && !isRpc)
7556
{

dotnet/src/dotnetframework/GxClasses/Domain/GxCollections.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ public int Add(IDataParameter value)
6060
{
6161
return parameters.Add(value);
6262
}
63-
63+
internal void Reverse()
64+
{
65+
parameters.Reverse();
66+
}
6467
public void Clear()
6568
{
6669
parameters.Clear();
@@ -158,6 +161,7 @@ public GxParameterCollection Distinct()
158161
parms.Add(this[j].ParameterName);
159162
}
160163
}
164+
uniqueParms.Reverse();
161165
return uniqueParms;
162166
}
163167
else

0 commit comments

Comments
 (0)