Examples of NSqlQuery


Examples of cx.fbn.nevernote.sql.driver.NSqlQuery

          logger.log(logger.HIGH, query.lastError());
        }  
  }
  // Drop the table
  public void dropTable() {
    NSqlQuery query = new NSqlQuery(db.getIndexConnection());
    query.exec("drop table words");
  }
View Full Code Here

Examples of cx.fbn.nevernote.sql.driver.NSqlQuery

    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");
    query.next();
    int returnValue = new Integer(query.valueString(0));
    return returnValue;
  }
View Full Code Here

Examples of cx.fbn.nevernote.sql.driver.NSqlQuery

    return returnValue;
  }

  // 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

Examples of cx.fbn.nevernote.sql.driver.NSqlQuery

  //********************************************************************************
  //* Support adding & deleting index words
  //********************************************************************************
  //********************************************************************************
  public void expungeFromWordIndex(String guid, String type) {
    NSqlQuery deleteWords = new NSqlQuery(db.getIndexConnection());
    if (!deleteWords.prepare("delete from words where guid=:guid and source=:source")) {
      logger.log(logger.EXTREME, "Note SQL select prepare deleteWords has failed.");
      logger.log(logger.MEDIUM, deleteWords.lastError());
    }
 
    deleteWords.bindValue(":guid", guid);
    deleteWords.bindValue(":source", type);
    deleteWords.exec();

  }
View Full Code Here

Examples of cx.fbn.nevernote.sql.driver.NSqlQuery

    deleteWords.exec();

  }
  // Expunge words
  public void expunge(String guid) {
    NSqlQuery deleteWords = new NSqlQuery(db.getIndexConnection());
    if (!deleteWords.prepare("delete from words where guid=:guid")) {
      logger.log(logger.EXTREME, "Word SQL select prepare expunge has failed.");
      logger.log(logger.MEDIUM, deleteWords.lastError());
    }
 
    deleteWords.bindValue(":guid", guid);
    deleteWords.exec();
  }
View Full Code Here

Examples of cx.fbn.nevernote.sql.driver.NSqlQuery

    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")) {
        logger.log(logger.MEDIUM, "Prepare failed in addWordToNoteIndex()");
      logger.log(logger.MEDIUM, findWords.lastError());
    }
   
    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) {
        NSqlQuery updateWord = new NSqlQuery(db.getIndexConnection());
        if (!updateWord.prepare("Update words set weight=:weight where guid=:guid and source=:type and word=:word")) {
          logger.log(logger.MEDIUM, "Prepare failed for find words in addWordToNoteIndex()");
          logger.log(logger.MEDIUM, findWords.lastError());         
        }
       
        updateWord.bindValue(":weight", weight);
        updateWord.bindValue(":guid", guid);
        updateWord.bindValue(":type", type);
        updateWord.bindValue(":word",word);
        updateWord.exec();
      }
    }
   
   
    if (!addNeeded)
      return;
   
    NSqlQuery insertWords = new NSqlQuery(db.getIndexConnection());
    if (!insertWords.prepare("Insert Into Words (word, guid, weight, source)"
        +" Values(:word, :guid, :weight, :type )")) {
      logger.log(logger.EXTREME, "Note SQL select prepare checkWords has failed.");
      logger.log(logger.MEDIUM, insertWords.lastError());
    }
    insertWords.bindValue(":word", word);
    insertWords.bindValue(":guid", guid);
    insertWords.bindValue(":weight", weight);
    insertWords.bindValue(":type", type);
    if (!insertWords.exec()) {
      String err = insertWords.lastError();
      logger.log(logger.MEDIUM, "Error inserting words into index: " +err);
    }
  }
View Full Code Here

Examples of cx.fbn.nevernote.sql.driver.NSqlQuery

    }
  }

  // Get a list of GUIDs in the table
  public List<String> getGuidList() {
    NSqlQuery query = new NSqlQuery(db.getIndexConnection());
        logger.log(logger.HIGH, "gedGuidList()");
       
        boolean check = query.exec("Select distinct guid from words");
        if (!check)
          logger.log(logger.HIGH, "Table WORDS select distinct guid has FAILED!!!")
       
        List<String> guids = new ArrayList<String>();
        while (query.next()) {
          guids.add(query.valueString(0));
        }
        return guids;
 
View Full Code Here

Examples of cx.fbn.nevernote.sql.driver.NSqlQuery

    logger = l;
    db = d;
  }
  // Create the table
  public void createTable() {
    NSqlQuery query = new NSqlQuery(db.getConnection());
        logger.log(logger.HIGH, "Creating table SystemIcon...");
        if (!query.exec("Create table SystemIcon (name varchar, " +
            "type varchar, " +
            "primary key(name, type), " +
            "icon blob)"))             
          logger.log(logger.HIGH, "Table SystemIcon creation FAILED!!!");  
  }
View Full Code Here

Examples of cx.fbn.nevernote.sql.driver.NSqlQuery

            "icon blob)"))             
          logger.log(logger.HIGH, "Table SystemIcon creation FAILED!!!");  
  }
  // Drop the table
  public void dropTable() {
    NSqlQuery query = new NSqlQuery(db.getConnection());
    query.exec("Drop table SystemIcon");
  }
View Full Code Here

Examples of cx.fbn.nevernote.sql.driver.NSqlQuery

  }

 
  // Get the notebooks custom icon
  public QIcon getIcon(String name, String type) {
    NSqlQuery query = new NSqlQuery(db.getConnection());
   
    if (!query.prepare("Select icon from SystemIcon where name=:name and type=:type"))
      logger.log(logger.EXTREME, "Error preparing system icon select.");
    query.bindValue(":name", name);
    query.bindValue(":type", type);
    if (!query.exec())
      logger.log(logger.EXTREME, "Error finding system icon.");
    if (!query.next() || query.getBlob(0) == null)
      return null;
   
    QByteArray blob = new QByteArray(query.getBlob(0));
    QIcon icon = new QIcon(QPixmap.fromImage(QImage.fromData(blob)));
    return icon;
  }
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.