]> WPIA git - gigi.git/commitdiff
fix: for the psql changes
authorFelix Dörre <felix@dogcraft.de>
Tue, 15 Sep 2015 18:38:05 +0000 (20:38 +0200)
committerFelix Dörre <felix@dogcraft.de>
Tue, 15 Sep 2015 20:19:26 +0000 (22:19 +0200)
src/org/cacert/gigi/dbObjects/Domain.java
src/org/cacert/gigi/dbObjects/DomainPingConfiguration.java
src/org/cacert/gigi/ping/PingerDaemon.java
tests/org/cacert/gigi/testUtils/PingTest.java

index 283efdae6557441f5bc748334d5f14529c1e81bd..c0787b6c535e51b1d6f3f4956f8c4be947983e97 100644 (file)
@@ -226,7 +226,7 @@ public class Domain implements IdCachable, Verifyable {
     }
 
     public void addPing(PingType type, String config) throws GigiApiException {
     }
 
     public void addPing(PingType type, String config) throws GigiApiException {
-        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO `pingconfig` `SET` `domainid`=?, `type`=?, `info`=?");
+        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO `pingconfig` SET `domainid`=?, `type`=?::`pingType`, `info`=?");
         ps.setInt(1, id);
         ps.setString(2, type.toString().toLowerCase());
         ps.setString(3, config);
         ps.setInt(1, id);
         ps.setString(2, type.toString().toLowerCase());
         ps.setString(3, config);
@@ -235,7 +235,7 @@ public class Domain implements IdCachable, Verifyable {
     }
 
     public synchronized void verify(String hash) throws GigiApiException {
     }
 
     public synchronized void verify(String hash) throws GigiApiException {
-        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("UPDATE `domainPinglog` `SET` `state`='success' WHERE `challenge`=? AND `configId` `IN` (SELECT `id` FROM `pingconfig` WHERE `domainId`=?)");
+        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("UPDATE `domainPinglog` SET `state`='success' WHERE `challenge`=? AND `configId` IN (SELECT `id` FROM `pingconfig` WHERE `domainid`=?)");
         ps.setString(1, hash);
         ps.setInt(2, id);
         ps.executeUpdate();
         ps.setString(1, hash);
         ps.setInt(2, id);
         ps.executeUpdate();
@@ -249,7 +249,7 @@ public class Domain implements IdCachable, Verifyable {
     }
 
     public DomainPingExecution[] getPings() throws GigiApiException {
     }
 
     public DomainPingExecution[] getPings() throws GigiApiException {
-        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `state`, `type`, `info`, `result`, `configId` FROM `domainPinglog` INNER JOIN `pingconfig` ON `pingconfig`.`id`=`domainPinglog`.`configid` WHERE `pingconfig`.`domainid`=? ORDER BY `when` DESC;");
+        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepareScrollable("SELECT `state`, `type`, `info`, `result`, `configId` FROM `domainPinglog` INNER JOIN `pingconfig` ON `pingconfig`.`id`=`domainPinglog`.`configId` WHERE `pingconfig`.`domainid`=? ORDER BY `when` DESC;");
         ps.setInt(1, id);
         GigiResultSet rs = ps.executeQuery();
         rs.last();
         ps.setInt(1, id);
         GigiResultSet rs = ps.executeQuery();
         rs.last();
index 47e07dd372e3c34c96aaa7b1aa37177584268ebd..4c4931f5a13280c814d05667279a8b8fb892b3a9 100644 (file)
@@ -69,7 +69,7 @@ public class DomainPingConfiguration implements IdCachable {
     }
 
     public Date getLastExecution() {
     }
 
     public Date getLastExecution() {
-        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `when` AS stamp from domainPinglog WHERE configId=? ORDER BY `when` DESC LIMIT 1");
+        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `when` AS stamp from `domainPinglog` WHERE `configId`=? ORDER BY `when` DESC LIMIT 1");
         ps.setInt(1, id);
         GigiResultSet rs = ps.executeQuery();
         if (rs.next()) {
         ps.setInt(1, id);
         GigiResultSet rs = ps.executeQuery();
         if (rs.next()) {
@@ -79,7 +79,7 @@ public class DomainPingConfiguration implements IdCachable {
     }
 
     public Date getLastSuccess() {
     }
 
     public Date getLastSuccess() {
-        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `when` AS stamp from domainPinglog WHERE configId=? AND state='success' ORDER BY `when` DESC LIMIT 1");
+        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `when` AS stamp from `domainPinglog` WHERE `configId`=? AND state='success' ORDER BY `when` DESC LIMIT 1");
         ps.setInt(1, id);
         GigiResultSet rs = ps.executeQuery();
         if (rs.next()) {
         ps.setInt(1, id);
         GigiResultSet rs = ps.executeQuery();
         if (rs.next()) {
index bb6dc5afa0b164c074eb82d5e1ec0d832b95ecca..e543ca1cd4dd60ed41f922aa11edf451f2ad7de7 100644 (file)
@@ -32,7 +32,7 @@ public class PingerDaemon extends Thread {
     @Override
     public void run() {
         searchNeededPings = DatabaseConnection.getInstance().prepare("SELECT `pingconfig`.`id` FROM `pingconfig` LEFT JOIN `domainPinglog` ON `domainPinglog`.`configId` = `pingconfig`.`id` INNER JOIN `domains` ON `domains`.`id` = `pingconfig`.`domainid` WHERE ( `domainPinglog`.`configId` IS NULL) AND `domains`.`deleted` IS NULL GROUP BY `pingconfig`.`id`");
     @Override
     public void run() {
         searchNeededPings = DatabaseConnection.getInstance().prepare("SELECT `pingconfig`.`id` FROM `pingconfig` LEFT JOIN `domainPinglog` ON `domainPinglog`.`configId` = `pingconfig`.`id` INNER JOIN `domains` ON `domains`.`id` = `pingconfig`.`domainid` WHERE ( `domainPinglog`.`configId` IS NULL) AND `domains`.`deleted` IS NULL GROUP BY `pingconfig`.`id`");
-        enterPingResult = DatabaseConnection.getInstance().prepare("INSERT INTO `domainPinglog` SET `configId`=?, `state`=?, `result`=?, `challenge`=?");
+        enterPingResult = DatabaseConnection.getInstance().prepare("INSERT INTO `domainPinglog` SET `configId`=?, `state`=?::`pingState`, `result`=?, `challenge`=?");
         pingers.put(PingType.EMAIL, new EmailPinger());
         pingers.put(PingType.SSL, new SSLPinger(truststore));
         pingers.put(PingType.HTTP, new HTTPFetch());
         pingers.put(PingType.EMAIL, new EmailPinger());
         pingers.put(PingType.SSL, new SSLPinger(truststore));
         pingers.put(PingType.HTTP, new HTTPFetch());
index 20395878fb4411dc7251bd0166f8cfb2df0eef44..14e002146098561b75d081fcdb22c338f9facc72 100644 (file)
@@ -34,7 +34,7 @@ public abstract class PingTest extends ClientTest {
     }
 
     protected void waitForPings(int count) throws SQLException, InterruptedException {
     }
 
     protected void waitForPings(int count) throws SQLException, InterruptedException {
-        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT COUNT(*) FROM domainPinglog");
+        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT COUNT(*) FROM `domainPinglog`");
         long start = System.currentTimeMillis();
         while (System.currentTimeMillis() - start < 10000) {
             GigiResultSet rs = ps.executeQuery();
         long start = System.currentTimeMillis();
         while (System.currentTimeMillis() - start < 10000) {
             GigiResultSet rs = ps.executeQuery();