Package org.apache.torque.criteria

Examples of org.apache.torque.criteria.Criteria.addSelectColumn()


        }
    }
    public void testLvalueIsObject() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("table.column"));
        criteria.where(1, 2);
        Query query = SqlBuilder.buildQuery(criteria);
        assertEquals("SELECT table.column FROM table WHERE ?=?",
                query.toString());
        assertEquals(2, query.getPreparedStatementReplacements().size());
View Full Code Here


    }

    public void testCurrentDate() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("table.column"));
        criteria.where(new ColumnImpl("column"), Criteria.CURRENT_DATE);
        Query query = SqlBuilder.buildQuery(criteria);
        assertEquals("SELECT table.column FROM table "
                + "WHERE column=CURRENT_DATE",
            query.toString());
View Full Code Here

    }

    public void testCurrentTime() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("table.column"));
        criteria.where(new ColumnImpl("column"), Criteria.CURRENT_TIME);
        Query query = SqlBuilder.buildQuery(criteria);
        assertEquals("SELECT table.column FROM table "
                + "WHERE column=CURRENT_TIME",
            query.toString());
View Full Code Here

    }

    public void testCurrentTimestamp() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("table.column"));
        criteria.where(new ColumnImpl("column"), Criteria.CURRENT_TIMESTAMP);
        Query query = SqlBuilder.buildQuery(criteria);
        assertEquals("SELECT table.column FROM table "
                + "WHERE column=CURRENT_TIMESTAMP",
            query.toString());
View Full Code Here

    }

    public void testObjectKey() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("table.column"));
        criteria.where(new ColumnImpl("column"), new NumberKey(11));
        Query query = SqlBuilder.buildQuery(criteria);
        assertEquals("SELECT table.column FROM table "
                + "WHERE column=?",
            query.toString());
View Full Code Here

    }

    public void testNullValue() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("table.column"));
        criteria.where(new ColumnImpl("column"), null);
        Query query = SqlBuilder.buildQuery(criteria);
        assertEquals("SELECT table.column FROM table "
                + "WHERE column IS NULL",
            query.toString());
View Full Code Here

    }

    public void testNullValueNotEqual() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("table.column"));
        criteria.where(
                new ColumnImpl("column"),
                (Object) null,
                Criteria.NOT_EQUAL);
        Query query = SqlBuilder.buildQuery(criteria);
View Full Code Here

    }

    public void testNullValueAltNotEqual() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("table.column"));
        criteria.where(
                new ColumnImpl("column"),
                (Object) null,
                Criteria.ALT_NOT_EQUAL);
        Query query = SqlBuilder.buildQuery(criteria);
View Full Code Here

    }

    public void testIsNull() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("table.column"));
        criteria.where(
                new ColumnImpl("column"),
                "value ignored",
                Criteria.ISNULL);
        Query query = SqlBuilder.buildQuery(criteria);
View Full Code Here

    }

    public void testIsNotNull() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("table.column"));
        criteria.where(
                new ColumnImpl("column"),
                "value ignored",
                Criteria.ISNOTNULL);
        Query query = SqlBuilder.buildQuery(criteria);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.