Examples of toSQL()


Examples of org.apache.metamodel.query.Query.toSql()

        FromItem fromItem1 = q.from(table, "t1").getFromClause().getItem(0);
        FromItem fromItem2 = q.from(table, "t2").getFromClause().getItem(1);
        q.select(table.getColumnByName("foo"), fromItem1);
        q.select(table.getColumnByName("foo"), fromItem2);
        q.where(q.getSelectClause().getItem(0), OperatorType.EQUALS_TO, "2");
        assertEquals("SELECT t1.foo, t2.foo FROM sch.tab t1, sch.tab t2 WHERE t1.foo = '2'", q.toSql());

        DataSet ds = dc.executeQuery(q);
        SelectItem[] selectItems = ds.getSelectItems();
        assertEquals(2, selectItems.length);
        assertEquals("t1.foo", selectItems[0].toSql());
View Full Code Here

Examples of org.apache.metamodel.query.Query.toSql()

    public void testQueryInLowerCase() throws Exception {
        Query q = MetaModelHelper.parseQuery(dc,
                "select a.foo as f from sch.tbl a inner join sch.tbl b on a.foo=b.foo order by a.foo asc");
        assertEquals("SELECT a.foo AS f FROM sch.tbl a INNER JOIN sch.tbl b ON a.foo = b.foo ORDER BY a.foo ASC",
                q.toSql());
    }

    public void testSelectEverythingFromTable() throws Exception {
        Query q = MetaModelHelper.parseQuery(dc, "SELECT * FROM sch.tbl");
        assertEquals("SELECT tbl.foo, tbl.bar, tbl.baz FROM sch.tbl", q.toSql());
View Full Code Here

Examples of org.apache.metamodel.query.Query.toSql()

                q.toSql());
    }

    public void testSelectEverythingFromTable() throws Exception {
        Query q = MetaModelHelper.parseQuery(dc, "SELECT * FROM sch.tbl");
        assertEquals("SELECT tbl.foo, tbl.bar, tbl.baz FROM sch.tbl", q.toSql());
    }

    public void testSelectEverythingFromJoin() throws Exception {
        Query q = MetaModelHelper.parseQuery(dc, "SELECT * FROM sch.tbl a INNER JOIN sch.tbl b ON a.foo = b.foo");
        assertEquals(
View Full Code Here

Examples of org.apache.metamodel.query.Query.toSql()

    public void testSelectEverythingFromJoin() throws Exception {
        Query q = MetaModelHelper.parseQuery(dc, "SELECT * FROM sch.tbl a INNER JOIN sch.tbl b ON a.foo = b.foo");
        assertEquals(
                "SELECT a.foo, a.bar, a.baz, b.foo, b.bar, b.baz FROM sch.tbl a INNER JOIN sch.tbl b ON a.foo = b.foo",
                q.toSql());

        q = MetaModelHelper.parseQuery(dc, "SELECT a.foo, b.* FROM sch.tbl a INNER JOIN sch.tbl b ON a.foo = b.foo");
        assertEquals("SELECT a.foo, b.foo, b.bar, b.baz FROM sch.tbl a INNER JOIN sch.tbl b ON a.foo = b.foo",
                q.toSql());
    }
View Full Code Here

Examples of org.apache.metamodel.query.Query.toSql()

                "SELECT a.foo, a.bar, a.baz, b.foo, b.bar, b.baz FROM sch.tbl a INNER JOIN sch.tbl b ON a.foo = b.foo",
                q.toSql());

        q = MetaModelHelper.parseQuery(dc, "SELECT a.foo, b.* FROM sch.tbl a INNER JOIN sch.tbl b ON a.foo = b.foo");
        assertEquals("SELECT a.foo, b.foo, b.bar, b.baz FROM sch.tbl a INNER JOIN sch.tbl b ON a.foo = b.foo",
                q.toSql());
    }

    public void testSelectColumnWithDotInName() throws Exception {
        MutableColumn col = (MutableColumn) dc.getTableByQualifiedLabel("tbl").getColumn(0);
        col.setName("fo.o");
View Full Code Here

Examples of org.apache.metamodel.query.Query.toSql()

    public void testSelectColumnWithDotInName() throws Exception {
        MutableColumn col = (MutableColumn) dc.getTableByQualifiedLabel("tbl").getColumn(0);
        col.setName("fo.o");

        Query q = MetaModelHelper.parseQuery(dc, "SELECT fo.o AS f FROM sch.tbl");
        assertEquals("SELECT tbl.fo.o AS f FROM sch.tbl", q.toSql());
    }

    public void testSelectAlias() throws Exception {
        Query q = MetaModelHelper.parseQuery(dc, "SELECT foo AS f FROM sch.tbl");
        assertEquals("SELECT tbl.foo AS f FROM sch.tbl", q.toSql());
View Full Code Here

Examples of org.jooq.Comparator.toSQL()

        xx xxxxxxxxxx xxxx
        xx xxxxxxx xx xxx xx xxx xxxxxxxxxx xxxxxxx
            xxxxxxx x xxxxx
        xx [/pro] */

                     ctx.keyword(op.toSQL()).sql(" ");
        if (castRhs) ctx.keyword("cast").sql("(");
                     ctx.visit(rhs);
        if (castRhs) ctx.sql(" ").keyword("as").sql(" ").keyword("varchar").sql("(4000))");

        if (escape != null) {
View Full Code Here

Examples of org.jooq.JoinType.toSQL()

    @Override
    public final void accept(Context<?> ctx) {
        JoinType translatedType = translateType(ctx);
        Clause translatedClause = translateClause(translatedType);

        String keyword = translatedType.toSQL();

        /* [pro] xx
        xx xx xx xxxxxxx xxx xxxxx xxxxxxx xx xxx xxxxxxxx
        xx xxxxxxxxxxxxxxx xx xxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxxx x
            xxxxxxx x xxxxxx xxxxxx
View Full Code Here

Examples of org.jooq.QueryPartInternal.toSQL()

            // able to declare anything, then disable declaration temporarily

            // We're declaring fields, but "part" does not declare fields
            if (declareFields() && !internal.declaresFields()) {
                declareFields(false);
                internal.toSQL(this);
                declareFields(true);
            }

            // We're declaring tables, but "part" does not declare tables
            else if (declareTables() && !internal.declaresTables()) {
View Full Code Here

Examples of org.jugile.util.Query.toSql()

 
  public List<E> fromDb() { return fromDb(null); }
  public List<E> fromDb(String sql) {
    Query q2 = q();
    Bo bo = getProto();
    if (sql == null) sql = "where " + q2.toSql();
    sql = "select " + bo._getSelectFlds() +" from " + bo.table() + " " + sql;

    List<E> res = new ArrayList<E>();
    DBPool db = DBPool.getPool();
    DBConnection c = db.getConnection();
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.