예제 #1
0
 private IDbDataParameter GetOutParameter(Out outParameter)
 {
     IDbDataParameter par;
     if (outParameter.IsCursor) {
         par = Provider.GetParameterCursor();
     } else {
         par = Provider.GetParameter();
     }
     //this "if != null" is for the cursor parameter, ignored by sql server
     if (par != null) {
         par.Direction = ParameterDirection.Output;
         par.ParameterName = outParameter.Name;
         par.Size = outParameter.Size;
         par.Value = outParameter.Value;
         par.DbType = outParameter.Type;
     }
     return par;
 }
예제 #2
0
 public virtual object InsertReturningSql(string table, string columnToReturn, string[] columns, object[] values)
 {
     var returningPar = new Out {Name = "returning_" + columnToReturn, Size = 4000};
     string retSql = Dialect.GetInsertReturningColumnSql(table, columns, values, columnToReturn, returningPar.Name);
     object[] pars = Dialect.ConvertToNamedParameters(values);
     List<object> listPars = pars.ToList();
     listPars.Add(returningPar);
     Database.ExecuteSql(retSql, listPars.ToArray());
     return returningPar.Value;
 }