MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / main

Function main

examples/cpp/main.cpp:6–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4using namespace lbug::main;
5
6int main() {
7 auto database = std::make_unique<Database>("" /* fill db path */);
8 auto connection = std::make_unique<Connection>(database.get());
9
10 // Create schema.
11 connection->query("CREATE NODE TABLE Person(name STRING, age INT64, PRIMARY KEY(name));");
12 // Create nodes.
13 connection->query("CREATE (:Person {name: 'Alice', age: 25});");
14 connection->query("CREATE (:Person {name: 'Bob', age: 30});");
15
16 // Execute a simple query.
17 auto result = connection->query("MATCH (a:Person) RETURN a.name AS NAME, a.age AS AGE;");
18 // Print query result.
19 std::cout << result->toString();
20}

Callers

nothing calls this directly

Calls 3

getMethod · 0.45
queryMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected