Browse Source

Oracle output cursor bug

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
f524c73ae2
  1. 7
      Src/Asp.Net/OracleTest/Demos/1_Query.cs
  2. 5
      Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs

7
Src/Asp.Net/OracleTest/Demos/1_Query.cs

@ -185,6 +185,13 @@ namespace OrmTest.Demo
private static void Ado()
{
var db = GetInstance();
string spName = "PR_TEST";
var p1 = new SugarParameter("@O_RESULT", null, true);
p1.IsRefCursor = true;
var dt3 = db.Ado.UseStoredProcedure().GetDataTable(spName, p1);
db.Ado.BeginTran();
var t1 = db.Ado.SqlQuery<string>("select 'a' from dual");
var t2 = db.Ado.GetInt("select 1 from dual");

5
Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs

@ -655,7 +655,10 @@ namespace SqlSugar
{
foreach (var outputParameter in parameters.Where(it => it.Direction.IsIn(ParameterDirection.Output, ParameterDirection.InputOutput,ParameterDirection.ReturnValue)))
{
var gobalOutputParamter = this.OutputParameters.Single(it => it.ParameterName == outputParameter.ParameterName);
var gobalOutputParamter = this.OutputParameters.FirstOrDefault(it => it.ParameterName == outputParameter.ParameterName);
if (gobalOutputParamter == null) {//Oracle bug
gobalOutputParamter=this.OutputParameters.FirstOrDefault(it => it.ParameterName == outputParameter.ParameterName.TrimStart(outputParameter.ParameterName.First()));
}
outputParameter.Value = gobalOutputParamter.Value;
this.OutputParameters.Remove(gobalOutputParamter);
}

Loading…
Cancel
Save