Package cx.fbn.nevernote.sql.driver

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


  }
  // Delete a note's tags
  public void deleteNoteTag(String noteGuid) {
    boolean check;
    NSqlQuery query = new NSqlQuery(db.getConnection());
    check = query.prepare("Delete from NoteTags where noteGuid = :noteGuid");
    if (!check)
      logger.log(logger.EXTREME, "Note SQL delete prepare has failed.");
 
    query.bindValue(":noteGuid", noteGuid);
    check = query.exec();
View Full Code Here


  //****************************************************************
  //* Check if a row in a table exists
  //****************************************************************
  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;
View Full Code Here

  //* 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);
View Full Code Here

  }
  // 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);
View Full Code Here

    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);
View Full Code Here

    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);
View Full Code Here

   
    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);
View Full Code Here

 
  // 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.");
View Full Code Here

 
  // Get the notebooks custom icon
  public boolean exists(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.");
View Full Code Here

  public void addIcon(String name, String rectype, QIcon icon, String filetype) {
    NSqlQuery query = new NSqlQuery(db.getConnection());
    if (icon == null) {
      return;
    } else {
      if (!query.prepare("Insert into SystemIcon (icon, name, type) values (:icon, :name, :type)"))
        logger.log(logger.EXTREME, "Error preparing notebook icon select.");
      QBuffer buffer = new QBuffer();
          if (!buffer.open(QIODevice.OpenModeFlag.ReadWrite)) {
            logger.log(logger.EXTREME, "Failure to open buffer.  Aborting.");
            return;
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.