mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
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:
parent
b0e2975994
commit
b67ea7293d
3 changed files with 5 additions and 5 deletions
|
@ -436,11 +436,10 @@ DBMgr::ReregisterDevice( DevIDRelay relayID, const DevID* host,
|
|||
StrWPF query;
|
||||
query.printf( "UPDATE " DEVICES_TABLE " SET "
|
||||
"devTypes = array_prepend( %d, devTypes), "
|
||||
"devids = array_prepend('%s', devids), ",
|
||||
"devids = array_prepend('%s', devids), ",
|
||||
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 );
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue