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) \
-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

View file

@ -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

View file

@ -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
}