Commit 63df1c8b authored by Eduardo L. Buratti's avatar Eduardo L. Buratti

server: Update server SQL queries (adopting new database tables)

Signed-off-by: Eduardo L. Buratti's avatarEduardo L. Buratti <elb09@c3sl.ufpr.br>
parent d31119eb
......@@ -166,7 +166,7 @@ private static String createValueString(String value, String type, int pos) {
private static String createIdVerificationQuery(String table, String inep) {
StringBuilder sb = new StringBuilder("SELECT * FROM ");
sb.append(table);
sb.append(" WHERE esc_inep=");
sb.append(" WHERE inep=");
/* Inep */
sb.append(createValueString(inep, "str", 2));
......@@ -203,11 +203,12 @@ private static String createInventoryQuery(String table, String inep,
String kernel, String timestamp, String project, String version) {
StringBuilder sb = new StringBuilder("INSERT INTO ");
sb.append(table);
sb.append(" (sa_inep, sa_mac, sa_disco1_modelo, sa_disco1_capacidade,");
sb.append(" sa_disco1_usado, sa_disco2_modelo, sa_disco2_capacidade,");
sb.append(" sa_disco2_usado, sa_discos_ad, sa_memoria, sa_processador,");
sb.append(" sa_so_nome, sa_so_distribuicao, sa_so_kernel, sa_data,");
sb.append(" sa_projeto, sa_versao) VALUES (");
sb.append(" (project, inep, macaddr, os_type, os_distro, os_kernel,");
sb.append(" processor, memory, disk1_model, disk1_size, disk1_used,");
sb.append(" disk2_models, disk2_size, disk2_used, extra_hds) VALUES (");
/* Project */
sb.append(createValueString(project, "int", 1));
/* Inep */
sb.append(createValueString(inep, "str", 1));
......@@ -215,6 +216,24 @@ private static String createInventoryQuery(String table, String inep,
/* MAC Address */
sb.append(createValueString(mac, "str", 1));
/* Version */
//sb.append(createValueString(version, "str", 1));
/* SO Type */
sb.append(createValueString(type, "str", 1));
/* SO Distro */
sb.append(createValueString(distro, "str", 1));
/* SO Kernel */
sb.append(createValueString(kernel, "str", 1));
/* Processor Model */
sb.append(createValueString(model, "str", 1));
/* Memory Size */
sb.append(createValueString(memSize, "int", 1));
/* Hdd 1 Model */
sb.append(createValueString(hdd1Model, "str", 1));
......@@ -234,31 +253,7 @@ private static String createInventoryQuery(String table, String inep,
sb.append(createValueString(hdd2Used, "int", 1));
/* Hdd Ad */
sb.append(createValueString(hddAd, "int", 1));
/* Memory Size */
sb.append(createValueString(memSize, "int", 1));
/* Processor Model */
sb.append(createValueString(model, "str", 1));
/* SO Type */
sb.append(createValueString(type, "str", 1));
/* SO Distro */
sb.append(createValueString(distro, "str", 1));
/* SO Kernel */
sb.append(createValueString(kernel, "str", 1));
/* Timestamp */
sb.append(createValueString(timestamp, "str", 1));
/* Project */
sb.append(createValueString(project, "int", 1));
/* Version */
sb.append(createValueString(version, "str", 0));
sb.append(createValueString(hddAd, "int", 0));
return sb.toString();
}
......@@ -283,8 +278,11 @@ private static String createNetQuery(String table, String inep, String mac,
String txBytes, String date) {
StringBuilder sb = new StringBuilder("INSERT INTO ");
sb.append(table);
sb.append(" (net_inep, net_mac, net_hora, net_pacotes_in, net_bytes_in, ");
sb.append(" net_pacotes_out, net_bytes_out, net_data) VALUES (");
sb.append(" (contact_date, inep, macaddr, collect_time, down_kbits,");
sb.append(" down_packages, up_kbits, up_packages) VALUES ( ");
/* Date */
sb.append(createValueString(date, "str", 1));
/* Inep */
sb.append(createValueString(inep, "str", 1));
......@@ -305,10 +303,7 @@ private static String createNetQuery(String table, String inep, String mac,
sb.append(createValueString(txPkts, "int", 1));
/* TX Bytes */
sb.append(createValueString(txBytes, "int", 1));
/* Date */
sb.append(createValueString(date, "str", 0));
sb.append(createValueString(txBytes, "int", 0));
return sb.toString();
}
......
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