Package org.tmatesoft.sqljet.core.table

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


        System.out.println();
        System.out.println(">Alexanders:");
        System.out.println();
        db.beginTransaction(SqlJetTransactionMode.READ_ONLY);
        try {
            printRecords(table.lookup(FULL_NAME_INDEX, "Alexander"));
        } finally {
            db.commit();
        }
       
        // getting rows in table with indexed field value in certain scope.       
View Full Code Here


    // begin a read transaction before reading data (this is required by SqlJet).
    persistenceDb.beginTransaction(SqlJetTransactionMode.READ_ONLY);
    try
    {
      classLogger.log(Level.CONFIG, "Getting Group ID {0} to merge Customer ID {1}.", new Object[] {1, 1});
      ISqlJetCursor foundRow = customerTable.lookup(customerTable.getPrimaryKeyIndexName(), 1);
      if(foundRow != null && foundRow.first())
      {
        int rowCount = intFromLong(foundRow.getRowCount());
        classLogger.log(Level.CONFIG, "Reading {0} Customers.", rowCount);
      }
View Full Code Here

    // begin a read transaction before reading data (this is required by SqlJet).
    persistenceDb.beginTransaction(SqlJetTransactionMode.WRITE);
    try
    {
      classLogger.log(Level.CONFIG, "Getting Group ID {0} to merge Customer ID {1}.", new Object[] {1, 1});
      ISqlJetCursor foundRow = customerTable.lookup(customerTable.getPrimaryKeyIndexName(), 1);
      if(foundRow != null && foundRow.first())
      {
        foundRow.delete();
      }
    }
View Full Code Here

      /// 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());
      } finally {
        db.commit();
      }
View Full Code Here

          }, SqlJetTransactionMode.WRITE);

         db.runTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
              ISqlJetTable table = db.getTable("beans");
              ISqlJetCursor cur = table.lookup(table.getPrimaryKeyIndexName(),1);
              if (!cur.eof()) {
                long v = cur.getInteger(0);
                Assert.assertEquals(1, v);
                boolean isNull = cur.isNull(0); // -> returns true
                Assert.assertFalse(isNull);
View Full Code Here

        db.createIndex("create index i on t(a)");
        db.runReadTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {
                Assert.assertNotNull(t.getIndexDef("I"));
                Assert.assertNotNull(t.order("I"));
                Assert.assertNotNull(t.lookup("I", 0));
                Assert.assertNotNull(t.scope("I", new Object[] { 0 }, new Object[] { 0 }));
                return null;
            }
        });
        db.createIndex("create index II on t(a)");
View Full Code Here

                if (SqlJetErrorCode.CONSTRAINT.equals(e.getErrorCode())) {
                    // insert failed because record already exists -> update
                    // it

                    Object[] key = new Object[] { x, y, zoom, 0 };
                    ISqlJetCursor updateCursor = table.lookup("IND", key);
                    do {
                        updateCursor.update(x, y, zoom, 0, blob);
                    } while (updateCursor.next());
                    updateCursor.close();
View Full Code Here

    {
      @Override
      public void execute(SqlJetDb db) throws SqlJetException
      {
        ISqlJetTable table = db.getTable(STATE_TABLE);
        ISqlJetCursor cursor = table.lookup(table.getPrimaryKeyIndexName(), event.getSource());
        try
        {
          if (!cursor.eof())
          {
            cursor.delete();
View Full Code Here

      @Override
      public Set<String> execute(SqlJetDb database) throws SqlJetException
      {
        Set<String> set = new TreeSet<String>();
        ISqlJetTable table = database.getTable(STATE_TABLE);
        ISqlJetCursor cursor = table.lookup(table.getPrimaryKeyIndexName());
        try
        {
          if (!cursor.eof())
          {
            do
View Full Code Here

    {
      @Override
      public void execute(SqlJetDb db) throws SqlJetException
      {
        ISqlJetTable table = db.getTable(INVOCATION_TABLE);
        ISqlJetCursor cursor = table.lookup(table.getPrimaryKeyIndexName(), transactionId, phase);
        try
        {
          if (!cursor.eof())
          {
            cursor.delete();
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.