示例#1
0
        protected override void OnUpdating(SqlDataSourceCommandEventArgs e)
        {
            e.Command.CommandText = string.IsNullOrWhiteSpace(_owner.UpdateSql) ? this.UpdateCommand : _owner.UpdateSql;
            // Event handlers get the first chance to manipulate command
            base.OnUpdating(e);

            if (e.Cancel || string.IsNullOrWhiteSpace(e.Command.CommandText))
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(_owner.UpdateSql))
            {
                // RaiseCommandParsingEvents is obsolete
//#pragma warning disable 612,618
//                RaiseCommandParsingEvents(e);
//#pragma warning restore 612,618
                throw new HttpException("UpdateSql must be specified");
            }
            else
            {
                XmlToSql.BuildCommand((OracleCommand)e.Command, null, p => false);
            }
            return;
        }
示例#2
0
        private OracleCommand CreateCommand(string xml, Func <string, OracleParameter> paramUpdater, string actionName)
        {
            OracleCommand cmd = _conn.CreateCommand();

            cmd.CommandText = xml;

            XmlToSql.BuildCommand(cmd, paramUpdater, (elem) =>
            {
                if (_proxyTagValue == null)
                {
                    return(false);
                }
                elem.Value = _proxyTagValue;
                return(true);
            });
            if (_conn.State == ConnectionState.Closed)
            {
                _conn.Open();
            }
            cmd.BindByName           = true;
            cmd.InitialLONGFetchSize = 1024;    // Retrieve first 1K chars from a long column
            _conn.ActionName         = actionName;
            QueryLogging.TraceOracleCommand(_traceContext, cmd, actionName);
            return(cmd);
        }
示例#3
0
        protected override void OnSelecting(SqlDataSourceSelectingEventArgs e)
        {
            e.Command.CommandText = string.IsNullOrWhiteSpace(_owner.SelectSql) ? this.SelectCommand : _owner.SelectSql;

            //SetCommandType(e.Command, this.SelectCommandType);

            // Event handlers get the first chance to manipulate command
            base.OnSelecting(e);

            if (e.Cancel)
            {
                Trace.TraceWarning("Datasource {0} is cancelling query in OnSelecting because event handler set e.Cancel = true",
                                   _owner.ID);
                return;
            }

            if (string.IsNullOrWhiteSpace(_owner.SelectSql))
            {
                // RaiseCommandParsingEvents is obsolete
//#pragma warning disable 612,618
//                RaiseCommandParsingEvents(e);
//#pragma warning restore 612,618
                throw new HttpException("SelectSql must be specified");
            }
            else
            {
                //BuildCommandFromXml(e);
                XmlToSql.BuildCommand((OracleCommand)e.Command, null, p => false);
            }

            if (string.IsNullOrWhiteSpace(e.Command.CommandText))
            {
                Trace.TraceWarning("Datasource {0} is cancelling query in OnSelecting because CommandText evaluated to empty",
                                   _owner.ID);
                e.Cancel = true;
            }

            return;
        }