InvoDB/invodb/main.cpp

35 lines
707 B
C++
Raw Normal View History

2021-10-05 14:41:15 +08:00
//
// Created by YuhangQ on 2021/9/24.
//
#include "main.h"
int main() {
2021-10-28 23:15:15 +08:00
int t = time(0);
//srand(1635418590);
2021-10-29 09:55:24 +08:00
srand(t);
2021-10-28 23:15:15 +08:00
printf("seed: %d\n", t);
2021-10-25 22:07:18 +08:00
system("rm -rf test.invodb && touch test.invodb");
2021-10-24 20:21:04 +08:00
2021-10-23 16:28:57 +08:00
PageManager::loadDatabase("test.invodb");
Collection::loadCollections();
2021-10-11 22:05:45 +08:00
2021-10-23 16:28:57 +08:00
PageManager& manager = PageManager::Instance();
2021-10-11 22:05:45 +08:00
2021-10-26 12:29:59 +08:00
2021-10-25 22:07:18 +08:00
Collection *col;
try {
col = &Collection::getCollection("hello");
} catch(const char *error) {
Collection::createCollection("hello");
}
2021-10-23 16:28:57 +08:00
JSON json("{\"hello\": 1}");
2021-10-25 22:07:18 +08:00
col->insert(json);
2021-10-29 09:55:24 +08:00
BTreeUUID *btree = new BTreeUUID(PageManager::Instance().allocate());
btree->testAndBenchmark(1000);
2021-10-26 21:26:48 +08:00
2021-10-05 14:41:15 +08:00
return 0;
}