Examples of NSqlQuery


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

            "tagGuid varchar, primary key(noteGuid, tagGuid))"))
          logger.log(logger.HIGH, "Table NoteTags creation FAILED!!!");
  }
  // Drop the table
  public void dropTable() {
    NSqlQuery query = new NSqlQuery(db.getConnection());
    query.exec("drop table NoteTags");
  }
View Full Code Here

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

  public List<String> getTagNotes(String tagGuid) {
    if (tagGuid == null)
      return null;
    List<String> notes = new ArrayList<String>();
   
    NSqlQuery query = new NSqlQuery(db.getConnection());
    query.prepare("Select NoteGuid from NoteTags where tagGuid = :guid");
   
    query.bindValue(":guid", tagGuid);
    if (!query.exec()) {
      logger.log(logger.EXTREME, "getTagNotes SQL select has failed.");
      logger.log(logger.MEDIUM, query.lastError());
      return notes;
    }
    while (query.next()) {
      notes.add(query.valueString(0));
   
    return notes;
  }
View Full Code Here

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

      notes.add(query.valueString(0));
   
    return notes;
  }
  void prepareGetNoteTagsQuery() {
    getNoteTagsQuery = new NSqlQuery(db.getConnection());
    getNoteTagsQuery.prepare("Select TagGuid from NoteTags where noteGuid = :guid");
  }
View Full Code Here

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

  }
  // Get a note tags by the note's Guid
  public List<NoteTagsRecord> getAllNoteTags() {
    List<NoteTagsRecord> tags = new ArrayList<NoteTagsRecord>();
   
    NSqlQuery query = new NSqlQuery(db.getConnection());
    if (!query.exec("Select TagGuid, NoteGuid from NoteTags")) {
      logger.log(logger.EXTREME, "NoteTags SQL select has failed.");
      logger.log(logger.MEDIUM, query.lastError());
      return null;
    }
    while (query.next()) {
      NoteTagsRecord record = new NoteTagsRecord();
      record.tagGuid = query.valueString(0);
      record.noteGuid = query.valueString(1);
      tags.add(record);
   
    return tags;
  }
View Full Code Here

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

  // Check if a note has a specific tag already
  public boolean checkNoteNoteTags(String noteGuid, String tagGuid) {
    if (noteGuid == null || tagGuid == null)
      return false;
    boolean check;
    NSqlQuery query = new NSqlQuery(db.getConnection());
    check = query.prepare("Select "
        +"NoteGuid, TagGuid from NoteTags where noteGuid = :noteGuid and tagGuid = :tagGuid");
    if (!check)
      logger.log(logger.EXTREME, "checkNoteTags SQL prepare has failed.");
   
    query.bindValue(":noteGuid", noteGuid);
    query.bindValue(":tagGuid", tagGuid);
    query.exec();
   
    if (!check) {
      logger.log(logger.EXTREME, "checkNoteTags SQL select has failed.");
      logger.log(logger.MEDIUM, query.lastError());
      return false;
    }
   
    if (query.next()) {
      return true;
   
    return false;
  }
View Full Code Here

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

    return false;
  }
  // Save Note Tags
  public void saveNoteTag(String noteGuid, String tagGuid, boolean isDirty) {
    boolean check;
    NSqlQuery query = new NSqlQuery(db.getConnection());

    check = query.prepare("Insert Into NoteTags (noteGuid, tagGuid) "
        +"Values("
        +":noteGuid, :tagGuid)");
    if (!check)
      logger.log(logger.EXTREME, "Note SQL insert prepare has failed.");
 
    query.bindValue(":noteGuid", noteGuid);
    query.bindValue(":tagGuid", tagGuid);
           
    check = query.exec();
    if (!check) {
      logger.log(logger.MEDIUM, "NoteTags Table insert failed.");   
      logger.log(logger.MEDIUM, query.lastError());
    }
    check = query.prepare("Update Note set isDirty=:isDirty where guid=:guid");
    if (!check)
      logger.log(logger.EXTREME, "RNoteTagsTable.saveNoteTag prepare has failed.");
    query.bindValue(":isDirty", isDirty);
    query.bindValue(":guid", noteGuid);
    query.exec();
    if (!check) {
      logger.log(logger.MEDIUM, "RNoteTagsTable.saveNoteTag has failed to set note as dirty.");   
      logger.log(logger.MEDIUM, query.lastError());
    }
  }
View Full Code Here

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

    }
  }
  // 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();
    if (!check) {
      logger.log(logger.MEDIUM, "NoteTags Table delete failed.");   
      logger.log(logger.MEDIUM, query.lastError());
    }

  }
View Full Code Here

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

  }
  // Get a note tag counts
  public List<Pair<String,Integer>> getTagCounts() {
    List<Pair<String,Integer>> counts = new ArrayList<Pair<String,Integer>>();   
    NSqlQuery query = new NSqlQuery(db.getConnection());
    if (!query.exec("select tagguid, count(noteguid) from notetags group by tagguid;")) {
      logger.log(logger.EXTREME, "NoteTags SQL getTagCounts has failed.");
      logger.log(logger.MEDIUM, query.lastError());
      return null;
    }
    while (query.next()) {
      Pair<String,Integer> newCount = new Pair<String,Integer>();
      newCount.setFirst(query.valueString(0));
      newCount.setSecond(query.valueInteger(1));
      counts.add(newCount);
   
    return counts;
  }
View Full Code Here

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

 
  //****************************************************************
  //* 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;
        else
          return false;
  }
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.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());
        }  
  }
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.