diff options
author | Maxim Danilov <mdanilov@me.com> | 2018-02-15 16:41:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-15 16:41:25 +0800 |
commit | 9bc9bed38255c41bd4c59f1ac19a237908aa73b5 (patch) | |
tree | b5abf1ab133980f2116aa669e7f274ad86164d66 /tools | |
parent | fb786f19b3629f9ffd99f1a0a96a9dabba920b2f (diff) | |
download | persistence-client-library-9bc9bed38255c41bd4c59f1ac19a237908aa73b5.tar.gz |
db_viewer: increase read value size
Values bigger than 2KB a not shown in persistence_db_viewer tool, increase buffer size for 8KB to support reading values with max size.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/persistence_db_viewer.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/tools/persistence_db_viewer.c b/tools/persistence_db_viewer.c index 15f20df..4e0971b 100644 --- a/tools/persistence_db_viewer.c +++ b/tools/persistence_db_viewer.c @@ -109,6 +109,7 @@ void printDBcontent(const char* appname, dbType type) static const char* wt = "wt.itz"; static const char* def = "default-data.itz"; static const char* confDef = "configurable-default-data.itz"; + static const size_t bufSize = 8192; memset(filename, 0, 512-1); @@ -151,33 +152,29 @@ void printDBcontent(const char* appname, dbType type) if(resourceList != NULL) { - int i = 0, idx = 0, numResources = 0; - int resourceStartIdx[256] = {0}; - char buffer[2048] = {0}; - - memset(resourceStartIdx, 0, 256-1); ret = persComDbGetKeysList(handle, resourceList, listSize); - if(ret != 0) { - resourceStartIdx[idx] = 0; // initial start + int i = 0, idx = 0, numResources = 0; + int resourceStartIdx[256] = { 0 }; + char buffer[bufSize]; - for(i=1; i<listSize; i++ ) + for(i = 1; i < listSize; i++) { - if(resourceList[i] == '\0') - { - numResources++; - resourceStartIdx[idx++] = i+1; - } + if(resourceList[i] == '\0') + { + numResources++; + resourceStartIdx[idx++] = i+1; + } } printf("NumOf resources: %d \n", numResources); - for(i=0; i<=numResources; i++) + for(i = 0; i<= numResources; i++) { - memset(buffer, 0, 1024); + memset(buffer, 0, sizeof(buffer)); printf("Key[%d]: %s\n", i, &resourceList[resourceStartIdx[i]]); - persComDbReadKey(handle, &resourceList[resourceStartIdx[i]], buffer, 1024); + persComDbReadKey(handle, &resourceList[resourceStartIdx[i]], buffer, (int)sizeof(buffer)); printf(" value: %s\n\n", buffer); } } |