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

Method SetParameters

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

Source from the content-addressed store, hash-verified

177}
178
179Status SqliteStatement::SetParameters(
180 std::vector<std::shared_ptr<arrow::RecordBatch>> parameters) {
181 const int num_params = sqlite3_bind_parameter_count(stmt_);
182 for (const auto& batch : parameters) {
183 if (batch->num_columns() != num_params) {
184 return Status::Invalid("Expected ", num_params, " parameters, but got ",
185 batch->num_columns());
186 }
187 }
188 parameters_ = std::move(parameters);
189 auto end = std::remove_if(
190 parameters_.begin(), parameters_.end(),
191 [](const std::shared_ptr<RecordBatch>& batch) { return batch->num_rows() == 0; });
192 parameters_.erase(end, parameters_.end());
193 return Status::OK();
194}
195
196Status SqliteStatement::Bind(size_t batch_index, int64_t row_index) {
197 if (batch_index >= parameters_.size()) {

Calls 6

InvalidFunction · 0.50
OKFunction · 0.50
num_columnsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
num_rowsMethod · 0.45

Tested by 4

ValidateTransactionsMethod · 0.64
TEST_FFunction · 0.64
RunMainFunction · 0.64