Browse Source

Oracle Seq BUG

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
4eea7d6c6f
  1. 6
      Src/Asp.Net/SqlSugar/Realization/Oracle/Insertable/OracleInsertable.cs

6
Src/Asp.Net/SqlSugar/Realization/Oracle/Insertable/OracleInsertable.cs

@ -26,8 +26,11 @@ namespace SqlSugar
PreToSql();
string sql = InsertBuilder.ToSqlString();
RestoreMapping();
var isDisableMasterSlaveSeparation = this.Context.Ado.IsDisableMasterSlaveSeparation;
this.Context.Ado.IsDisableMasterSlaveSeparation = true;
var count = Ado.ExecuteCommand(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray());
var result = (this.GetIdentityKeys().IsNullOrEmpty() || count == 0) ? 0 : GetSeqValue(GetSeqName()).ObjToInt();
this.Context.Ado.IsDisableMasterSlaveSeparation = isDisableMasterSlaveSeparation;
return result;
}
@ -37,8 +40,11 @@ namespace SqlSugar
PreToSql();
string sql = InsertBuilder.ToSqlString();
RestoreMapping();
var isDisableMasterSlaveSeparation = this.Context.Ado.IsDisableMasterSlaveSeparation;
this.Context.Ado.IsDisableMasterSlaveSeparation = true;
var count = Ado.ExecuteCommand(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray());
var result = (this.GetIdentityKeys().IsNullOrEmpty() || count == 0) ? 0 :Convert.ToInt64(GetSeqValue(GetSeqName()));
this.Context.Ado.IsDisableMasterSlaveSeparation = isDisableMasterSlaveSeparation;
return result;
}

Loading…
Cancel
Save