[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-web/master] Correct order of addresses in same /24 or /48.



commit 7089f048fafc55a37b0fca3bac4e4016d9fbdbc5
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Wed Dec 12 08:15:03 2012 +0100

    Correct order of addresses in same /24 or /48.
---
 db/exonerator.sql |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/db/exonerator.sql b/db/exonerator.sql
index 6851e91..fd58531 100755
--- a/db/exonerator.sql
+++ b/db/exonerator.sql
@@ -325,19 +325,22 @@ $$ LANGUAGE SQL;
 CREATE OR REPLACE FUNCTION search_addresses_in_same_24 (
     select_address24 CHARACTER(6),
     select_date DATE)
-    RETURNS TABLE(address TEXT) AS $$
-  SELECT HOST(oraddress)
+    RETURNS TABLE(addresstext TEXT,
+          addressinet INET) AS $$
+  SELECT HOST(oraddress),
+        oraddress
       FROM statusentry
       WHERE oraddress24 = $1
       AND DATE(validafter) >= $2 - 1
       AND DATE(validafter) <= $2 + 1
   UNION
-  SELECT HOST(exitaddress)
+  SELECT HOST(exitaddress),
+        exitaddress
       FROM exitlistentry
       WHERE exitaddress24 = $1
       AND DATE(scanned) >= $2 - 2
       AND DATE(scanned) <= $2 + 1
-  ORDER BY 1;
+  ORDER BY 2;
 $$ LANGUAGE SQL;
 
 -- Look up all IPv6 OR addresses in the /48 network of a given address to
@@ -345,12 +348,14 @@ $$ LANGUAGE SQL;
 CREATE OR REPLACE FUNCTION search_addresses_in_same_48 (
     select_address48 CHARACTER(12),
     select_date DATE)
-    RETURNS TABLE(address TEXT) AS $$
-  SELECT HOST(oraddress)
+    RETURNS TABLE(addresstext TEXT,
+          addressinet INET) AS $$
+  SELECT HOST(oraddress),
+        oraddress
       FROM statusentry
       WHERE oraddress48 = $1
       AND DATE(validafter) >= $2 - 1
       AND DATE(validafter) <= $2 + 1
-  ORDER BY 1;
+  ORDER BY 2;
 $$ LANGUAGE SQL;
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits