From 2859ec9132047db9b2025c336a4e1058821c710d Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 1 Dec 2012 10:31:55 -0800 Subject: [PATCH] stime is the name of the column in actual use --- xwords4/relay/Makefile | 2 +- xwords4/relay/dbmgr.cpp | 16 ++++++++-------- xwords4/relay/xwrelay.sh | 2 ++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/xwords4/relay/Makefile b/xwords4/relay/Makefile index 0e03488fe..891941db9 100644 --- a/xwords4/relay/Makefile +++ b/xwords4/relay/Makefile @@ -45,7 +45,7 @@ CPPFLAGS += -DSPAWN_SELF -g -Wall \ -I $(shell pg_config --includedir) \ -DSVN_REV=\"$(shell cat $(GITINFO) 2>/dev/null || echo -n $(HASH) )\" # CPPFLAGS += -DDO_HTTP -# CPPFLAGS += -DHAVE_SENDTIME +# CPPFLAGS += -DHAVE_STIME # turn on semaphore debugging # CPPFLAGS += -DDEBUG_LOCKS diff --git a/xwords4/relay/dbmgr.cpp b/xwords4/relay/dbmgr.cpp index 44401410c..099403e8d 100644 --- a/xwords4/relay/dbmgr.cpp +++ b/xwords4/relay/dbmgr.cpp @@ -581,8 +581,8 @@ DBMgr::PendingMsgCount( const char* connName, int hid ) int count = 0; const char* fmt = "SELECT COUNT(*) FROM " MSGS_TABLE " WHERE connName = '%s' AND hid = %d " -#ifdef HAVE_SENDTIME - "AND sendtime IS NULL" +#ifdef HAVE_STIME + "AND stime IS NULL" #endif ; string query; @@ -692,8 +692,8 @@ DBMgr::CountStoredMessages( const char* const connName, int hid ) { const char* fmt = "SELECT count(*) FROM " MSGS_TABLE " WHERE connname = '%s' " -#ifdef HAVE_SENDTIME - "AND sendtime IS NULL" +#ifdef HAVE_STIME + "AND stime IS NULL" #endif ; @@ -748,8 +748,8 @@ DBMgr::GetNthStoredMessage( const char* const connName, int hid, { const char* fmt = "SELECT id, msg, msglen FROM " MSGS_TABLE " WHERE connName = '%s' AND hid = %d " -#ifdef HAVE_SENDTIME - "AND sendtime IS NULL " +#ifdef HAVE_STIME + "AND stime IS NULL " #endif "ORDER BY id LIMIT 1 OFFSET %d"; string query; @@ -807,8 +807,8 @@ DBMgr::RemoveStoredMessages( const int* msgIDs, int nMsgIDs ) } const char* fmt = -#ifdef HAVE_SENDTIME - "UPDATE " MSGS_TABLE " SET sendtime='now' " +#ifdef HAVE_STIME + "UPDATE " MSGS_TABLE " SET stime='now' " #else "DELETE FROM " MSGS_TABLE #endif diff --git a/xwords4/relay/xwrelay.sh b/xwords4/relay/xwrelay.sh index 91ae66d14..5a53b697d 100755 --- a/xwords4/relay/xwrelay.sh +++ b/xwords4/relay/xwrelay.sh @@ -68,6 +68,7 @@ id SERIAL ,connName VARCHAR(64) ,hid INTEGER ,ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP +,stime TIMESTAMP DEFAULT NULL ,devid INTEGER ,msg BYTEA ,msglen INTEGER @@ -81,6 +82,7 @@ id INTEGER UNIQUE PRIMARY KEY ,devType INTEGER ,devid TEXT ,ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP +,unreg BOOLEAN DEFAULT FALSE ); EOF }