summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-07-07 14:49:54 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-07-07 14:49:54 -0700
commitdd1d2b4d000465798883c4f96d20e9a9fee8b21a (patch)
tree969bec30214259b356aacc2ecb57536e90e2caf7
parentf6d53cc5687a48efa7901f8bdbf5ed75cfc9856d (diff)
downloadinfinitytier-dd1d2b4d000465798883c4f96d20e9a9fee8b21a.tar.gz
infinitytier-dd1d2b4d000465798883c4f96d20e9a9fee8b21a.zip
GitHub issue #343 -- fix authorizedMemberCount
-rw-r--r--controller/SqliteNetworkController.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/controller/SqliteNetworkController.cpp b/controller/SqliteNetworkController.cpp
index 61ac0cd3..4eaef31e 100644
--- a/controller/SqliteNetworkController.cpp
+++ b/controller/SqliteNetworkController.cpp
@@ -351,7 +351,7 @@ SqliteNetworkController::SqliteNetworkController(Node *node,const char *dbPath,c
if (
/* Network */
- (sqlite3_prepare_v2(_db,"SELECT name,private,enableBroadcast,allowPassiveBridging,\"flags\",multicastLimit,creationTime,revision,memberRevisionCounter FROM Network WHERE id = ?",-1,&_sGetNetworkById,(const char **)0) != SQLITE_OK)
+ (sqlite3_prepare_v2(_db,"SELECT name,private,enableBroadcast,allowPassiveBridging,\"flags\",multicastLimit,creationTime,revision,memberRevisionCounter,(SELECT COUNT(1) FROM Member WHERE Member.networkId = Network.id AND Member.authorized > 0) FROM Network WHERE id = ?",-1,&_sGetNetworkById,(const char **)0) != SQLITE_OK)
||(sqlite3_prepare_v2(_db,"SELECT revision FROM Network WHERE id = ?",-1,&_sGetNetworkRevision,(const char **)0) != SQLITE_OK)
||(sqlite3_prepare_v2(_db,"UPDATE Network SET revision = ? WHERE id = ?",-1,&_sSetNetworkRevision,(const char **)0) != SQLITE_OK)
||(sqlite3_prepare_v2(_db,"INSERT INTO Network (id,name,creationTime,revision) VALUES (?,?,?,1)",-1,&_sCreateNetwork,(const char **)0) != SQLITE_OK)
@@ -1834,7 +1834,7 @@ unsigned int SqliteNetworkController::_doCPGet(
(unsigned long long)sqlite3_column_int64(_sGetNetworkById,6),
(unsigned long long)sqlite3_column_int64(_sGetNetworkById,7),
(unsigned long long)sqlite3_column_int64(_sGetNetworkById,8),
- (unsigned long long)0); // TODO: authorized member count, but more efficiently
+ (unsigned long long)sqlite3_column_int64(_sGetNetworkById,9));
responseBody = json;
sqlite3_reset(_sGetRelays);