mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +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), ",
|
"devids = array_prepend('%s', devids), ",
|
||||||
host->m_devIDType, host->m_devIDString.c_str() );
|
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 );
|
execSql( query );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ DBMgr::UpdateDevice( DevIDRelay relayID, const char* const desc,
|
||||||
if ( exists ) {
|
if ( exists ) {
|
||||||
StrWPF query;
|
StrWPF query;
|
||||||
query.printf( "UPDATE " DEVICES_TABLE " SET " );
|
query.printf( "UPDATE " DEVICES_TABLE " SET " );
|
||||||
formatUpdate( query, desc, clientVersion, model, osVers, relayID );
|
formatUpdate( query, false, desc, clientVersion, model, osVers, relayID );
|
||||||
execSql( query );
|
execSql( query );
|
||||||
}
|
}
|
||||||
return exists;
|
return exists;
|
||||||
|
@ -472,12 +472,16 @@ DBMgr::UpdateDevice( DevIDRelay relayID )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DBMgr::formatUpdate( StrWPF& query, const char* const desc, int clientVersion,
|
DBMgr::formatUpdate( StrWPF& query, bool append, const char* const desc,
|
||||||
const char* const model, const char* const osVers,
|
int clientVersion, const char* const model,
|
||||||
DevIDRelay relayID )
|
const char* const osVers, DevIDRelay relayID )
|
||||||
{
|
{
|
||||||
// query.printf( "mtimes=array_prepend('now', mtimes)" ); // FIXME: too many
|
if ( append ) {
|
||||||
query.printf( "mtimes[1]='now'" );
|
query.printf( "mtimes=array_prepend('now', mtimes)" ); // FIXME: too many
|
||||||
|
} else {
|
||||||
|
query.printf( "mtimes[1]='now'" );
|
||||||
|
}
|
||||||
|
|
||||||
if ( NULL != desc && '\0' != desc[0] ) {
|
if ( NULL != desc && '\0' != desc[0] ) {
|
||||||
query.printf( ", clntVers=%d, versDesc='%s'", clientVersion, desc );
|
query.printf( ", clntVers=%d, versDesc='%s'", clientVersion, desc );
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,9 +159,9 @@ class DBMgr {
|
||||||
bool nullConnnameOK );
|
bool nullConnnameOK );
|
||||||
int CountStoredMessages( const char* const connName, int hid );
|
int CountStoredMessages( const char* const connName, int hid );
|
||||||
bool UpdateDevice( DevIDRelay relayID );
|
bool UpdateDevice( DevIDRelay relayID );
|
||||||
void formatUpdate( StrWPF& query, const char* const desc, int clientVersion,
|
void formatUpdate( StrWPF& query, bool append, const char* const desc,
|
||||||
const char* const model, const char* const osVers,
|
int clientVersion, const char* const model,
|
||||||
DevIDRelay relayID );
|
const char* const osVers, DevIDRelay relayID );
|
||||||
|
|
||||||
PGconn* getThreadConn( void );
|
PGconn* getThreadConn( void );
|
||||||
void clearThreadConn();
|
void clearThreadConn();
|
||||||
|
|
Loading…
Add table
Reference in a new issue