Package cx.fbn.nevernote.sql.driver

Examples of cx.fbn.nevernote.sql.driver.NSqlQuery.exec()


  //****************************************************************
  public boolean dbTableExists(String name) {
        NSqlQuery query = new NSqlQuery(getConnection());
        query.prepare("select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME=:name");
        query.bindValue(":name", name.toUpperCase());
        query.exec();
        if (query.next())
          return true;
        else
          return false;
  }
View Full Code Here


  public boolean dbTableColumnExists(String tableName, String columnName) {
        NSqlQuery query = new NSqlQuery(getConnection());
        query.prepare("select TABLE_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME=:name and COLUMN_NAME=:column");
        query.bindValue(":name", tableName.toUpperCase());
        query.bindValue(":column", columnName);
        query.exec();
        if (query.next())
          return true;
        else
          return false;
  }
View Full Code Here

  }
  // Create the table
  public void createTable() {
    NSqlQuery query = new NSqlQuery(db.getIndexConnection());
        logger.log(logger.HIGH, "Creating table WORDS ...");
        if (!query.exec("create table words (word varchar, guid varchar, source varchar, weight int, primary key (word, guid, source));")) {
          logger.log(logger.HIGH, "Table WORDS creation FAILED!!!");  
          logger.log(logger.HIGH, query.lastError());
        }  
  }
  // Drop the table
View Full Code Here

        }  
  }
  // Drop the table
  public void dropTable() {
    NSqlQuery query = new NSqlQuery(db.getIndexConnection());
    query.exec("drop table words");
  }
  // Count unindexed notes
  public int getWordCount() {
        NSqlQuery query = new NSqlQuery(db.getIndexConnection());
    query.exec("select count(*) from words");
View Full Code Here

    query.exec("drop table words");
  }
  // Count unindexed notes
  public int getWordCount() {
        NSqlQuery query = new NSqlQuery(db.getIndexConnection());
    query.exec("select count(*) from words");
    query.next();
    int returnValue = new Integer(query.valueString(0));
    return returnValue;
  }

View Full Code Here

  // Clear out the word index table
  public void clearWordIndex() {
    NSqlQuery query = new NSqlQuery(db.getIndexConnection());
        logger.log(logger.HIGH, "DELETE FROM WORDS");
       
        boolean check = query.exec("DELETE FROM WORDS");
        if (!check)
          logger.log(logger.HIGH, "Table WORDS clear has FAILED!!!")
 

  //********************************************************************************
 
View Full Code Here

      logger.log(logger.MEDIUM, deleteWords.lastError());
    }
 
    deleteWords.bindValue(":guid", guid);
    deleteWords.bindValue(":source", type);
    deleteWords.exec();

  }
  // Expunge words
  public void expunge(String guid) {
    NSqlQuery deleteWords = new NSqlQuery(db.getIndexConnection());
View Full Code Here

      logger.log(logger.EXTREME, "Word SQL select prepare expunge has failed.");
      logger.log(logger.MEDIUM, deleteWords.lastError());
    }
 
    deleteWords.bindValue(":guid", guid);
    deleteWords.exec();
  }
  // Reindex a note
  public synchronized void addWordToNoteIndex(String guid, String word, String type, Integer weight) {
    NSqlQuery findWords = new NSqlQuery(db.getIndexConnection());
    if (!findWords.prepare("Select weight from words where guid=:guid and source=:type and word=:word")) {
View Full Code Here

    findWords.bindValue(":guid", guid);
    findWords.bindValue(":type", type);
    findWords.bindValue(":word", word);
   
    boolean addNeeded = true;
    findWords.exec();
    // If we have a match, find out which has the heigher weight & update accordingly
    if (findWords.next()) {
      int recordWeight = new Integer(findWords.valueString(0));
      addNeeded = false;
      if (recordWeight < weight) {
View Full Code Here

       
        updateWord.bindValue(":weight", weight);
        updateWord.bindValue(":guid", guid);
        updateWord.bindValue(":type", type);
        updateWord.bindValue(":word",word);
        updateWord.exec();
      }
    }
   
   
    if (!addNeeded)
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.