Пример #1
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            SqlChecker SqlChecker = new SqlChecker(this.Request, this.Response);

            //或 SqlChecker SqlChecker = new SqlChecker(this.Request,this.Response,safeUrl);
            SqlChecker.Check();
        }
Пример #2
0
        /// <summary>
        /// SQLite doesn't support things like SKIP and a few other things.
        /// So determine if the query has to be rewritten
        /// </summary>
        /// <remarks>
        /// Microsoft went to all the trouble of making things like SKIP work
        /// on Sql Server 2000 by doing a rewrite of the commandtree.
        /// However, all that fancy stuff is hidden from us.  Thanks to
        /// reflection however, we can go ahead and use the Sql 2000 rewriter code
        /// they made.
        /// </remarks>
        /// <param name="tree">The tree to inspect for a rewrite</param>
        /// <returns>Returns a new query tree if it needs rewriting</returns>
        internal static DbQueryCommandTree Rewrite(DbQueryCommandTree tree)
        {
            SqlChecker visitor = new SqlChecker();

            if (tree.Query.Accept <bool>(visitor))
            {
                tree = sql8rewriter.InvokeMember("Rewrite", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Static, null, null, new object[] { tree }) as DbQueryCommandTree;
            }
            return(tree);
        }