Exemplo n.º 1
0
        public int ExecuteQuery(QueryCommand qry)
        {
            //var sql = qry.CommandSql;
            //if (sql.IndexOf("ONLINEUSERS", System.StringComparison.Ordinal) > -1 &&
            //    (sql.IndexOf("SELECT", System.StringComparison.Ordinal) > -1 || sql.IndexOf("DELETE ", System.StringComparison.Ordinal) > -1))
            //{
            //    var str = sql;
            //}


            WriteToLog(() => string.Format("ExecuteQuery(QueryCommand): {0}.", qry.CommandSql));

            int result;

            using (AutomaticConnectionScope automaticConnectionScope = new AutomaticConnectionScope(this))
            {
                DbCommand cmd = automaticConnectionScope.Connection.CreateCommand();
                cmd.CommandText = qry.CommandSql;
                cmd.CommandType = qry.CommandType;
                AddParams(cmd, qry);
                result = cmd.ExecuteNonQuery();
                // Issue 11 fix introduced by [email protected]
                qry.GetOutputParameters(cmd);
            }

            return(result);
        }
Exemplo n.º 2
0
        public int ExecuteQuery(QueryCommand qry)
        {
            WriteToLog(() => string.Format("ExecuteQuery(QueryCommand): {0}.", qry.CommandSql));

            int result;

            using (AutomaticConnectionScope automaticConnectionScope = new AutomaticConnectionScope(this))
            {
                DbCommand cmd = automaticConnectionScope.Connection.CreateCommand();
                cmd.CommandText = qry.CommandSql;
                cmd.CommandType = qry.CommandType;
                AddParams(cmd, qry);
                result = cmd.ExecuteNonQuery();
                // Issue 11 fix introduced by [email protected]
                qry.GetOutputParameters(cmd);
            }

            return(result);
        }
Exemplo n.º 3
0
        public int ExecuteQuery(QueryCommand qry)
        {
            if (Log != null)
            {
                Log.WriteLine(qry.CommandSql);
            }

#if DEBUG
            //Console.Error.WriteLine("ExecuteQuery(QueryCommand): {0}.", qry.CommandSql);
#endif
            int result;
            using (AutomaticConnectionScope automaticConnectionScope = new AutomaticConnectionScope(this))
            {
                DbCommand cmd = automaticConnectionScope.Connection.CreateCommand();
                cmd.CommandText = qry.CommandSql;
                cmd.CommandType = qry.CommandType;
                AddParams(cmd, qry);
                result = cmd.ExecuteNonQuery();
                // Issue 11 fix introduced by [email protected]
                qry.GetOutputParameters(cmd);
            }

            return(result);
        }