MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / peekView

Method peekView

test/chbench/chbench/src/materialized.cc:71–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71mz::PeekResults mz::peekView(pqxx::connection &c, const std::string &name, const std::optional<std::string> &order,
72 std::optional<unsigned> limit) {
73 std::string query = "SELECT * FROM " + name;
74 if (order) {
75 query += " ORDER BY " + order.value();
76 }
77 if (limit) {
78 query += " LIMIT " + std::to_string(limit.value());
79 }
80
81 auto [time, results] = timeInvocation([&query, &c]() {
82 pqxx::nontransaction w(c);
83 try {
84 return w.exec(query);
85 } catch (const pqxx::sql_error &e) {
86 // 03000 is the SQLSTATE code for SQL_STATEMENT_NOT_YET_COMPLETE
87 if (e.sqlstate() == "03000") {
88 fprintf(stderr, "WARNING: ignoring \"no complete timestamps\" error.");
89 return pqxx::result {};
90 } else {
91 throw;
92 }
93 }
94 });
95
96 return {time, results};
97}
98
99const char *mz::UnexpectedCreateSourcesResult::what() const noexcept {
100 return what_rendered.c_str();

Callers

nothing calls this directly

Calls 4

to_stringFunction · 0.85
timeInvocationFunction · 0.85
execMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected