mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
only append to mtimes when appending a new devid
This commit is contained in:
parent
b67ea7293d
commit
af44c6d190
2 changed files with 14 additions and 10 deletions
|
@ -439,7 +439,7 @@ DBMgr::ReregisterDevice( DevIDRelay relayID, const DevID* host,
|
|||
"devids = array_prepend('%s', devids), ",
|
||||
host->m_devIDType, host->m_devIDString.c_str() );
|
||||
|
||||
formatUpdate( query, desc, clientVersion, model, osVers, relayID );
|
||||
formatUpdate( query, true, desc, clientVersion, model, osVers, relayID );
|
||||
execSql( query );
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ DBMgr::UpdateDevice( DevIDRelay relayID, const char* const desc,
|
|||
if ( exists ) {
|
||||
StrWPF query;
|
||||
query.printf( "UPDATE " DEVICES_TABLE " SET " );
|
||||
formatUpdate( query, desc, clientVersion, model, osVers, relayID );
|
||||
formatUpdate( query, false, desc, clientVersion, model, osVers, relayID );
|
||||
execSql( query );
|
||||
}
|
||||
return exists;
|
||||
|
@ -472,12 +472,16 @@ DBMgr::UpdateDevice( DevIDRelay relayID )
|
|||
}
|
||||
|
||||
void
|
||||
DBMgr::formatUpdate( StrWPF& query, const char* const desc, int clientVersion,
|
||||
const char* const model, const char* const osVers,
|
||||
DevIDRelay relayID )
|
||||
DBMgr::formatUpdate( StrWPF& query, bool append, const char* const desc,
|
||||
int clientVersion, const char* const model,
|
||||
const char* const osVers, DevIDRelay relayID )
|
||||
{
|
||||
// query.printf( "mtimes=array_prepend('now', mtimes)" ); // FIXME: too many
|
||||
query.printf( "mtimes[1]='now'" );
|
||||
if ( append ) {
|
||||
query.printf( "mtimes=array_prepend('now', mtimes)" ); // FIXME: too many
|
||||
} else {
|
||||
query.printf( "mtimes[1]='now'" );
|
||||
}
|
||||
|
||||
if ( NULL != desc && '\0' != desc[0] ) {
|
||||
query.printf( ", clntVers=%d, versDesc='%s'", clientVersion, desc );
|
||||
}
|
||||
|
|
|
@ -159,9 +159,9 @@ class DBMgr {
|
|||
bool nullConnnameOK );
|
||||
int CountStoredMessages( const char* const connName, int hid );
|
||||
bool UpdateDevice( DevIDRelay relayID );
|
||||
void formatUpdate( StrWPF& query, const char* const desc, int clientVersion,
|
||||
const char* const model, const char* const osVers,
|
||||
DevIDRelay relayID );
|
||||
void formatUpdate( StrWPF& query, bool append, const char* const desc,
|
||||
int clientVersion, const char* const model,
|
||||
const char* const osVers, DevIDRelay relayID );
|
||||
|
||||
PGconn* getThreadConn( void );
|
||||
void clearThreadConn();
|
||||
|
|
Loading…
Add table
Reference in a new issue