Beispiel #1
0
        public void TestParameterSqlInfoWithMoreThanOne()
        {
            IParameterSqlInfo paramSql1 =
                new MockParameterSqlInfo("testfieldname", "paramName", ParameterType.String, "tbl");
            IParameterSqlInfo paramSql2 =
                new MockParameterSqlInfo("testfieldname2", "paramName2", ParameterType.Date, "tbl2");
            IExpression exp = Expression.CreateExpression("paramName = 'test' and paramName2 = '10 Feb 2003'");

            exp.SetParameterSqlInfo(paramSql2);
            exp.SetParameterSqlInfo(paramSql1);
            SqlStatement st = CreateSqlStatement();

            exp.SqlExpressionString(st, "", "");
            Assert.AreEqual("(tbl.testfieldname = " + GetParamName(0) + " AND tbl2.testfieldname2 = " + GetParamName(1) + ")", st.Statement.ToString());
            Assert.AreEqual("test", st.Parameters[0].Value);
            Assert.AreEqual(new DateTime(2003, 02, 10), st.Parameters[1].Value);
        }
Beispiel #2
0
        public void TestParameterSqlInfo()
        {
            IParameterSqlInfo paramSql1 =
                new MockParameterSqlInfo("testfieldname", "paramName", Habanero.Base.ParameterType.String, "tbl");
            IExpression exp = Expression.CreateExpression("paramName = 'test'");

            exp.SetParameterSqlInfo(paramSql1);
            SqlStatement st = CreateSqlStatement();

            exp.SqlExpressionString(st, "", "");
            Assert.AreEqual("tbl.testfieldname = " + GetParamName(0) + "", st.Statement.ToString());
            Assert.AreEqual("test", st.Parameters[0].Value);
        }