From 2d7977e4b5da8d72416cc69b6f0c6c183ba2714f Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 22 Jan 2013 06:52:50 -0800 Subject: [PATCH] fix test: unset TEXT column returns as "", not NULL. --- xwords4/relay/dbmgr.cpp | 6 +++--- xwords4/relay/dbmgr.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xwords4/relay/dbmgr.cpp b/xwords4/relay/dbmgr.cpp index 84528a1c0..6d015378c 100644 --- a/xwords4/relay/dbmgr.cpp +++ b/xwords4/relay/dbmgr.cpp @@ -814,14 +814,14 @@ DBMgr::StoreMessage( const char* const connName, int hid, } void -decodeMessage( PGresult* result, bool useB64, int b64indx, int byteaIndex, - unsigned char* buf, size_t* buflen ) +DBMgr::decodeMessage( PGresult* result, bool useB64, int b64indx, int byteaIndex, + unsigned char* buf, size_t* buflen ) { const char* from = NULL; if ( useB64 ) { from = PQgetvalue( result, 0, b64indx ); } - if ( NULL == from ) { + if ( NULL == from || '\0' == from[0] ) { useB64 = false; from = PQgetvalue( result, 0, byteaIndex ); } diff --git a/xwords4/relay/dbmgr.h b/xwords4/relay/dbmgr.h index 6218e1aa2..ec716422b 100644 --- a/xwords4/relay/dbmgr.h +++ b/xwords4/relay/dbmgr.h @@ -123,6 +123,8 @@ class DBMgr { DevIDRelay getDevID( const DevID* devID ); int getCountWhere( const char* table, string& test ); void RemoveStoredMessages( string& msgIDs ); + void decodeMessage( PGresult* result, bool useB64, int b64indx, + int byteaIndex, unsigned char* buf, size_t* buflen ); PGconn* getThreadConn( void );