-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_parser.cpp
More file actions
30 lines (27 loc) · 1.15 KB
/
debug_parser.cpp
File metadata and controls
30 lines (27 loc) · 1.15 KB
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
#include "src/include/stata_parser.hpp"
#include <iostream>
int main() {
try {
duckdb::StataReader reader("test/data/simple.dta");
if (reader.Open()) {
const auto& header = reader.GetHeader();
const auto& variables = reader.GetVariables();
std::cout << "File opened successfully" << std::endl;
std::cout << "Version: " << (int)header.format_version << std::endl;
std::cout << "Variables: " << header.nvar << std::endl;
std::cout << "Observations: " << header.nobs << std::endl;
std::cout << "Big endian: " << header.is_big_endian << std::endl;
std::cout << std::endl;
for (size_t i = 0; i < variables.size(); i++) {
const auto& var = variables[i];
std::cout << "Var " << i << ": name='" << var.name
<< "', type=" << (int)var.type
<< ", str_len=" << (int)var.str_len << std::endl;
}
}
} catch (const std::exception& e) {
std::cout << "Error: " << e.what() << std::endl;
return 1;
}
return 0;
}