add missing params

This commit is contained in:
Eric House 2013-08-26 08:41:42 -07:00
parent f6b34fcbbc
commit 35a09512ce

View file

@ -357,6 +357,7 @@ DBMgr::RegisterDevice( const DevID* host, int clientVersion,
// loop until we're successful inserting the unique key. Ship with this // loop until we're successful inserting the unique key. Ship with this
// coming from random, but test with increasing values initially to make // coming from random, but test with increasing values initially to make
// sure duplicates are detected. // sure duplicates are detected.
const char* devidStr = host->m_devIDString.c_str();
for ( success = false, ii = 0; !success; ++ii ) { for ( success = false, ii = 0; !success; ++ii ) {
assert( 10 > ii ); // better to check that we're looping BECAUSE assert( 10 > ii ); // better to check that we're looping BECAUSE
// of uniqueness problem. // of uniqueness problem.
@ -365,16 +366,15 @@ DBMgr::RegisterDevice( const DevID* host, int clientVersion,
} while ( DEVID_NONE == devID ); } while ( DEVID_NONE == devID );
const char* command = "INSERT INTO " DEVICES_TABLE const char* command = "INSERT INTO " DEVICES_TABLE
" (id, devType, devid, clntVers, versDesc)" " (id, devType, devid, clntVers, versDesc, model)"
" VALUES( $1, $2, $3, $4, $5 )"; " VALUES( $1, $2, $3, $4, $5, $6 )";
int nParams = 6; int nParams = 6;
char* paramValues[nParams]; char* paramValues[nParams];
char buf[1024]; char buf[1024];
formatParams( paramValues, nParams, formatParams( paramValues, nParams,
"%d"DELIM"%d"DELIM"%s"DELIM"%d"DELIM"%s"DELIM"%s", "%d"DELIM"%d"DELIM"%s"DELIM"%d"DELIM"%s"DELIM"%s",
buf, sizeof(buf), devID, host->m_devIDType, buf, sizeof(buf), devID, host->m_devIDType,
host->m_devIDString.c_str(), clientVersion, devidStr, clientVersion, desc, model );
desc, model );
PGresult* result = PQexecParams( getThreadConn(), command, PGresult* result = PQexecParams( getThreadConn(), command,
nParams, NULL, nParams, NULL,
@ -382,7 +382,7 @@ DBMgr::RegisterDevice( const DevID* host, int clientVersion,
NULL, NULL, 0 ); NULL, NULL, 0 );
success = PGRES_COMMAND_OK == PQresultStatus(result); success = PGRES_COMMAND_OK == PQresultStatus(result);
if ( !success ) { if ( !success ) {
logf( XW_LOGERROR, "PQexec=>%s;%s", logf( XW_LOGERROR, "%s: %d: PQexec=>%s;%s", __func__,
PQresStatus(PQresultStatus(result)), PQresStatus(PQresultStatus(result)),
PQresultErrorMessage(result) ); PQresultErrorMessage(result) );
} }