Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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 = new SqlStatement(DatabaseConnection.CurrentConnection);
     exp.SqlExpressionString(st, "", "");
     Assert.AreEqual("(tbl.testfieldname = ?Param0 AND tbl2.testfieldname2 = ?Param1)", st.Statement.ToString());
     Assert.AreEqual("test", st.Parameters[0].Value);
     Assert.AreEqual(new DateTime(2003, 02, 10), st.Parameters[1].Value);
 }
Ejemplo n.º 4
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 = new SqlStatement(DatabaseConnection.CurrentConnection);
     exp.SqlExpressionString(st, "", "");
     Assert.AreEqual("tbl.testfieldname = ?Param0", st.Statement.ToString());
     Assert.AreEqual("test", st.Parameters[0].Value);
 }