Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- import java.io.*;
- class CtrlDadesPublic extends CtrlDadesPrivat {
- public ConjuntTuples consulta(Connection c, Tuple params) throws BDException {
- try {
- ConjuntTuples ct = new ConjuntTuples();
- ResultSet rs = null;
- PreparedStatement ps = c.prepareStatement("SELECT COUNT(*) FROM assignacions a WHERE a.dni = ?;");
- int i = 1;
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement