public override string Parameterlist(ddl db, List <DbParameter> parameters) { if (parameters == null || parameters.Count <= 0) { return(""); } /* compose the procedure's parameter interface for mssql */ syntaxfactory syn = new syntaxfactory(db.Provider); typedesignator typ = syn.GenerateTypedesignator; List <string> list = new List <string>(); foreach (DbParameter parm in parameters) { /* name */ string spar = parm.ParameterName.ToLower(); if (!spar.StartsWith("@")) { spar = "@" + spar; } /* data type */ spar += " " + typ.Complete(parm.DbType, parm.Size, true); /* next */ list.Add(spar); } /* deliver as enter-separated list */ return(String.Join("," + Environment.NewLine, list.ToArray())); }
public override string Parameterlist(ddl db, List <DbParameter> parameters) { const string cursor_outparam = "prc OUT sys_refcursor"; if (parameters == null || parameters.Count <= 0) { return(_is_returning_rowset ? String.Format("({0})", cursor_outparam) : String.Empty); } /* compose the procedure's parameter interface for mssql */ var syn = new syntaxfactory(db.Provider); var typ = syn.GenerateTypedesignator; var list = new List <string>(); var mentioned = new List <string>(); foreach (DbParameter parm in parameters) { /* name */ string spar = parm.ParameterName.ToLower(); if (spar.StartsWith("@") || spar.StartsWith(":")) { spar = "p__" + spar.Substring(1); /* DL20130710DIEJFE9EF */ } /* duplicate prevention */ if (!mentioned.Contains(spar)) { mentioned.Add(spar); /* data type */ spar += " " + typ.Complete(parm.DbType, parm.Size, true); /* next */ list.Add(spar); } } /* [dlatikay 20130710] procs which return rowsets need the rowset as an output parameter */ if (_is_returning_rowset) { list.Add(cursor_outparam); } /* deliver as enter-separated list */ var raw = String.Join(",", list.ToArray()); if (String.IsNullOrWhiteSpace(raw) == false) { return(String.Format("({0})", raw)); } else { return(raw); } }
protected override string GetFieldLiteralNull(DbType?coerce, int coerced_size) { /* [dlatikay 20091203] must coerce a NULL to the correct data type i * MSSQL, otherwise unions of views would fail when one has e.g. * NULL AS Lastname, while another one has [Name] AS Lastname */ if (coerce.HasValue) { typedesignator td = new syntaxfactory((db as ddl).Provider).GenerateTypedesignator; string coerced_type = td.Complete(coerce.Value, coerced_size, false); return(String.Format("convert({0},NULL)", coerced_type)); } else { return("NULL"); } }
protected override string GetFieldLiteralNull(DbType?coerce, int coerced_size) { /* [pkosec>dlatikay 20140911] must coerce a NULL to the correct data type als for oracle * previously we were convinced that this was not neccessary. It isn't, but for LOBs.... * [dlatikay 20150716] found that it is absolutely necessary for VIEWS with UNIONs, for example vwnav02MenuLocation! */ if (coerce.HasValue) { if (coerce.Value == DbType.String) { return("TO_NCLOB(NULL)"); } else { var td = new syntaxfactory((db as ddl).Provider).GenerateTypedesignator; string coerced_type = td.Complete(coerce.Value, coerced_size, false); return(String.Format("CAST(NULL AS {0})", coerced_type)); } } else { return("NULL"); } }