| 86 | already_executed_(false) {} |
| 87 | |
| 88 | arrow::Result<std::shared_ptr<SqliteStatementBatchReader>> |
| 89 | SqliteStatementBatchReader::Create(const std::shared_ptr<SqliteStatement>& statement_) { |
| 90 | ARROW_RETURN_NOT_OK(statement_->Reset()); |
| 91 | if (!statement_->parameters().empty()) { |
| 92 | // If there are parameters, infer the schema after binding the first row |
| 93 | ARROW_RETURN_NOT_OK(statement_->Bind(0, 0)); |
| 94 | } |
| 95 | ARROW_RETURN_NOT_OK(statement_->Step()); |
| 96 | ARROW_ASSIGN_OR_RAISE(auto schema, statement_->GetSchema()); |
| 97 | |
| 98 | std::shared_ptr<SqliteStatementBatchReader> result( |
| 99 | new SqliteStatementBatchReader(statement_, schema)); |
| 100 | |
| 101 | return result; |
| 102 | } |
| 103 | |
| 104 | arrow::Result<std::shared_ptr<SqliteStatementBatchReader>> |
| 105 | SqliteStatementBatchReader::Create(const std::shared_ptr<SqliteStatement>& statement, |