Examples of NSqlQuery


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

  }
 
 
  // 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.");
    if (!query.next() || query.getBlob(0) == null)
      return false;
    return true;
  }
View Full Code Here

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

 
 
 
  // Set the notebooks custom icon
  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;
          }
          QPixmap p = icon.pixmap(32, 32);
          QImage i = p.toImage();
           i.save(buffer, filetype.toUpperCase());
           buffer.close();
           QByteArray b = new QByteArray(buffer.buffer());
           if (!b.isNull() && !b.isEmpty())
             query.bindValue(":icon", b.toByteArray());
           else
             return;
    }
    query.bindValue(":name", name);
    query.bindValue(":type", rectype);
    if (!query.exec())
      logger.log(logger.LOW, "Error setting system icon. " +query.lastError());
  }
View Full Code Here

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

 
 
 
  // Set the notebooks custom icon
  public void updateIcon(String name, String rectype, QIcon icon, String filetype) {
    NSqlQuery query = new NSqlQuery(db.getConnection());
    if (icon == null) {
      if (!query.prepare("delete from SystemIcon where name=:name and type=:type"))
        logger.log(logger.EXTREME, "Error preparing notebook icon select.");
    } else {
      if (!query.prepare("update SystemIcon set icon=:icon where name=:name and type=: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;
          }
          QPixmap p = icon.pixmap(32, 32);
          QImage i = p.toImage();
           i.save(buffer, filetype.toUpperCase());
           buffer.close();
           QByteArray b = new QByteArray(buffer.buffer());
           if (!b.isNull() && !b.isEmpty())
             query.bindValue(":icon", b.toByteArray());
           else
             return;
    }
    query.bindValue(":name", name);
    query.bindValue(":type", rectype);
    if (!query.exec())
      logger.log(logger.LOW, "Error setting system icon. " +query.lastError());
  }
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 SharedNotebook...");
        if (!query.exec("Create table SharedNotebook (id long primary key, " +
            "userid Integer, " +
            "notebookGuid VarChar, "+
            "email VarChar, "+
            "notebookModifiable boolean, " +
            "requireLogin boolean, "+
View Full Code Here

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

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

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

  // Save an individual notebook
  public void addNotebook(SharedNotebook tempNotebook, boolean isDirty) {
    boolean check;
   
    SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
        NSqlQuery query = new NSqlQuery(db.getConnection());
    check = query.prepare("Insert Into SharedNotebook (id, userid, notebookGuid, email,  "
        +"notebookModifiable, requireLogin, serviceCreated, shareKey, username, isDirty) "  
        + " Values("
        +":id, :userid, :notebookGuid, :email, "
        +":notebookModifiable, :requireLogin, :serviceCreated, "
        +":shareKey, :username, :isDirty)");
    query.bindValue(":id", tempNotebook.getId());
    query.bindValue(":userid", tempNotebook.getUserId());
    query.bindValue(":notebookGuid", tempNotebook.getNotebookGuid());
    query.bindValue(":email", tempNotebook.getEmail());
    query.bindValue(":notebookModifiable", tempNotebook.isNotebookModifiable());
    query.bindValue(":requireLogin", tempNotebook.isRequireLogin());

    StringBuilder serviceCreated = new StringBuilder(simple.format(tempNotebook.getServiceCreated()));     
    query.bindValue(":serviceCreated", serviceCreated.toString());
   
    query.bindValue(":shareKey", tempNotebook.getShareKey());
    query.bindValue(":username", tempNotebook.getUsername());
   
    if (isDirty)
      query.bindValue(":isDirty", true);
    else
      query.bindValue(":isDirty", false);

    check = query.exec();
    if (!check) {
      logger.log(logger.MEDIUM, "SharedNotebook Table insert failed.");
      logger.log(logger.MEDIUM, query.lastError().toString());
    }
  }
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 LinkedNotebook...");
        if (!query.exec("Create table LinkedNotebook (guid VarChar primary key, " +
            "shareName VarChar, " +
            "username VarChar, "+
            "shardID VarChar, " +
            "shareKey VarChar, " +
            "uri VarChar, " +
View Full Code Here

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

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

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

  }
  // Save an individual notebook
  public void addNotebook(LinkedNotebook tempNotebook,  boolean isDirty) {
    boolean check;
   
        NSqlQuery query = new NSqlQuery(db.getConnection());
    check = query.prepare("Insert Into LinkedNotebook (guid, shareName, username,  "
        +"shardId, shareKey, uri, updateSequenceNumber, isDirty, lastSequenceNumber, "
        + "lastSequenceDate, notebookGuid) "  
        + " Values("
        +":guid, :shareName, :username, "
        +":shardId, :shareKey, :uri,:usn, :isDirty, 0, 0, :notebookGuid)");
    query.bindValue(":guid", tempNotebook.getGuid());
    query.bindValue(":shareName", tempNotebook.getShareName());
    query.bindValue(":username", tempNotebook.getUsername());
    query.bindValue(":shardId", tempNotebook.getShardId());
    query.bindValue(":shareKey", tempNotebook.getShareKey());
    query.bindValue(":usn", tempNotebook.getUpdateSequenceNum());
    query.bindValue(":uri", tempNotebook.getUri());
    query.bindValue(":notebookGuid", "");
   
    if (isDirty)
      query.bindValue(":isDirty", true);
    else
      query.bindValue(":isDirty", false);

    check = query.exec();
    if (!check) {
      logger.log(logger.MEDIUM, "LinkedNotebook Table insert failed.");
      logger.log(logger.MEDIUM, query.lastError().toString());
      return;
    }
  }
View Full Code Here

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

   
    // Delete the notebook record
    db.getNotebookTable().expungeNotebook(notebookGuid, needsSync);
   
    // Finally, delete the linked notebook object itself
        NSqlQuery query = new NSqlQuery(db.getConnection());
         check = query.prepare("delete from LinkedNotebook "
           +"where guid=:guid");
    if (!check) {
      logger.log(logger.EXTREME, "LinkedNotebook SQL delete prepare has failed.");
      logger.log(logger.EXTREME, query.lastError().toString());
    }
    query.bindValue(":guid", id);
    check = query.exec();
    if (!check)
      logger.log(logger.MEDIUM, "LinkedNotebook delete failed.");
   
    if  (needsSync) {
      DeletedTable deletedTable = new DeletedTable(logger, db);
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.