blob: bc4165af2a6c26eddb46b1ab1ce845172845beb8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <iostream>
#include <vector>
#include <map>
#include <cstdlib>
#include <climits>
#include "enginedata.h"
#include "Maybe.h"
using namespace std;
map<string,Table> tables;
int main(int argc,char **argv){
ColHeader *header=new ColHeader[3];
header[0]={RH_INT32,0};
header[1]={RH_UINT32,0};
header[2]={RH_BYTES,10};
tables.emplace("hoi",Table("hoi",3,header));
Table *hoitb=&tables.at("hoi");
Row row(3,hoitb);
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);
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;
}
|