Commit a794503c authored by Ivan Donchevskiy's avatar Ivan Donchevskiy

TableBlockStorage fix

parent 37265acb
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <UniSetTypes.h> #include <UniSetTypes.h>
int seek=0; int seek=0;
int b_size=100000; int b_size=25000;
int bj_size=1300000; int bj_size=1300000;
void testTable1(void) void testTable1(void)
{ {
...@@ -80,6 +80,9 @@ void testTable1(void) ...@@ -80,6 +80,9 @@ void testTable1(void)
bool testTable2(void) bool testTable2(void)
{ {
char *val=new char[40]; char *val=new char[40];
TableBlockStorage t0;
t0.create("small_file.test", b_size, 4, 40, 100, 5,28,0);
t0.open("small_file.test", b_size, 4, 40, 100, 5,28,0);
TableBlockStorage t; TableBlockStorage t;
//t = new TableBlockStorage(); //t = new TableBlockStorage();
t.create("big_file.test", b_size, 4, 40, 100, 5,28,0); t.create("big_file.test", b_size, 4, 40, 100, 5,28,0);
...@@ -91,6 +94,7 @@ bool testTable2(void) ...@@ -91,6 +94,7 @@ bool testTable2(void)
if(t.findKeyValue(&i,val)!=0) printf("%s, ",val); if(t.findKeyValue(&i,val)!=0) printf("%s, ",val);
} }
printf("\n"); printf("\n");
t0.addRow((char*)&i,val);
if(t.getCurBlock()!=0) if(t.getCurBlock()!=0)
{ {
delete val; delete val;
......
...@@ -189,6 +189,8 @@ bool TableBlockStorage::open(const char* name, int byte_sz, int key_sz, int inf_ ...@@ -189,6 +189,8 @@ bool TableBlockStorage::open(const char* name, int byte_sz, int key_sz, int inf_
if(t->count >= 0) if(t->count >= 0)
break; break;
} }
if( t->count < 0 )
cur_block = 0;
/*! */ /*! */
fseek(file,seekpos+(cur_block*block_size)*(full_size),0); fseek(file,seekpos+(cur_block*block_size)*(full_size),0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment