Package com.almworks.sqlite4java

Examples of com.almworks.sqlite4java.SQLiteStatement.step()


    return dbQueue.execute(new SQLiteJob<String>() {
        protected String job(SQLiteConnection db) throws SQLiteException {
          SQLiteStatement stmt = db.prepare("SELECT hiveTableName FROM HiveTables WHERE fpath = ?");
          try {
            stmt.bind(1, fpath.toString());
            while (stmt.step()) {
              return stmt.columnString(0);
            }
            return null;
          } finally {
            stmt.dispose();
View Full Code Here


        protected Object job(SQLiteConnection db) throws SQLiteException {
          SQLiteStatement stmt = db.prepare("INSERT into HiveTables VALUES(?, ?)");
          try {
            stmt.bind(1, fpath.toString());
            stmt.bind(2, tablename);
            stmt.step();
            return null;
          } finally {
            stmt.dispose();
          }
        }
View Full Code Here

    long fsid = dbQueue.execute(new SQLiteJob<Long>() {
        protected Long job(SQLiteConnection db) throws SQLiteException {
          SQLiteStatement stmt = db.prepare("SELECT fsid FROM Filesystems WHERE fsname = ?");
          try {
            stmt.bind(1, fsuri.toString());
            if (stmt.step()) {
              long resultId = stmt.columnLong(0);
              return resultId;
            } else {
              return -1L;
            }
View Full Code Here

      return dbQueue.execute(new SQLiteJob<Long>() {
          protected Long job(SQLiteConnection db) throws SQLiteException {
            SQLiteStatement stmt = db.prepare("INSERT into Filesystems VALUES(null, ?)");
            try {
              stmt.bind(1, fsuri.toString());
              stmt.step();
              return db.getLastInsertId();
            } finally {
              stmt.dispose();
            }
          }
View Full Code Here

      long crawlid = dbQueue.execute(new SQLiteJob<Long>() {
          protected Long job(SQLiteConnection db) throws SQLiteException {
            SQLiteStatement stmt = db.prepare("SELECT crawlid from Crawls WHERE fsid = ? AND inprogress = 'True'");
            try {
              stmt.bind(1, fsid);
              if (stmt.step()) {
                return stmt.columnLong(0);
              } else {
                return -1L;
              }
            } finally {
View Full Code Here

              String syntheticDateFinished = fileDateFormat.format(new Date(0));
              String inprogress = "True";
              SQLiteStatement stmt = db.prepare("INSERT into Crawls VALUES(null, ?, ?, ?, ?)");
              try {
                stmt.bind(1, dateCreated).bind(2, syntheticDateFinished).bind(3, inprogress).bind(4, fsid);
                stmt.step();
                return db.getLastInsertId();
              } finally {
                stmt.dispose();
              }
            }
View Full Code Here

          SQLiteStatement stmt = db.prepare("UPDATE Crawls SET inprogress='False', crawlfinished=? WHERE crawlid = ?");
          try {
            Date now = new Date(System.currentTimeMillis());
            String dateFinished = fileDateFormat.format(now);
            stmt.bind(1, dateFinished).bind(2, crawlid);
            if (stmt.step()) {
              return crawlid;
            } else {
              return -1L;
            }
          } finally {
View Full Code Here

    return dbQueue.execute(new SQLiteJob<Long>() {
        protected Long job(SQLiteConnection db) throws SQLiteException {
          SQLiteStatement stmt = db.prepare("SELECT crawlid from Crawls WHERE fsid = ? AND inprogress = 'False' ORDER BY crawlid DESC LIMIT 1");
          try {
            stmt.bind(1, fsid);
            if (stmt.step()) {
              return stmt.columnLong(0);
            } else {
              return -1L;
            }
          } finally {
View Full Code Here

    long typeid = dbQueue.execute(new SQLiteJob<Long>() {
        protected Long job(SQLiteConnection db) throws SQLiteException {
          SQLiteStatement stmt = db.prepare("SELECT typeid FROM Types WHERE typelabel = ?");
          try {
            stmt.bind(1, typeLabel);
            if (stmt.step()) {
              long resultId = stmt.columnLong(0);
              return resultId;
            } else {
              return -1L;
            }
View Full Code Here

    return dbQueue.execute(new SQLiteJob<Long>() {
        protected Long job(SQLiteConnection db) throws SQLiteException {
          SQLiteStatement stmt = db.prepare("INSERT into Types VALUES(null, ?)");
          try {
            stmt.bind(1, typeLabel);
            stmt.step();
            return db.getLastInsertId();
          } finally {
            stmt.dispose();
          }
        }
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.