Package com.mysema.query.sql.dml

Examples of com.mysema.query.sql.dml.SQLInsertClause


    @Test
    @IncludeIn(MYSQL)
    @SkipForQuoted
    public void Insert_with_Special_Options() {
        SQLInsertClause clause = insert(survey)
            .columns(survey.id, survey.name)
            .values(3, "Hello");

        clause.addFlag(Position.START_OVERRIDE, "insert ignore into ");

        assertEquals("insert ignore into SURVEY (ID, NAME) values (?, ?)", clause.toString());
        clause.execute();
    }
View Full Code Here


    @Test
    @ExcludeIn(FIREBIRD) // too slow
    public void Insert_With_SubQuery_Via_Constructor() {
        int count = (int)query().from(survey).count();
        SQLInsertClause insert = insert(survey, sq().from(survey2));
        insert.set(survey.id, survey2.id.add(20));
        insert.set(survey.name, survey2.name);
        assertEquals(count, insert.execute());
    }
View Full Code Here

    }

    @Test
    @ExcludeIn(FIREBIRD) // too slow
    public void InsertBatch_with_Subquery() {
        SQLInsertClause insert = insert(survey)
            .columns(survey.id, survey.name)
            .select(sq().from(survey2).list(survey2.id.add(20), survey2.name))
            .addBatch();

        insert(survey)
            .columns(survey.id, survey.name)
            .select(sq().from(survey2).list(survey2.id.add(40), survey2.name))
            .addBatch();

        insert.execute();
//        assertEquals(1, insert.execute());
    }
View Full Code Here

        assertEquals(1l, query().from(survey).where(survey.name2.contains("a\\b")).count());
    }

    @Test
    public void Like_with_Escape() {
        SQLInsertClause insert = insert(survey);
        insert.set(survey.id, 5).set(survey.name, "aaa").addBatch();
        insert.set(survey.id, 6).set(survey.name, "a_").addBatch();
        insert.set(survey.id, 7).set(survey.name, "a%").addBatch();
        assertEquals(3, insert.execute());

        assertEquals(1l, query().from(survey).where(survey.name.like("a|%", '|')).count());
        assertEquals(1l, query().from(survey).where(survey.name.like("a|_", '|')).count());
        assertEquals(3l, query().from(survey).where(survey.name.like("a%")).count());
        assertEquals(2l, query().from(survey).where(survey.name.like("a_")).count());
View Full Code Here

    @Test
    @IncludeIn(MYSQL)
    @SkipForQuoted
    public void Replace() {
        SQLInsertClause clause = mysqlReplace(survey);
        clause.columns(survey.id, survey.name)
            .values(3, "Hello");

        assertEquals("replace into SURVEY (ID, NAME) values (?, ?)", clause.toString());
        clause.execute();
    }
View Full Code Here

public class LikeEscapeBase extends AbstractBaseTest{

    @Before
    public void setUp() throws SQLException{
        delete(survey).execute();
        SQLInsertClause insert = insert(survey);
        insert.set(survey.id, 5).set(survey.name, "aaa").addBatch();
        insert.set(survey.id, 6).set(survey.name, "a_").addBatch();   
        insert.set(survey.id, 7).set(survey.name, "a%").addBatch();
        insert.execute();
    }
View Full Code Here

TOP

Related Classes of com.mysema.query.sql.dml.SQLInsertClause

Copyright © 2018 www.massapicom. 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.