Package fi.evident.dalesbred

Examples of fi.evident.dalesbred.Database.update()


    }

    @Test
    public void customDialect() {
        Database db = TestDatabaseProvider.databaseForProperties("hsqldb-connection.properties", new UppercaseDialect());
        db.update("drop table if exists my_table");
        db.update("create table my_table (text varchar(64))");

        db.update("insert into my_table values (?)", "foo");

        assertEquals("FOO", db.findUnique(String.class, "select text from my_table"));
View Full Code Here


    @Test
    public void customDialect() {
        Database db = TestDatabaseProvider.databaseForProperties("hsqldb-connection.properties", new UppercaseDialect());
        db.update("drop table if exists my_table");
        db.update("create table my_table (text varchar(64))");

        db.update("insert into my_table values (?)", "foo");

        assertEquals("FOO", db.findUnique(String.class, "select text from my_table"));
    }
View Full Code Here

    public void customDialect() {
        Database db = TestDatabaseProvider.databaseForProperties("hsqldb-connection.properties", new UppercaseDialect());
        db.update("drop table if exists my_table");
        db.update("create table my_table (text varchar(64))");

        db.update("insert into my_table values (?)", "foo");

        assertEquals("FOO", db.findUnique(String.class, "select text from my_table"));
    }

    private static final class UppercaseDialect extends DefaultDialect {
View Full Code Here

        Connection connection = dataSource.getConnection();
        try {
            TransactionManager tm = new SingleConnectionTransactionManager(connection, false);
            final Database db = new Database(tm);

            db.update("drop table if exists test_table");
            db.update("create table test_table (text varchar(64))");
            db.update("insert into test_table (text) values ('foo')");

            db.withTransaction(new TransactionCallback<Object>() {
                @Nullable
View Full Code Here

        try {
            TransactionManager tm = new SingleConnectionTransactionManager(connection, false);
            final Database db = new Database(tm);

            db.update("drop table if exists test_table");
            db.update("create table test_table (text varchar(64))");
            db.update("insert into test_table (text) values ('foo')");

            db.withTransaction(new TransactionCallback<Object>() {
                @Nullable
                @Override
View Full Code Here

            TransactionManager tm = new SingleConnectionTransactionManager(connection, false);
            final Database db = new Database(tm);

            db.update("drop table if exists test_table");
            db.update("create table test_table (text varchar(64))");
            db.update("insert into test_table (text) values ('foo')");

            db.withTransaction(new TransactionCallback<Object>() {
                @Nullable
                @Override
                public Object execute(@NotNull TransactionContext tx) {
View Full Code Here

            db.withTransaction(new TransactionCallback<Object>() {
                @Nullable
                @Override
                public Object execute(@NotNull TransactionContext tx) {
                    db.update("update test_table set text='bar'");
                    tx.setRollbackOnly();
                    return null;
                }
            });
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.