OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 18 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18 Rev 25
Line 19... Line 19...
19
import org.openconcerto.sql.model.SQLRow;
19
import org.openconcerto.sql.model.SQLRow;
20
import org.openconcerto.sql.model.SQLRowListRSH;
20
import org.openconcerto.sql.model.SQLRowListRSH;
21
import org.openconcerto.sql.model.SQLRowValues;
21
import org.openconcerto.sql.model.SQLRowValues;
22
import org.openconcerto.sql.model.SQLSelect;
22
import org.openconcerto.sql.model.SQLSelect;
23
import org.openconcerto.sql.model.SQLTable;
23
import org.openconcerto.sql.model.SQLTable;
-
 
24
import org.openconcerto.sql.model.Where;
24
 
25
 
25
import java.sql.SQLException;
26
import java.sql.SQLException;
26
import java.util.ArrayList;
27
import java.util.ArrayList;
27
import java.util.List;
28
import java.util.List;
28
 
29
 
29
 
-
 
-
 
30
// TODO use the one from Nego
30
public class NXDatabaseAccessor implements DatabaseAccessor {
31
public class NXDatabaseAccessor implements DatabaseAccessor {
31
    @SuppressWarnings("unchecked")
32
    @SuppressWarnings("unchecked")
32
    public List<Ville> read() {
33
    public List<Ville> read() {
33
        SQLTable ville = Configuration.getInstance().getBase().getTable("VILLE");
34
        SQLTable ville = Configuration.getInstance().getBase().getTable("VILLE");
34
        SQLSelect sel = new SQLSelect(Configuration.getInstance().getBase());
35
        SQLSelect sel = new SQLSelect(Configuration.getInstance().getBase());
Line 61... Line 62...
61
            rowVals.insert();
62
            rowVals.insert();
62
        } catch (SQLException e) {
63
        } catch (SQLException e) {
63
            // TODO Auto-generated catch block
64
            // TODO Auto-generated catch block
64
            e.printStackTrace();
65
            e.printStackTrace();
65
        }
66
        }
-
 
67
    }
66
 
68
 
-
 
69
    @Override
-
 
70
    public void delete(Ville v) {
-
 
71
        SQLTable villeT = Configuration.getInstance().getBase().getTable("VILLE");
-
 
72
        final Where w = new Where(villeT.getField("NOM"), "=", v.getName()).and(new Where(villeT.getField("CODE_POSTAL"), "=", v.getCodepostal()));
-
 
73
        villeT.getDBSystemRoot().getDataSource().execute("DELETE FROM " + villeT.getSQLName().quote() + " WHERE " + w);
67
    }
74
    }
68
}
75
}