Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
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);
     }
 }
Exemplo n.º 4
0
 public static object[] Execute(string text, params System.Object[] args)
 {
     using (SqlText sel = Create(text, args))
         if (sel.Read())
         {
             object[] result = new object[sel.Reader.FieldCount];
             sel.Reader.GetValues(result);
             return(result);
         }
         else
         {
             return(null);
         }
 }
Exemplo n.º 5
0
        public static SqlText Create(string text, params System.Object[] args)
        {
            SqlText sel            = new SqlText(text);
            Match   m              = Regex.Match(text, String.Format("({0}\\w+)", sel.ParameterMarker));
            int     parameterIndex = 0;

            while (m.Success)
            {
                sel.AddParameter(m.Value, args[parameterIndex]);
                parameterIndex++;
                m = m.NextMatch();
            }
            return(sel);
        }
Exemplo n.º 6
0
 protected virtual SqlStatement CreateSqlStatement(MembershipProviderSqlStatement command)
 {
     SqlText sql = new SqlText(Statements[command], ConnectionStringSettings.Name);
     sql.Command.CommandText = sql.Command.CommandText.Replace("@", sql.ParameterMarker);
     if (sql.Command.CommandText.Contains((sql.ParameterMarker + "ApplicationName")))
         sql.AssignParameter("ApplicationName", ApplicationName);
     sql.Name = ("MyCompany Application Membership Provider - " + command.ToString());
     sql.WriteExceptionsToEventLog = WriteExceptionsToEventLog;
     return sql;
 }
Exemplo n.º 7
0
 public static int ExecuteNonQuery(string text, params System.Object[] args)
 {
     using (SqlText sel = Create(text, args))
         return(sel.ExecuteNonQuery());
 }
Exemplo n.º 8
0
 public static object ExecuteScalar(string text, params System.Object[] args)
 {
     using (SqlText sel = Create(text, args))
         return(sel.ExecuteScalar());
 }
Exemplo n.º 9
0
 public static SqlText Create(string text, params System.Object[] args)
 {
     SqlText sel = new SqlText(text);
     Match m = Regex.Match(text, String.Format("({0}\\w+)", sel.ParameterMarker));
     int parameterIndex = 0;
     while (m.Success)
     {
         sel.AddParameter(m.Value, args[parameterIndex]);
         parameterIndex++;
         m = m.NextMatch();
     }
     return sel;
 }