| 1147 | } |
| 1148 | |
| 1149 | SQLRETURN SQLFetchScroll(SQLHSTMT stmt, SQLSMALLINT fetch_orientation, |
| 1150 | SQLLEN fetch_offset) { |
| 1151 | ARROW_LOG(DEBUG) << "SQLFetchScroll called with stmt: " << stmt |
| 1152 | << ", fetch_orientation: " << fetch_orientation |
| 1153 | << ", fetch_offset: " << fetch_offset; |
| 1154 | |
| 1155 | using ODBC::ODBCDescriptor; |
| 1156 | using ODBC::ODBCStatement; |
| 1157 | return ODBCStatement::ExecuteWithDiagnostics(stmt, SQL_ERROR, [=]() { |
| 1158 | // Only SQL_FETCH_NEXT forward-only fetching orientation is supported, |
| 1159 | // meaning the behavior of SQLExtendedFetch is same as SQLFetch. |
| 1160 | if (fetch_orientation != SQL_FETCH_NEXT) { |
| 1161 | throw DriverException("Optional feature not supported.", "HYC00"); |
| 1162 | } |
| 1163 | // Ignore fetch_offset as it's not applicable to SQL_FETCH_NEXT |
| 1164 | ARROW_UNUSED(fetch_offset); |
| 1165 | |
| 1166 | ODBCStatement* statement = reinterpret_cast<ODBCStatement*>(stmt); |
| 1167 | |
| 1168 | // The SQL_ATTR_ROW_ARRAY_SIZE statement attribute specifies the number of rows in the |
| 1169 | // rowset. |
| 1170 | ODBCDescriptor* ard = statement->GetARD(); |
| 1171 | size_t rows = static_cast<size_t>(ard->GetArraySize()); |
| 1172 | if (statement->Fetch(rows)) { |
| 1173 | return SQL_SUCCESS; |
| 1174 | } else { |
| 1175 | // Reached the end of rowset |
| 1176 | return SQL_NO_DATA; |
| 1177 | } |
| 1178 | }); |
| 1179 | } |
| 1180 | |
| 1181 | SQLRETURN SQLBindCol(SQLHSTMT stmt, SQLUSMALLINT record_number, SQLSMALLINT c_type, |
| 1182 | SQLPOINTER data_ptr, SQLLEN buffer_length, SQLLEN* indicator_ptr) { |