fixed pool statistics

This commit is contained in:
Martin Willi
2008-07-23 13:56:07 +00:00
parent 6410231335
commit a01ad99341
+2 -2
View File
@@ -148,7 +148,7 @@ static void status(void)
printf("%6d ", size);
/* get number of online hosts */
lease = db->query(db, "SELECT COUNT(*) FROM addresses "
"WHERE pool = ? AND acquired != 0 AND released = 0",
"WHERE pool = ? AND released = 0",
DB_UINT, id, DB_INT);
if (lease)
{
@@ -159,7 +159,7 @@ static void status(void)
/* get number of online or valid lieases */
lease = db->query(db, "SELECT COUNT(*) FROM addresses JOIN pools "
"ON addresses.pool = pools.id "
"WHERE pools.id = ? AND acquired != 0 "
"WHERE pools.id = ? "
"AND (released = 0 OR released > ? - timeout) ",
DB_UINT, id, DB_UINT, time(NULL), DB_UINT);
if (lease)