Package cx.fbn.nevernote.sql.driver

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


  }
  // Update a tag sequence number
  public void updateSavedSearchSequence(String guid, int sequence) {
    boolean check;
     ;
        NSqlQuery query = new NSqlQuery(db.getConnection());
    check = query.prepare("Update SavedSearch set sequence=:sequence where guid=:guid");
    query.bindValue(":sequence", sequence);
    query.bindValue(":guid", guid);
    query.exec();
    if (!check) {
      logger.log(logger.MEDIUM, "SavedSearch sequence update failed.");
      logger.log(logger.MEDIUM, query.lastError());
    }
  }
View Full Code Here


    }
  }
  // Update a tag sequence number
  public void updateSavedSearchGuid(String oldGuid, String newGuid) {
    boolean check;
        NSqlQuery query = new NSqlQuery(db.getConnection());
    check = query.prepare("Update SavedSearch set guid=:newGuid where guid=:oldGuid");
    query.bindValue(":newGuid", newGuid);
    query.bindValue(":oldGuid", oldGuid);
    query.exec();
    if (!check) {
      logger.log(logger.MEDIUM, "SavedSearch guid update failed.");
      logger.log(logger.MEDIUM, query.lastError());
    }
  }
View Full Code Here

    }

  }
  // Get/Set stacks
  public boolean stackExists(String stack) {
    NSqlQuery query = new NSqlQuery(db.getConnection());
   
    query.prepare("Select guid from "+dbName+" where stack=:stack limit 1");
    query.bindValue(":stack", stack);
    if (!query.exec())
      logger.log(logger.EXTREME, "Error setting "+dbName+" stack.");
    if (query.next())
      return true;
    else
      return false;
  }
View Full Code Here

    else
      return false;
  }
  // Set Publishing
  public void setPublishing(String guid, boolean published, Publishing p) {
    NSqlQuery query = new NSqlQuery(db.getConnection());
   
   
    query.prepare("Update "+dbName+" set publishingPublicDescription=:publishingPublicDescription, " +
        "publishingUri=:publishingUri, publishingOrder=:publishingOrder, published=:published, "+
        "publishingAscending=:publishingAscending, isdirty=true where "+
        "guid=:guid");
    query.bindValue(":publishingPublicDescription", p.getPublicDescription());
    query.bindValue(":publishingUri", p.getUri());
        query.bindValue(":publishingOrder", p.getOrder().getValue());
    query.bindValue(":publishingAscending", p.isAscending());
    query.bindValue(":publishingPublicDescription", p.getPublicDescription());
    query.bindValue(":published", published);
    query.bindValue(":guid", guid);
    if (!query.exec())
      logger.log(logger.EXTREME, "Error setting "+dbName+" stack.");
  }
View Full Code Here

  }
  // Get a notebook by uri
  public String getNotebookByUri(String uri) {
    boolean check;
         
        NSqlQuery query = new NSqlQuery(db.getConnection());
               
    check = query.prepare("Select guid "
        +"from "+dbName+" where publishingUri=:uri");
    query.bindValue(":uri", uri);
    check = query.exec();
    if (!check)
      logger.log(logger.EXTREME, "Notebook SQL retrieve guid by uri has failed.");
    if (query.next()) {
      return query.valueString(0);
   
    return null;
 
View Full Code Here

 
  // Get a notebook's sort order
  public int getSortColumn(String guid) {
    boolean check;
         
        NSqlQuery query = new NSqlQuery(db.getConnection());
               
        if (Global.getSortOrder() != Global.View_List_Wide)
          check = query.prepare("Select wide_sort_column "
        +"from "+dbName+" where guid=:guid");
        else
          check = query.prepare("Select narrow_sort_column "
      +"from "+dbName+" where guid=:guid");
    query.bindValue(":guid", guid);
    check = query.exec();
    if (!check) {
      logger.log(logger.EXTREME, "Notebook SQL retrieve sort order has failed.");
      return -1;
    }
    if (query.next()) {
      return query.valueInteger(0);
   
    return -1;
 
View Full Code Here

  // Get a notebook's sort order
  public int getSortOrder(String guid) {
    boolean check;
         
        NSqlQuery query = new NSqlQuery(db.getConnection());
               
        if (Global.getSortOrder() != Global.View_List_Wide)
          check = query.prepare("Select wide_sort_order "
        +"from "+dbName+" where guid=:guid");
        else
          check = query.prepare("Select narrow_sort_order "
      +"from "+dbName+" where guid=:guid");
    query.bindValue(":guid", guid);
    check = query.exec();
    if (!check) {
      logger.log(logger.EXTREME, "Notebook SQL retrieve sort order has failed.");
      return -1;
    }
    if (query.next()) {
      return query.valueInteger(0);
   
    return -1;
 
View Full Code Here

 
  // Get a notebook's sort order
  public void setSortOrder(String guid, int column, int order) {
    boolean check;
         
        NSqlQuery query = new NSqlQuery(db.getConnection());
               
        if (Global.getSortOrder() != Global.View_List_Wide)
          check = query.prepare("Update "+dbName+" set wide_sort_order=:order, wide_sort_column=:column where guid=:guid");
        else
          check = query.prepare("Update "+dbName+" set narrow_sort_order=:order, narrow_sort_column=:column where guid=:guid");

    query.bindValue(":guid", guid);
    query.bindValue(":order", order);
    query.bindValue(":column", column);
    check = query.exec();
    if (!check)
      logger.log(logger.EXTREME, "Notebook SQL set sort order has failed.");
 
View Full Code Here

 
  // Is a notebook a linked notebook?
  public boolean isLinked(String guid) {
    boolean check;
   
        NSqlQuery query = new NSqlQuery(db.getConnection());
               
    check = query.prepare("Select guid "
        +"from "+dbName+" where guid=:guid and linked=true");
    query.bindValue(":guid", guid);
    check = query.exec();
    if (!check)
      logger.log(logger.EXTREME, "Notebook SQL isLinked failed.");
    if (query.next()) {
      return true;
   
    return false;
  }
View Full Code Here

  // Given a notebook, what tags are valid for it?
  public List<String> getValidLinkedTags(String guid) {
    boolean check;
    List<String> tags = new ArrayList<String>();
   
        NSqlQuery query = new NSqlQuery(db.getConnection());              
    check = query.prepare("select distinct tagGuid from noteTags " +
        "where noteGuid in " +
        "(SELECT guid from note where notebookguid=:guid)");
    query.bindValue(":guid", guid);
    check = query.exec();
    if (!check)
      logger.log(logger.EXTREME, "Notebook SQL getValidLinedTags failed.");
    while (query.next()) {
      tags.add(query.valueString(0));
   
    return tags;
   
   
  }
View Full Code Here

TOP

Related Classes of cx.fbn.nevernote.sql.driver.NSqlQuery

Copyright © 2018 www.massapicom. 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.