]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2869] Added count statements
authorFrancis Dupont <fdupont@isc.org>
Wed, 24 May 2023 22:28:45 +0000 (00:28 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 6 Jul 2023 20:11:32 +0000 (22:11 +0200)
src/lib/dhcpsrv/mysql_lease_mgr.cc
src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/pgsql_lease_mgr.cc
src/lib/dhcpsrv/pgsql_lease_mgr.h

index 9acd7d4b24c895639e48f7f145812062ce5cba92..e3fff0cffdbb6cd0023d9a6026912c644a483be6 100644 (file)
@@ -511,6 +511,10 @@ tagged_statements = { {
                         "WHERE remote_id = ? AND lease_addr BETWEEN ? AND ? "
                         "ORDER BY lease_addr "
                         "LIMIT ?"},
+    {MySqlLeaseMgr::COUNT_RELAY_ID6,
+                    "SELECT COUNT(*) FROM lease6_relay_id"},
+    {MySqlLeaseMgr::COUNT_REMOTE_ID6,
+                    "SELECT COUNT(*) FROM lease6_remote_id"},
 } };  // tagged_statements
 
 }  // namespace
index 6cc9bd4ec9ef5b2fd8ccda6daad11661012454b7..3f1aedd0e33f7b0ffce40974c5588f69f8698cbf 100644 (file)
@@ -778,6 +778,8 @@ public:
         GET_REMOTE_ID6,              // Get lease6_remote_id entries
         GET_RELAY_ID6_LINK,          // Get lease6_relay_id entries by link
         GET_REMOTE_ID6_LINK,         // Get lease6_remote_id entries by link
+        COUNT_RELAY_ID6,             // Count the lease6_relay_id number of entries
+        COUNT_REMOTE_ID6,            // Count the lease6_remote_id number of entries
         NUM_STATEMENTS               // Number of statements
     };
 
index 8541a52f675f2feccd293e55e8f604d733271935..994a39dbea9ba60db4d1752563a6a13d574ef455 100644 (file)
@@ -618,6 +618,16 @@ PgSqlTaggedStatement tagged_statements[] = {
       "ORDER BY lease_addr "
       "LIMIT $4"},
 
+    // COUNT_RELAY_ID6
+    { 0, { OID_NONE },
+      "count_relay_id6",
+      "SELECT COUNT(*) FROM lease6_relay_id"},
+
+    // COUNT_REMOTE_ID6
+    { 0, { OID_NONE },
+      "count_remote_id6",
+      "SELECT COUNT(*) FROM lease6_remote_id"},
+
     // End of list sentinel
     { 0,  { 0 }, NULL, NULL }
 };
index 7d4e0d73069a579caa357ba2b3313f9443421df2..7903af75aaedec819c96b51f79f47513955e939b 100644 (file)
@@ -754,6 +754,8 @@ public:
         GET_REMOTE_ID6,              // Get lease6_remote_id entries
         GET_RELAY_ID6_LINK,          // Get lease6_relay_id entries by link
         GET_REMOTE_ID6_LINK,         // Get lease6_remote_id entries by link
+        COUNT_RELAY_ID6,             // Count the lease6_relay_id number of entries
+        COUNT_REMOTE_ID6,            // Count the lease6_remote_id number of entries
         NUM_STATEMENTS               // Number of statements
     };