Пример #1
0
  public void true_insert() throws Exception {
    // synchronized(variavel) {

    Database db = new Database();
    db.connect();
    // BEGIN WORK -> stored procedure
    db.update(
        "insert into tbNews (tmsp, headline, body, email) values ('"
            + this.tmsp
            + "', '"
            + this.headline
            + "', '"
            + this.body
            + "', '"
            + this.email
            + "')");
    ResultSet rs = db.query("select max(id) as id from tbNews");
    if (rs.next()) {
      this.id = rs.getInt("id");
    }
    // COMMIT

    db.close();

    // }
  }
Пример #2
0
  public void remove() throws Exception {
    Database db = new Database();
    db.connect();

    db.update("delete from page where url = '" + url + "'");

    db.close();
  }
Пример #3
0
  public void update() throws Exception {
    Database db = new Database();
    db.connect();

    db.update(
        "update page set tmsp = '" + tmsp + "', body = '" + body + "' where url = '" + url + "'");
    // URLEncoder.encode(url, "UTF-8")+"'");
    // URLEncoder.encode(url, "ISO-8859-1")+"'");

    db.close();
  }
Пример #4
0
  // sqllers
  public void insert() throws Exception {
    Database db = new Database();
    db.connect();

    db.update(
        "insert into page (tmsp, url, body) values ('"
            + tmsp
            + "', '"
            + url
            + "', '"
            + body
            + "')");

    db.close();
  }
Пример #5
0
 public void update() throws Exception {
   Database db = new Database();
   db.connect();
   db.update(
       "update tbNews set tmsp = '"
           + this.tmsp
           + "', headline = '"
           + this.headline
           + "', body = '"
           + this.body
           + "', email = '"
           + this.email
           + "' where id = "
           + this.id);
   db.close();
 }
Пример #6
0
 public void remove() throws Exception {
   Database db = new Database();
   db.connect();
   db.update("delete from tbNews where id = " + this.id);
   db.close();
 }