Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 1)
- -- 2)
- /* Class imports */
- import java.sql.*;
- /* Data control */
- class CtrlDadesPublic extends CtrlDadesPrivat {
- public ConjuntTuples consulta(Connection c, Tuple params) throws BDException {
- try {
- ConjuntTuples ct = new ConjuntTuples();
- PreparedStatement ps = c.prepareStatement("SELECT COUNT(*) FROM assignacions a WHERE a.dni = ?;");
- int i = 1;
- ResultSet rs = null;
- while (!params.consulta(i).equals("-999")) {
- ps.setString(1, params.consulta(i));
- rs = ps.executeQuery();
- rs.next();
- Tuple t = new Tuple();
- t.afegir(params.consulta(i));
- t.afegir(rs.getString(1));
- ct.afegir(t);
- i++;
- }
- return ct;
- }
- catch (SQLException se) {
- throw new BDException(11);
- }
- }
- }
- -- JosepRivaille
Add Comment
Please, Sign In to add comment