mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
Merge branch 'android_branch' into android_gcm
This commit is contained in:
commit
d97c057b8c
1 changed files with 16 additions and 10 deletions
|
@ -629,21 +629,27 @@ DBMgr::StoreMessage( const char* const connName, int hid,
|
|||
getDevID( connName, hid, devID );
|
||||
|
||||
size_t newLen;
|
||||
const char* fmt = "INSERT INTO " MSGS_TABLE " (connname, hid, devid, devType, msg, msglen)"
|
||||
const char* fmt = "INSERT INTO " MSGS_TABLE
|
||||
" (connname, hid, devid, devType, msg, msglen)"
|
||||
" VALUES( '%s', %d, '%s', %d, E'%s', %d)";
|
||||
|
||||
unsigned char* bytes = PQescapeByteaConn( getThreadConn(), buf, len, &newLen );
|
||||
unsigned char* bytes = PQescapeByteaConn( getThreadConn(), buf,
|
||||
len, &newLen );
|
||||
assert( NULL != bytes );
|
||||
|
||||
char query[newLen+128];
|
||||
unsigned int siz = snprintf( query, sizeof(query), fmt, connName, hid,
|
||||
devID.m_devIDString.c_str(),
|
||||
devID.m_devIDType, bytes, len );
|
||||
logf( XW_LOGINFO, "%s: query: %s", __func__, query );
|
||||
PQfreemem( bytes );
|
||||
assert( siz < sizeof(query) );
|
||||
char query[1024];
|
||||
size_t siz = snprintf( query, sizeof(query), fmt, connName, hid,
|
||||
devID.m_devIDString.c_str(),
|
||||
devID.m_devIDType, bytes, len );
|
||||
|
||||
execSql( query );
|
||||
PQfreemem( bytes );
|
||||
|
||||
if ( siz < sizeof(query) ) {
|
||||
logf( XW_LOGINFO, "%s: query: %s", __func__, query );
|
||||
execSql( query );
|
||||
} else {
|
||||
logf( XW_LOGERROR, "%s: buffer too small", __func__ );
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
Loading…
Reference in a new issue