summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2019-08-08 19:20:01 -0500
committerAdam Ierymenko <adam.ierymenko@gmail.com>2019-08-08 19:20:01 -0500
commit5341c216a703f7499f1eb085d24a4f78e394c389 (patch)
tree4c26a657f268349b08449d966efe2d4ad5912c62
parent96a0c3d764306c0cbdf93e0c229ca33194648ab2 (diff)
downloadinfinitytier-5341c216a703f7499f1eb085d24a4f78e394c389.tar.gz
infinitytier-5341c216a703f7499f1eb085d24a4f78e394c389.zip
Comment ugly query
-rw-r--r--controller/PostgreSQL.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp
index 476ee708..0c345c90 100644
--- a/controller/PostgreSQL.cpp
+++ b/controller/PostgreSQL.cpp
@@ -1082,6 +1082,12 @@ void PostgreSQL::commitThread()
v6mode.c_str(),
};
+ // This ugly query exists because when we want to mirror networks to/from
+ // another data store (e.g. FileDB or LFDB) it is possible to get a network
+ // that doesn't exist in Central's database. This does an upsert and sets
+ // the owner_id to the "first" global admin in the user DB if the record
+ // did not previously exist. If the record already exists owner_id is left
+ // unchanged, so owner_id should be left out of the update clause.
PGresult *res = PQexecParams(conn,
"INSERT INTO ztc_network (id, creation_time, owner_id, controller_id, capabilities, enable_broadcast, "
"last_modified, mtu, multicast_limit, name, private, "