aboutsummaryrefslogtreecommitdiff
path: root/engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engine.cpp')
-rw-r--r--engine.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/engine.cpp b/engine.cpp
index dd0f5f4..bc4165a 100644
--- a/engine.cpp
+++ b/engine.cpp
@@ -2,7 +2,9 @@
#include <vector>
#include <map>
#include <cstdlib>
+#include <climits>
#include "enginedata.h"
+#include "Maybe.h"
using namespace std;
@@ -18,11 +20,14 @@ int main(int argc,char **argv){
tables.emplace("hoi",Table("hoi",3,header));
Table *hoitb=&tables.at("hoi");
Row row(3,hoitb);
- row.items[0].u.rh_int32=42;
- row.items[1].u.rh_uint32=42;
+ row.items[0].u.rh_int32=UINT_MAX;
+ row.items[1].u.rh_uint32=UINT_MAX;
row.items[2].u.rh_bytes=new unsigned char[10];
strcpy((char*)row.items[2].u.rh_bytes,"hallo daar");
hoitb->insert(row);
- cout<<"hoitb has "<<hoitb->rows.size()<<" row"<<(hoitb->rows.size()==1?"":"s")<<endl;
+ Maybe<Row> found=hoitb->find(serialise((int32_t)-1));
+ cout<<"hoitb has "<<hoitb->rows.size()<<" row"<<(hoitb->rows.size()==1?"":"s")<<'.'<<endl;
+ if(found)cout<<found.value()<<endl;
+ else cout<<"No row with key -1 found"<<endl;
return 0;
}