Skip to content

Commit

Permalink
use row_array_size member from OdbcStatementOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rupurt committed Jul 19, 2023
1 parent aabf856 commit c00e3d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 7 additions & 10 deletions src/include/odbc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,6 @@ struct OdbcEnvironment {
SQLHENV Handle() const { return handle; }
};

struct OdbcStatementOptions {
OdbcStatementOptions(SQLINTEGER _row_array_size) : row_array_size(_row_array_size) {}

SQLINTEGER row_array_size;

public:
SQLULEN RowArraySize() { return row_array_size; }
};

#define MAXCOLS 1024

struct OdbcColumnDescription {
Expand Down Expand Up @@ -344,6 +335,12 @@ struct OdbcConnection {
SQLHSTMT HandleConn() { return handle_conn; }
};

struct OdbcStatementOptions {
OdbcStatementOptions(SQLULEN _row_array_size) : row_array_size(_row_array_size) {}

SQLULEN row_array_size;
};

struct OdbcStatement {
OdbcStatement(shared_ptr<OdbcConnection> _conn)
: conn(_conn), handle(SQL_NULL_HSTMT), prepared(false), executing(false) {}
Expand Down Expand Up @@ -573,7 +570,7 @@ struct OdbcStatement {
}

SetAttribute(SQL_ATTR_ROW_BIND_TYPE, SQL_BIND_BY_COLUMN);
SetAttribute(SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)opts->RowArraySize());
SetAttribute(SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)opts->row_array_size);

auto execute_sql_return = SQLExecute(handle);
if (execute_sql_return == SQL_SUCCESS || execute_sql_return == SQL_SUCCESS_WITH_INFO) {
Expand Down
2 changes: 1 addition & 1 deletion src/odbc_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ static unique_ptr<LocalTableFunctionState>
OdbcScanInitLocalState(ExecutionContext &context, TableFunctionInitInput &input,
GlobalTableFunctionState *global_state) {
auto &bind_data = input.bind_data->Cast<OdbcScanBindData>();
auto row_array_size = bind_data.statement_opts->RowArraySize();
auto row_array_size = bind_data.statement_opts->row_array_size;
auto local_state = make_uniq<OdbcScanLocalState>(row_array_size);

bind_data.statement->SetAttribute(SQL_ATTR_ROW_STATUS_PTR,
Expand Down

0 comments on commit c00e3d4

Please sign in to comment.