Package org.tmatesoft.sqljet.core.table

Examples of org.tmatesoft.sqljet.core.table.ISqlJetCursor.eof()


        table.getDataBase().runReadTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                ISqlJetCursor cursor = table.open();// order(table.getPrimaryKeyIndexName());
                try {
                    for (long i = 0; i < fromID && !cursor.eof(); i++) {
                        cursor.next();
                    }
                    int count = 0;
                    while (!cursor.eof() && count < pageSize) {
                        data.add(DataRow.read(cursor, fromID + count, namesArray));
View Full Code Here


                try {
                    for (long i = 0; i < fromID && !cursor.eof(); i++) {
                        cursor.next();
                    }
                    int count = 0;
                    while (!cursor.eof() && count < pageSize) {
                        data.add(DataRow.read(cursor, fromID + count, namesArray));
                        progress.current(count);
                        cursor.next();
                        count++;
                    }
View Full Code Here

        db.beginTransaction(SqlJetTransactionMode.WRITE);
        try {
            ISqlJetCursor deleteCursor = table.scope(DOB_INDEX,
                     new Object[] {Long.MIN_VALUE},
                     new Object[] {calendar.getTimeInMillis()});
            while (!deleteCursor.eof()) {
                System.out.println("Deleting: " +
                        deleteCursor.getRowId() + " : " +
                        deleteCursor.getString(FIRST_NAME_FIELD) + " " +
                        deleteCursor.getString(SECOND_NAME_FIELD) + " was born on " +
                        formatDate(deleteCursor.getInteger(DOB_FIELD)));
View Full Code Here

                final Collection<Object> values = new ArrayList<Object>();
                final Collection<Collection<Object>> block = new LinkedList<Collection<Object>>();
                try {
                    c = db.getTable("rep_cache").open();
                    long currentRev = 0;
                    while (!c.eof()) {
                        values.clear();
                        for (int i = 0; i < c.getFieldsCount(); i++) {
                            values.add(c.getValue(i));
                        }
                        long rev = c.getInteger(1);
View Full Code Here

    ISqlJetTable table = db.getTable("record");
    table.insert("10");
    db.beginTransaction(SqlJetTransactionMode.READ_ONLY);
    try {
      ISqlJetCursor cursor = table.open();
      boolean more = !cursor.eof();
      while (more) {
        String s = cursor.getString(0);
        Assert.assertEquals(2, s.length());
        more = cursor.next();
      }
View Full Code Here

      // Remove all rows
      ISqlJetCursor curseur = null;
      final ISqlJetTable tableDossiers = db.getTable("test");
      curseur = tableDossiers.open();
      while (!curseur.eof()) {
        curseur.delete();
      }
      curseur.close();

      // Commit & close
View Full Code Here

    public void testRowCountIsStateless() throws SqlJetException {
        db.runReadTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                SqlJetScope scope = new SqlJetScope(new Object[] {"AB"}, new Object[] {"BC"});
                ISqlJetCursor cursor = db.getTable("table").scope("names_idx", scope);
                Assert.assertTrue(!cursor.eof());
                long count = cursor.getRowCount();
                Assert.assertTrue(count > 0);
                Assert.assertTrue(!cursor.eof());
                Assert.assertTrue(!cursor.eof());
                Assert.assertTrue(cursor.getRowCount() > 0);
View Full Code Here

                SqlJetScope scope = new SqlJetScope(new Object[] {"AB"}, new Object[] {"BC"});
                ISqlJetCursor cursor = db.getTable("table").scope("names_idx", scope);
                Assert.assertTrue(!cursor.eof());
                long count = cursor.getRowCount();
                Assert.assertTrue(count > 0);
                Assert.assertTrue(!cursor.eof());
                Assert.assertTrue(!cursor.eof());
                Assert.assertTrue(cursor.getRowCount() > 0);
                cursor.close();

                cursor = db.getTable("table").scope("names_idx", scope);
View Full Code Here

        Integer count = (Integer) db.runTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb arg0) throws SqlJetException {
                ISqlJetTable table = db.getTable("names");
                ISqlJetCursor cur = table.order(null);
                Integer counter = 0;
                if (!cur.eof()) {
                    do {
                        ++counter;
                    } while (cur.next());

                }
View Full Code Here

                ISqlJetCursor cursor = db.getTable("table").scope("names_idx", scope);
                Assert.assertTrue(!cursor.eof());
                long count = cursor.getRowCount();
                Assert.assertTrue(count > 0);
                Assert.assertTrue(!cursor.eof());
                Assert.assertTrue(!cursor.eof());
                Assert.assertTrue(cursor.getRowCount() > 0);
                cursor.close();

                cursor = db.getTable("table").scope("names_idx", scope);
                // now at 0.
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.