add mtimes, remove mtime, for devices to track each time the devid

changes.  Eventually; now it's updated too often.
This commit is contained in:
Eric House 2013-09-15 12:46:40 -07:00
parent b0e2975994
commit b67ea7293d
3 changed files with 5 additions and 5 deletions

View file

@ -440,7 +440,6 @@ DBMgr::ReregisterDevice( DevIDRelay relayID, const DevID* host,
host->m_devIDType, host->m_devIDString.c_str() );
formatUpdate( query, desc, clientVersion, model, osVers, relayID );
execSql( query );
}
@ -477,7 +476,8 @@ DBMgr::formatUpdate( StrWPF& query, const char* const desc, int clientVersion,
const char* const model, const char* const osVers,
DevIDRelay relayID )
{
query.printf( "mtime='now'" );
// query.printf( "mtimes=array_prepend('now', mtimes)" ); // FIXME: too many
query.printf( "mtimes[1]='now'" );
if ( NULL != desc && '\0' != desc[0] ) {
query.printf( ", clntVers=%d, versDesc='%s'", clientVersion, desc );
}

View file

@ -37,6 +37,6 @@ echo "SELECT connname, hid, devid, count(*), sum(msglen) "\
"GROUP BY connname, hid, devid ORDER BY connname LIMIT $LIMIT;" \
| psql xwgames
echo "SELECT id, model, osvers, mtime, array_length(devTypes, 1) as cnt, devTypes[1] as dTyp, devids[1] as devid FROM devices WHERE id IN (select UNNEST(devids) FROM games $QUERY) ORDER BY id LIMIT $LIMIT;" \
echo "SELECT id, model, osvers, array_length(mtimes, 1) as mcnt, mtimes[1] as mtime, array_length(devTypes, 1) as dcnt, devTypes[1] as dTyp, devids[1] as devid FROM devices WHERE id IN (select UNNEST(devids) FROM games $QUERY) ORDER BY id LIMIT $LIMIT;" \
| psql xwgames

View file

@ -88,7 +88,7 @@ id INTEGER UNIQUE PRIMARY KEY
,model TEXT
,osvers TEXT
,ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP
,mtime TIMESTAMP
,mtimes TIMESTAMP[]
,unreg BOOLEAN DEFAULT FALSE
);
EOF