MCPcopy Create free account
hub / github.com/apache/arrow / Create

Method Create

cpp/src/arrow/flight/sql/example/sqlite_statement.cc:86–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86arrow::Result<std::shared_ptr<SqliteStatement>> SqliteStatement::Create(
87 sqlite3* db, const std::string& sql) {
88 sqlite3_stmt* stmt = nullptr;
89 int rc =
90 sqlite3_prepare_v2(db, sql.c_str(), static_cast<int>(sql.size()), &stmt, NULLPTR);
91
92 if (rc != SQLITE_OK) {
93 std::string err_msg = "Can't prepare statement: " + std::string(sqlite3_errmsg(db));
94 if (stmt != nullptr) {
95 rc = sqlite3_finalize(stmt);
96 if (rc != SQLITE_OK) {
97 err_msg += "; Failed to finalize SQLite statement: ";
98 err_msg += std::string(sqlite3_errmsg(db));
99 }
100 }
101 return Status::Invalid(err_msg);
102 }
103
104 std::shared_ptr<SqliteStatement> result(new SqliteStatement(db, stmt));
105 return result;
106}
107
108arrow::Result<std::shared_ptr<Schema>> SqliteStatement::GetSchema() const {
109 std::vector<std::shared_ptr<Field>> fields;

Callers

nothing calls this directly

Calls 2

InvalidFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected