stime is the name of the column in actual use

This commit is contained in:
Eric House 2012-12-01 10:31:55 -08:00
parent 618d8530f2
commit 2859ec9132
3 changed files with 11 additions and 9 deletions

View file

@ -45,7 +45,7 @@ CPPFLAGS += -DSPAWN_SELF -g -Wall \
-I $(shell pg_config --includedir) \ -I $(shell pg_config --includedir) \
-DSVN_REV=\"$(shell cat $(GITINFO) 2>/dev/null || echo -n $(HASH) )\" -DSVN_REV=\"$(shell cat $(GITINFO) 2>/dev/null || echo -n $(HASH) )\"
# CPPFLAGS += -DDO_HTTP # CPPFLAGS += -DDO_HTTP
# CPPFLAGS += -DHAVE_SENDTIME # CPPFLAGS += -DHAVE_STIME
# turn on semaphore debugging # turn on semaphore debugging
# CPPFLAGS += -DDEBUG_LOCKS # CPPFLAGS += -DDEBUG_LOCKS

View file

@ -581,8 +581,8 @@ DBMgr::PendingMsgCount( const char* connName, int hid )
int count = 0; int count = 0;
const char* fmt = "SELECT COUNT(*) FROM " MSGS_TABLE const char* fmt = "SELECT COUNT(*) FROM " MSGS_TABLE
" WHERE connName = '%s' AND hid = %d " " WHERE connName = '%s' AND hid = %d "
#ifdef HAVE_SENDTIME #ifdef HAVE_STIME
"AND sendtime IS NULL" "AND stime IS NULL"
#endif #endif
; ;
string query; string query;
@ -692,8 +692,8 @@ DBMgr::CountStoredMessages( const char* const connName, int hid )
{ {
const char* fmt = "SELECT count(*) FROM " MSGS_TABLE const char* fmt = "SELECT count(*) FROM " MSGS_TABLE
" WHERE connname = '%s' " " WHERE connname = '%s' "
#ifdef HAVE_SENDTIME #ifdef HAVE_STIME
"AND sendtime IS NULL" "AND stime IS NULL"
#endif #endif
; ;
@ -748,8 +748,8 @@ DBMgr::GetNthStoredMessage( const char* const connName, int hid,
{ {
const char* fmt = "SELECT id, msg, msglen FROM " MSGS_TABLE const char* fmt = "SELECT id, msg, msglen FROM " MSGS_TABLE
" WHERE connName = '%s' AND hid = %d " " WHERE connName = '%s' AND hid = %d "
#ifdef HAVE_SENDTIME #ifdef HAVE_STIME
"AND sendtime IS NULL " "AND stime IS NULL "
#endif #endif
"ORDER BY id LIMIT 1 OFFSET %d"; "ORDER BY id LIMIT 1 OFFSET %d";
string query; string query;
@ -807,8 +807,8 @@ DBMgr::RemoveStoredMessages( const int* msgIDs, int nMsgIDs )
} }
const char* fmt = const char* fmt =
#ifdef HAVE_SENDTIME #ifdef HAVE_STIME
"UPDATE " MSGS_TABLE " SET sendtime='now' " "UPDATE " MSGS_TABLE " SET stime='now' "
#else #else
"DELETE FROM " MSGS_TABLE "DELETE FROM " MSGS_TABLE
#endif #endif

View file

@ -68,6 +68,7 @@ id SERIAL
,connName VARCHAR(64) ,connName VARCHAR(64)
,hid INTEGER ,hid INTEGER
,ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP
,stime TIMESTAMP DEFAULT NULL
,devid INTEGER ,devid INTEGER
,msg BYTEA ,msg BYTEA
,msglen INTEGER ,msglen INTEGER
@ -81,6 +82,7 @@ id INTEGER UNIQUE PRIMARY KEY
,devType INTEGER ,devType INTEGER
,devid TEXT ,devid TEXT
,ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP
,unreg BOOLEAN DEFAULT FALSE
); );
EOF EOF
} }