public static SqlText Create(string text, string connectionStringName, params System.Object[] args) { var sel = new SqlText(text, connectionStringName); if ((args.Length == 1) && (args[0].GetType().Namespace == null)) { var paramList = BusinessObjectParameters.Create(sel.ParameterMarker, args); foreach (var paramName in paramList.Keys) { sel.AddParameter(paramName, paramList[paramName]); } } else { var m = Regex.Match(text, string.Format("({0}\\w+)", sel.ParameterMarker)); var parameterIndex = 0; while (m.Success) { sel.AddParameter(m.Value, args[parameterIndex]); parameterIndex++; m = m.NextMatch(); } } return(sel); }
public static int NextGeneratorValue(string generator) { try { return(Convert.ToInt32(SqlText.ExecuteScalar(string.Format("SELECT NEXT VALUE FOR {0} FROM RDB$DATABASE", generator)))); } catch (Exception) { return(0); } }
public static int NextSequenceValue(string sequence) { try { return(Convert.ToInt32(SqlText.ExecuteScalar(string.Format("select {0}.nextval from dual", sequence)))); } catch (Exception) { return(0); } }