Commit e0b3af31 authored by Eduardo L. Buratti's avatar Eduardo L. Buratti
Browse files

web: Add a method to check if a macaddr belongs to a school

parent 806a4ff6
......@@ -138,4 +138,31 @@ public class School implements {
return school;
public static boolean checkMachineBelongsToSchool(String inep, String macaddr) throws SQLException {
Connection conn = DB.getConnection();
boolean found = false;
try {
PreparedStatement st = conn.prepareStatement(
"SELECT 1 FROM dim_school sch, dim_inventory inv " +
"WHERE AND sch.inep=? and inv.macaddr=? " +
"GROUP BY inv.macaddr;");
st.setString(1, inep);
org.postgresql.util.PGobject macaddrobj = new org.postgresql.util.PGobject();
st.setObject(2, macaddrobj);
ResultSet res = st.executeQuery();
if (
found = true;
finally {
return found;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment