summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlas Kozat <ulas.kozat@gmail.com>2016-06-03 23:05:02 -0700
committerUlas Kozat <ulas.kozat@gmail.com>2016-06-03 23:05:02 -0700
commit03a4f7d06c9edb877bae2f43b90d82f9adb8e956 (patch)
tree51c07bc844f27630d6fec0a6d1899469c3e1c0a1
parent28f34e2ae729c0e40874ebfc2e60f3854d95f724 (diff)
added sqlite3 support at Domino Server for label subscriptions and client registrations
Change-Id: Id12aff1f81678aeb05ec77ff9f6fb28d6874b981 Signed-off-by: Ulas Kozat <ulas.kozat@gmail.com>
-rwxr-xr-xDominoServer.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/DominoServer.py b/DominoServer.py
index f2a22e2..3cb3db6 100755
--- a/DominoServer.py
+++ b/DominoServer.py
@@ -198,6 +198,17 @@ class CommunicationHandler:
logging.error('Could not add the new labels to %s for Domino Client %d', SERVER_DBFILE, sub_msg.domino_udid)
logging.error('Unexpected error: %s', sys.exc_info()[0])
+ newttypeset = self.dominoServer.subscribed_templateformats[sub_msg.domino_udid]
+ try:
+ c.execute("REPLACE INTO ttypes (udid, ttype_list) VALUES ({udid}, '{newvalue}')".\
+ format(udid=sub_msg.domino_udid, newvalue=','.join(list(newttypeset)) ))
+ except sqlite3.OperationalError as ex1:
+ logging.error('Could not add the new labels to %s for Domino Client %d : %s', SERVER_DBFILE, sub_msg.domino_udid, ex1.message)
+ except:
+ logging.error('Could not add the new labels to %s for Domino Client %d', SERVER_DBFILE, sub_msg.domino_udid)
+ logging.error('Unexpected error: %s', sys.exc_info()[0])
+
+
dbconn.commit()
dbconn.close()
@@ -362,6 +373,11 @@ def main(argv):
logging.debug('In database file %s, no table is created as %s', SERVER_DBFILE, ex.message)
try:
+ c.execute('''CREATE TABLE ttypes (udid INTEGER PRIMARY KEY, ttype_list TEXT)''')
+ except sqlite3.OperationalError as ex:
+ logging.debug('In database file %s, no table is created as %s', SERVER_DBFILE, ex.message)
+
+ try:
c.execute('''CREATE TABLE clients (udid INTEGER PRIMARY KEY, ipaddr TEXT, tcpport INTEGER, templatetypes TEXT, seqno INTEGER)''')
except sqlite3.OperationalError as ex:
logging.debug('In database file %s, no table is created as %s', SERVER_DBFILE, ex.message)