Package com.almworks.sqlite4java

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


          }

          if (! isDir) {
            stmt = db.prepare("SELECT typelabel FROM Types, TypeGuesses WHERE TypeGuesses.fid = ? AND Types.typeid = TypeGuesses.typeid");
            try {
              stmt.bind(1, fid);
              if (stmt.step()) {
                identifier = stmt.columnString(0);
              }
            } finally {
              stmt.dispose();
View Full Code Here


            try {
              List<String> schemaReprs = new ArrayList<String>();
              List<String> schemaDescs = new ArrayList<String>();
              List<byte[]> schemaBlobs = new ArrayList<byte[]>();
             
              stmt.bind(1, fid);
              while (stmt.step()) {
                schemaReprs.add(stmt.columnString(1));
                schemaDescs.add(stmt.columnString(2));
                schemaBlobs.add(stmt.columnBlob(3));
              }
View Full Code Here

  public Path getTopDir(final long crawlid)  {
    return dbQueue.execute(new SQLiteJob<Path>() {
        protected Path job(SQLiteConnection db) throws SQLiteException {
          SQLiteStatement stmt = db.prepare("SELECT path, fname FROM Files WHERE crawlid = ? AND isDir = 'True' ORDER BY length(path||fname) ASC LIMIT 1");
          try {
            stmt.bind(1, crawlid);
            if (stmt.step()) {
              return new Path(stmt.columnString(0) + stmt.columnString(1));
            } else {
              return null;
            }
View Full Code Here

          List<FileSummary> output = new ArrayList<FileSummary>();
          SQLiteStatement stmt = db.prepare("select fid, path, fname from Files WHERE crawlid = ? AND length(?) > length(path||fname) AND isDir = 'True' AND replace(?, path||fname, '') LIKE '/%'");
          try {
            Path targetDir = new Path(targetDirStr);
            if (targetDir.getParent() != null) {
              stmt.bind(1, crawlid).bind(2, targetDir.toString()).bind(3, targetDir.toString());
              while (stmt.step()) {
                //Path p = new Path(stmt.columnString(0) + stmt.columnString(1));
                output.add(new FileSummary(FSAnalyzer.this, stmt.columnLong(0)));
              }
            }
View Full Code Here

          try {
            String targetDirNormalizedStr = targetDir;
            if (! targetDirNormalizedStr.endsWith("/")) {
              targetDirNormalizedStr += "/";
            }
            stmt.bind(1, crawlid).bind(2, targetDirNormalizedStr);
            while (stmt.step()) {
              output.add(new FileSummary(FSAnalyzer.this, stmt.columnLong(0)));
            }
          } finally {
            stmt.dispose();
View Full Code Here

  public CrawlSummary getCrawlSummaryData(final long crawlid) {
    return dbQueue.execute(new SQLiteJob<CrawlSummary>() {
        protected CrawlSummary job(SQLiteConnection db) throws SQLiteException {
          SQLiteStatement stmt = db.prepare("SELECT crawlstarted, crawlfinished, inprogress, fsid FROM Crawls WHERE crawlid = ?");
          try {
            stmt.bind(1, crawlid);
            if (stmt.step()) {
              return new CrawlSummary(FSAnalyzer.this, crawlid, stmt.columnString(0), stmt.columnString(1), "True".equals(stmt.columnString(2)), stmt.columnLong(3));
            } else {
              return null;
            }
View Full Code Here

  public TypeSummaryData getTypeSummaryData(final long typeid) {
    return dbQueue.execute(new SQLiteJob<TypeSummaryData>() {
        protected TypeSummaryData job(SQLiteConnection db) throws SQLiteException {
          SQLiteStatement stmt = db.prepare("SELECT typelabel FROM Types WHERE typeid = ?");
          try {
            stmt.bind(1, typeid);
            if (stmt.step()) {
              return new TypeSummaryData(typeid, stmt.columnString(0));
            } else {
              return null;
            }
View Full Code Here

  public String getConfigProperty(final String propertyName) {
    return dbQueue.execute(new SQLiteJob<String>() {
        protected String job(SQLiteConnection db) throws SQLiteException {
          SQLiteStatement stmt = db.prepare("SELECT property FROM Configs WHERE propertyname=?");
          try {
            stmt.bind(1, propertyName);
            if (stmt.step()) {
              return stmt.columnString(0);
            } else {
              return null;
            }
View Full Code Here

    } else {
      dbQueue.execute(new SQLiteJob<Object>() {
          protected Object job(SQLiteConnection db) throws SQLiteException {
            SQLiteStatement stmt = db.prepare("REPLACE into Configs VALUES(?, ?)");
            try {
              stmt.bind(1, propertyName);
              stmt.bind(2, property);           
              stmt.step();
            } finally {
              stmt.dispose();
            }
View Full Code Here

      dbQueue.execute(new SQLiteJob<Object>() {
          protected Object job(SQLiteConnection db) throws SQLiteException {
            SQLiteStatement stmt = db.prepare("REPLACE into Configs VALUES(?, ?)");
            try {
              stmt.bind(1, propertyName);
              stmt.bind(2, property);           
              stmt.step();
            } finally {
              stmt.dispose();
            }
            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.