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(); // } }
public void remove() throws Exception { Database db = new Database(); db.connect(); db.update("delete from page where url = '" + url + "'"); db.close(); }
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(); }
// 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(); }
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(); }
public void remove() throws Exception { Database db = new Database(); db.connect(); db.update("delete from tbNews where id = " + this.id); db.close(); }