Package com.google.gwt.gears.client.database

Examples of com.google.gwt.gears.client.database.ResultSet


  public Note[] getNotes() {
    if (db == null) {
      return null;
    }

    ResultSet rs = null;
    ArrayList<Note> al = new ArrayList<Note>();
    try {
      rs = db.execute(DB_FETCH_TEXT);
      while (rs.isValidRow()) {
        Note nd = new Note(rs.getFieldAsString(0), rs.getFieldAsString(1),
            rs.getFieldAsString(2));
        al.add(nd);
        rs.next();
      }
    } catch (DatabaseException e) {
      return null;
    }
View Full Code Here


    String name = n.getName();
    String data = n.getText();
    String vers = n.getVersion();
    String[] args = null;

    ResultSet rs = null;
    try {
      // test whether the row exists or not -- controls behavior below
      args = new String[] {name};
      rs = db.execute(DB_EXISTS, args);
    } catch (DatabaseException e1) {
      return;
    }

    // if row exists update it; if not, create a new one
    if (rs.isValidRow()) {
      args = new String[] {vers, data, name};
      try {
        db.execute(DB_UPDATE, args);
      } catch (DatabaseException e) {
        return;
View Full Code Here

  @Override
  public Map<String, String> getWindowContextData() {
    HashMap<String, String> map = new HashMap<String, String>();

    try {
      ResultSet rs = db.execute("SELECT key, value FROM windowcontext");
      while (rs.isValidRow()) {
        map.put(rs.getFieldAsString(0), rs.getFieldAsString(1));
        rs.next();
      }
    } catch (DatabaseException ex) {
      GWT.log(null, ex);
    }
View Full Code Here

  /**
   * Fill the labels with the phrases from the database.
   */
  private void displayRecentPhrases() {
    try {
      ResultSet rs = db.execute("SELECT * FROM Phrases ORDER BY Id DESC");
      int i;

      for (i = 1; rs.isValidRow(); ++i, rs.next()) {
        if (i <= NUM_SAVED_ROWS) {
          dataTable.setText(i, 0, rs.getFieldAsString(0));
          dataTable.setText(i, 1, rs.getFieldAsString(1));
          dataTable.setText(i, 2, new Date(rs.getFieldAsLong(2)).toString());
        } else {
          db.execute("DELETE FROM Phrases WHERE Id = ?",
              new String[]{rs.getFieldAsString(0)});
        }
      }
      // If a phrase has been removed, clear the label.
      for (; i <= NUM_SAVED_ROWS; i++) {
        for (int j = 0; j < NUM_DATA_TABLE_COLUMNS; j++) {
          dataTable.clearCell(i, j);
        }
      }
      rs.close();
    } catch (DatabaseException e) {
      Window.alert(e.toString());
    }
  }
View Full Code Here

  @Override
  public Map<String, String> getWindowContextData() {
    HashMap<String, String> map = new HashMap<String, String>();

    try {
      ResultSet rs = db.execute("SELECT key, value FROM windowcontext");
      while (rs.isValidRow()) {
        map.put(rs.getFieldAsString(0), rs.getFieldAsString(1));
        rs.next();
      }
    } catch (DatabaseException ex) {
      GWT.log(null, ex);
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.gears.client.database.ResultSet

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.