Package com.vaadin.data.util.sqlcontainer.query

Examples of com.vaadin.data.util.sqlcontainer.query.TableQuery$RowIdChangeEvent


     * @return true if the identifier is valid
     */
    private boolean isColumnIdentifierValid(String identifier) {
        if (identifier.equalsIgnoreCase("rownum")
                && queryDelegate instanceof TableQuery) {
            TableQuery tq = (TableQuery) queryDelegate;
            if (tq.getSqlGenerator() instanceof MSSQLGenerator
                    || tq.getSqlGenerator() instanceof OracleGenerator) {
                return false;
            }
        }
        return true;
    }
View Full Code Here


            SimpleJDBCConnectionPool connectionPool = new SimpleJDBCConnectionPool(
                    "org.hsqldb.jdbc.JDBCDriver",
                    "jdbc:hsqldb:mem:sqlcontainer", "SA", "", 2, 20);
            generateTestData(connectionPool);

            TableQuery query = new TableQuery("people", connectionPool,
                    new DefaultSQLGenerator());

            SQLContainer container = new LimitedSQLContainer(query);

            final VerticalLayout rootLayout = new VerticalLayout();
View Full Code Here

        }
    }

    private void initContainers() {
        try {
            TableQuery q1 = new TableQuery(TABLENAME, connectionPool);
            q1.setVersionColumn("id");
            testContainer = new SQLContainer(q1);

            TableQuery q2 = new TableQuery(LARGE_TABLENAME, connectionPool);
            q2.setVersionColumn("id");
            largeContainer = new SQLContainer(q2);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

                    "jdbc:hsqldb:mem:sqlcontainer", "SA", "", 2, 20);

            createTestTable(connectionPool);
            insertTestData(connectionPool);

            TableQuery q = new TableQuery("MYTABLE2", connectionPool);
            q.setVersionColumn("VERSION");
            SQLContainer myContainer = new SQLContainer(q);
            // Uncommenting these works around the issue
            // myContainer.addOrderBy(new OrderBy("PFX", true));
            // myContainer.addOrderBy(new OrderBy("NUMERO", true));
            myContainer.removeAllContainerFilters();
View Full Code Here

            JDBCConnectionPool pool = getConnectionPool();
            if (pool != null) {
                try {
                    int cents = 100;
                    for (int cent = 0; cent < cents; cent++) {
                        TableQuery q = new TableQuery("AUTHOR", pool);
                        q.setVersionColumn("ID");
                        SQLContainer c = new SQLContainer(q);
                        for (int i = 0; i < 100; i++) {
                            Object id = c.addItem();
                            c.getContainerProperty(id, "FIRST_NAMES").setValue(
                                    getRandonName());
View Full Code Here

        if (SQLTestsConstants.sqlGen instanceof MSSQLGenerator
                || SQLTestsConstants.sqlGen instanceof OracleGenerator) {
            return;
        }
        SQLGenerator sg = SQLTestsConstants.sqlGen;
        TableQuery query = new TableQuery("people", connectionPool,
                SQLTestsConstants.sqlGen);
        SQLContainer container = new SQLContainer(query);

        StatementHelper sh = sg.generateDeleteQuery(
                "people",
                query.getPrimaryKeyColumns(),
                null,
                (RowItem) container.getItem(container.getItemIds().iterator()
                        .next()));
        Assert.assertEquals("DELETE FROM people WHERE \"ID\" = ?",
                sh.getQueryString());
View Full Code Here

        if (SQLTestsConstants.sqlGen instanceof MSSQLGenerator
                || SQLTestsConstants.sqlGen instanceof OracleGenerator) {
            return;
        }
        SQLGenerator sg = new DefaultSQLGenerator();
        TableQuery query = new TableQuery("people", connectionPool);
        SQLContainer container = new SQLContainer(query);

        RowItem ri = (RowItem) container.getItem(container.getItemIds()
                .iterator().next());
        ri.getItemProperty("NAME").setValue("Viljami");
View Full Code Here

        if (SQLTestsConstants.sqlGen instanceof MSSQLGenerator
                || SQLTestsConstants.sqlGen instanceof OracleGenerator) {
            return;
        }
        SQLGenerator sg = new DefaultSQLGenerator();
        TableQuery query = new TableQuery("people", connectionPool);
        SQLContainer container = new SQLContainer(query);

        RowItem ri = (RowItem) container.getItem(container.addItem());
        ri.getItemProperty("NAME").setValue("Viljami");
View Full Code Here

                    "jdbc:hsqldb:mem:sqlcontainer", "SA", "", 2, 20);

            createTestTable(connectionPool);
            insertTestData(connectionPool);

            TableQuery q = new TableQuery("mytable", connectionPool);
            q.setVersionColumn("version");
            SQLContainer myContainer = new SQLContainer(q);

            table.setContainerDataSource(myContainer);

        } catch (SQLException e) {
View Full Code Here

    @Test
    public void getIdByIndex_table5000rowsIndex1337_returnsRowId1337()
            throws SQLException {
        DataGenerator.addFiveThousandPeople(connectionPool);
        SQLContainer container = new SQLContainer(new TableQuery("people",
                connectionPool, SQLTestsConstants.sqlGen));
        Object itemId = container.getIdByIndex(1337);
        if (SQLTestsConstants.db == DB.ORACLE) {
            Assert.assertEquals(
                    new RowId(new Object[] { 1337 + offset }).toString(),
View Full Code Here

TOP

Related Classes of com.vaadin.data.util.sqlcontainer.query.TableQuery$RowIdChangeEvent

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.