コード例 #1
0
ファイル: DbAccessCommand.cs プロジェクト: yuzs/CodePorter
        public DataTable ExecuteTableSchema(DataTable dataTable, SchemaType schemaType)
        {
            DataTable      param001;
            ExecuteContext context = new ExecuteContext(this);

            try
            {
                if (IsTraced)
                {
                    Tracer.Instance.EnterFunction(TraceClass, "ExecuteTableSchema", new string[] { "dataTable", "schemaType", "CommandText", "Parameters" }, new object[] { "Null:" + (dataTable == null), schemaType, this.CommandText, this.GetTraceParameters(true) });
                }
                if (dataTable == null)
                {
                    dataTable = new DataTable();
                }
                DataTable result = this.DbAdapter.FillSchema(dataTable, schemaType);
                if (IsTraced)
                {
                    Tracer.Instance.LeaveFunction(TraceClass, "ExecuteTableSchema", new string[] { "result", "Parameters" }, new object[] { "result is DataTable", this.GetTraceParameters(false) });
                }
                context.SuccessfullyCall();
                param001 = result;
            }
            finally
            {
                context.FinallyCall();
            }
            return(param001);
        }
コード例 #2
0
ファイル: DbAccessCommand.cs プロジェクト: yuzs/CodePorter
        public DataTable ExecuteSchemaTable()
        {
            DataTable      param001;
            ExecuteContext context = new ExecuteContext(this);

            try
            {
                if (IsTraced)
                {
                    Tracer.Instance.EnterFunction(TraceClass, "ExecuteSchemaTable", new string[] { "CommandText", "Parameters" }, new object[] { this.CommandText, this.GetTraceParameters(true) });
                }
                DataTable result = null;
                using (DbDataReader reader = this.DbCommand.ExecuteReader(CommandBehavior.KeyInfo))
                {
                    result = reader.GetSchemaTable();
                    reader.Close();
                }
                if (IsTraced)
                {
                    Tracer.Instance.LeaveFunction(TraceClass, "ExecuteSchemaTable", new string[] { "result", "Parameters" }, new object[] { "Null:" + (result == null), this.GetTraceParameters(false) });
                }
                context.SuccessfullyCall();
                param001 = result;
            }
            finally
            {
                context.FinallyCall();
            }
            return(param001);
        }
コード例 #3
0
ファイル: DbAccessCommand.cs プロジェクト: yuzs/CodePorter
        public DataTable[] ExecuteSetSchema(DataSet dataSet, SchemaType schemaType, string srcTable)
        {
            DataTable[]    param001;
            ExecuteContext context = new ExecuteContext(this);

            try
            {
                if (IsTraced)
                {
                    Tracer.Instance.EnterFunction(TraceClass, "ExecuteSetSchema", new string[] { "dataSet", "schemaType", "srcTable", "CommandText", "Parameters" }, new object[] { "Null:" + (dataSet == null), schemaType, srcTable, this.CommandText, this.GetTraceParameters(true) });
                }
                if (dataSet == null)
                {
                    dataSet = new DataSet();
                }
                if (string.IsNullOrEmpty(srcTable))
                {
                    srcTable = "Table";
                }
                DataTable[] tables = this.DbAdapter.FillSchema(dataSet, schemaType, srcTable);
                if (IsTraced)
                {
                    Tracer.Instance.LeaveFunction(TraceClass, "ExecuteSetSchema", new string[] { "result", "Parameters" }, new object[] { "Null:" + (tables == null), this.GetTraceParameters(false) });
                }
                context.SuccessfullyCall();
                param001 = tables;
            }
            finally
            {
                context.FinallyCall();
            }
            return(param001);
        }
コード例 #4
0
ファイル: DbAccessCommand.cs プロジェクト: yuzs/CodePorter
        public DbDataReader ExecuteReader(int startRecord)
        {
            DbDataReader   param001;
            ExecuteContext context = new ExecuteContext(this);

            try
            {
                if (IsTraced)
                {
                    Tracer.Instance.EnterFunction(TraceClass, "ExecuteReader", new string[] { "startRecord", "CommandText", "Parameters" }, new object[] { startRecord, this.CommandText, this.GetTraceParameters(true) });
                }
                DbDataReader dataReader = this.DbCommand.ExecuteReader();
                int          tempIndex  = -1;
                while ((++tempIndex < startRecord) && dataReader.Read())
                {
                }
                if (IsTraced)
                {
                    Tracer.Instance.LeaveFunction(TraceClass, "ExecuteReader", new string[] { "result", "Parameters" }, new object[] { "result is DbDataReader", this.GetTraceParameters(false) });
                }
                context.SuccessfullyCall();
                param001 = dataReader;
            }
            finally
            {
                context.FinallyCall();
            }
            return(param001);
        }
コード例 #5
0
ファイル: DbAccessCommand.cs プロジェクト: yuzs/CodePorter
        public override object ExecuteScalar()
        {
            object         param001;
            ExecuteContext context = new ExecuteContext(this);

            try
            {
                if (IsTraced)
                {
                    Tracer.Instance.EnterFunction(TraceClass, "ExecuteScalar", new string[] { "CommandText", "Parameters" }, new object[] { this.CommandText, this.GetTraceParameters(true) });
                }
                object result = this.DbCommand.ExecuteScalar();
                if (IsTraced)
                {
                    Tracer.Instance.LeaveFunction(TraceClass, "ExecuteScalar", new string[] { "result", "Parameters" }, new object[] { result, this.GetTraceParameters(false) });
                }
                context.SuccessfullyCall();
                param001 = result;
            }
            finally
            {
                context.FinallyCall();
            }
            return(param001);
        }
コード例 #6
0
ファイル: DbAccessCommand.cs プロジェクト: yuzs/CodePorter
        protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
        {
            DbDataReader   param001;
            ExecuteContext context = new ExecuteContext(this);

            try
            {
                if (IsTraced)
                {
                    Tracer.Instance.EnterFunction(TraceClass, "ExecuteDbDataReader", new string[] { "behavior", "CommandText", "Parameters" }, new object[] { behavior, this.CommandText, this.GetTraceParameters(true) });
                }
                DbDataReader result = this.DbCommand.ExecuteReader(behavior);
                if (IsTraced)
                {
                    Tracer.Instance.LeaveFunction(TraceClass, "ExecuteDbDataReader", new string[] { "result", "Parameters" }, new object[] { "result is DbDataReader", this.GetTraceParameters(false) });
                }
                context.SuccessfullyCall();
                param001 = result;
            }
            finally
            {
                context.FinallyCall();
            }
            return(param001);
        }
コード例 #7
0
ファイル: DbAccessCommand.cs プロジェクト: yuzs/CodePorter
        public int ExecuteDataTable(DataTable dataTable, int startRecord, int maxRecords)
        {
            int            param001;
            ExecuteContext context = new ExecuteContext(this);

            try
            {
                if (IsTraced)
                {
                    Tracer.Instance.EnterFunction(TraceClass, "ExecuteDataTable", new string[] { "dataTable", "startRecord", "maxRecords", "CommandText", "Parameters" }, new object[] { "Null:" + (dataTable == null), startRecord, maxRecords, this.CommandText, this.GetTraceParameters(true) });
                }
                if (dataTable == null)
                {
                    dataTable = new DataTable();
                }
                int result = this.DbAdapter.Fill(startRecord, maxRecords, new DataTable[] { dataTable });
                if (IsTraced)
                {
                    Tracer.Instance.LeaveFunction(TraceClass, "ExecuteDataTable", new string[] { "result", "Parameters" }, new object[] { result, this.GetTraceParameters(false) });
                }
                context.SuccessfullyCall();
                param001 = result;
            }
            finally
            {
                context.FinallyCall();
            }
            return(param001);
        }
コード例 #8
0
ファイル: DbAccessCommand.cs プロジェクト: yuzs/CodePorter
        public int ExecuteDataSet(DataSet dataSet)
        {
            int            param001;
            ExecuteContext context = new ExecuteContext(this);

            try
            {
                if (IsTraced)
                {
                    Tracer.Instance.EnterFunction(TraceClass, "ExecuteDataSet", new string[] { "dataSet", "CommandText", "Parameters" }, new object[] { "Null:" + (dataSet == null), this.CommandText, this.GetTraceParameters(true) });
                }
                if (dataSet == null)
                {
                    dataSet = new DataSet();
                }
                int result = this.DbAdapter.Fill(dataSet);
                if (IsTraced)
                {
                    Tracer.Instance.LeaveFunction(TraceClass, "ExecuteDataSet", new string[] { "result", "Parameters" }, new object[] { result, this.GetTraceParameters(false) });
                }
                context.SuccessfullyCall();
                param001 = result;
            }
            finally
            {
                context.FinallyCall();
            }
            return(param001);
        }
コード例 #9
0
ファイル: DbAccessCommand.cs プロジェクト: yuzs/CodePorter
        public virtual int UpdateDataTable(DataTable dataTable)
        {
            int param001;

            if (dataTable == null)
            {
                return(-1);
            }
            ExecuteContext context = new ExecuteContext(this);

            try
            {
                if (IsTraced)
                {
                    Tracer.Instance.EnterFunction(TraceClass, "UpdateDataTable", new string[] { "CommandText", "Parameters" }, new object[] { this.CommandText, this.GetTraceParameters(true) });
                }
                this.DbBuilder.SetAllValues = false;
                int result = this.DbAdapter.Update(dataTable);
                if (IsTraced)
                {
                    Tracer.Instance.LeaveFunction(TraceClass, "UpdateDataTable", new string[] { "result", "Parameters" }, new object[] { result, this.GetTraceParameters(false) });
                }
                context.SuccessfullyCall();
                param001 = result;
            }
            finally
            {
                context.FinallyCall();
            }
            return(param001);
        }
コード例 #10
0
ファイル: DbAccessCommand.cs プロジェクト: yuzs/CodePorter
        public DbParameter[] DeriveParameters(string procedureName, bool includeReturnValueParameter)
        {
            ParameterChecker.CheckNullOrEmpty("DbAccessCommand.DeriveParameters", "procedureName", procedureName);
            System.Data.Common.DbCommand cmd = this.DbConnection.CreateCommand();
            cmd.CommandText = procedureName;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            ExecuteContext context = new ExecuteContext(this);

            try
            {
                this.DeriveParameters(cmd);
                context.SuccessfullyCall();
            }
            finally
            {
                context.FinallyCall();
            }
            if (!includeReturnValueParameter)
            {
                DbParameter returnParameter = null;
                foreach (DbParameter parameter in cmd.Parameters)
                {
                    if (parameter.Direction == ParameterDirection.ReturnValue)
                    {
                        returnParameter = parameter;
                        break;
                    }
                }
                if (returnParameter != null)
                {
                    cmd.Parameters.Remove(returnParameter);
                }
            }
            DbParameter[] parameters = new DbParameter[cmd.Parameters.Count];
            cmd.Parameters.CopyTo(parameters, 0);
            return(parameters);
        }