Examples of insertOr()


Examples of org.tmatesoft.sqljet.core.table.ISqlJetTable.insertOr()

    public void testInsertOrUpdate1() throws SqlJetException {
        final ISqlJetTableDef createTable = db.createTable("CREATE TABLE IF NOT EXISTS files ("
                + " name TEXT NOT NULL PRIMARY KEY, time INTEGER)");
        final ISqlJetTable table = db.getTable(createTable.getName());
        for (long actual = 1; actual < 10; actual++) {
            table.insertOr(SqlJetConflictAction.REPLACE, "test", new Long(actual));
            assertInsertedOrReplaced(table, actual, "test");
        }
        assertCount(table, 1);
    }
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.ISqlJetTable.insertOr()

    public void testInsertOrUpdate2() throws SqlJetException {
        final ISqlJetTableDef createTable = db.createTable("CREATE TABLE IF NOT EXISTS files ("
                + " id INTEGER NOT NULL PRIMARY KEY, time INTEGER)");
        final ISqlJetTable table = db.getTable(createTable.getName());
        for (long actual = 1; actual < 10; actual++) {
            table.insertOr(SqlJetConflictAction.REPLACE, 1, new Long(actual));
            assertInsertedOrReplaced(table, actual, 1);
        }
        assertCount(table, 1);
    }
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.ISqlJetTable.insertOr()

    public void testTransaction() throws Exception {
        ISqlJetTable table = db.getTable("places");
        db.beginTransaction(SqlJetTransactionMode.WRITE);

        for (int i = 0; i < 2000; ++i) {
            table.insertOr(SqlJetConflictAction.REPLACE, null, i, i % 2, i % 3, 4, "hhhh", 6, 7);
        }
        db.rollback();
        db.beginTransaction(SqlJetTransactionMode.WRITE);

        for (int i = 0; i < 2000; ++i) {
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.ISqlJetTable.insertOr()

        }
        db.rollback();
        db.beginTransaction(SqlJetTransactionMode.WRITE);

        for (int i = 0; i < 2000; ++i) {
            table.insertOr(SqlJetConflictAction.REPLACE, null, i, i % 2, i % 3, 4, "kkk", 6, 7);
        }
        db.commit();
    }

}
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.ISqlJetTable.insertOr()

    public void testUniqueIndex() throws Exception {

        db.runTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb arg0) throws SqlJetException {
                ISqlJetTable table = db.getTable("names");
                table.insertOr(SqlJetConflictAction.REPLACE, null, "same name");
                table.insertOr(SqlJetConflictAction.REPLACE, null, "same name");

                return null;
            }
        }, SqlJetTransactionMode.WRITE); // I would expect transaction fails or
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.ISqlJetTable.insertOr()

        db.runTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb arg0) throws SqlJetException {
                ISqlJetTable table = db.getTable("names");
                table.insertOr(SqlJetConflictAction.REPLACE, null, "same name");
                table.insertOr(SqlJetConflictAction.REPLACE, null, "same name");

                return null;
            }
        }, SqlJetTransactionMode.WRITE); // I would expect transaction fails or
                                         // one record in table. But in table
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.ISqlJetTable.insertOr()

      ISqlJetTable table = db.getTable("child_beans_many");
      db.beginTransaction(SqlJetTransactionMode.WRITE);

      try {
        for (int i = 0; i < 5; i++) {
          table.insertOr(SqlJetConflictAction.REPLACE, null, "test note", 1);
        }
      } finally {
        db.commit();
      }
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.ISqlJetTable.insertOr()

      } finally {
        db.commit();
      }

      /// and after that disappears row with pk 1
      table.insertOr(SqlJetConflictAction.REPLACE, 2, "test note", 1);

      db.beginTransaction(SqlJetTransactionMode.READ_ONLY);
      try {
        ISqlJetCursor cursor = table.lookup(table.getPrimaryKeyIndexName(), 1);
        assertFalse(cursor.eof());
View Full Code Here

Examples of org.tmatesoft.sqljet.core.table.ISqlJetTable.insertOr()

    @Test
    public void testIsNull() throws Exception {
        db.runTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
              ISqlJetTable table = db.getTable("beans");
              table.insertOr(SqlJetConflictAction.REPLACE, null, "SOME MESSAGE");
              return true;
            }
          }, SqlJetTransactionMode.WRITE);

         db.runTransaction(new ISqlJetTransaction() {
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.