mirror of
https://github.com/YuhangQ/InvoDB.git
synced 2025-01-27 15:10:57 +00:00
38 lines
777 B
C++
38 lines
777 B
C++
//
|
|
// Created by YuhangQ on 2021/9/24.
|
|
//
|
|
|
|
#include "main.h"
|
|
|
|
int main() {
|
|
srand(time(NULL));
|
|
|
|
system("rm -rf test.invodb && touch test.invodb");
|
|
|
|
PageManager::loadDatabase("test.invodb");
|
|
Collection::loadCollections();
|
|
|
|
PageManager& manager = PageManager::Instance();
|
|
|
|
Collection *col;
|
|
try {
|
|
col = &Collection::getCollection("hello");
|
|
} catch(const char *error) {
|
|
Collection::createCollection("hello");
|
|
}
|
|
|
|
JSON json("{\"hello\": 1}");
|
|
col->insert(json);
|
|
|
|
|
|
BTreeUUID *btree = new BTreeUUID(PageManager::Instance().allocate());
|
|
char uuid[32];
|
|
for(int i=0; i<1000; i++) {
|
|
generateUUID(uuid);
|
|
btree->insert(uuid, PageManager::Instance().allocate());
|
|
}
|
|
|
|
btree->print();
|
|
|
|
return 0;
|
|
} |