| 1085 | } |
| 1086 | |
| 1087 | SQLRETURN SQLFetch(SQLHSTMT stmt) { |
| 1088 | ARROW_LOG(DEBUG) << "SQLFetch called with stmt: " << stmt; |
| 1089 | |
| 1090 | using ODBC::ODBCDescriptor; |
| 1091 | using ODBC::ODBCStatement; |
| 1092 | return ODBCStatement::ExecuteWithDiagnostics(stmt, SQL_ERROR, [=]() { |
| 1093 | ODBCStatement* statement = reinterpret_cast<ODBCStatement*>(stmt); |
| 1094 | |
| 1095 | // The SQL_ATTR_ROW_ARRAY_SIZE statement attribute specifies the number of rows in the |
| 1096 | // rowset. Retrieve it with GetArraySize. |
| 1097 | ODBCDescriptor* ard = statement->GetARD(); |
| 1098 | size_t rows = static_cast<size_t>(ard->GetArraySize()); |
| 1099 | |
| 1100 | if (statement->Fetch(rows)) { |
| 1101 | return SQL_SUCCESS; |
| 1102 | } else { |
| 1103 | // Reached the end of rowset |
| 1104 | return SQL_NO_DATA; |
| 1105 | } |
| 1106 | }); |
| 1107 | } |
| 1108 | |
| 1109 | SQLRETURN SQLExtendedFetch(SQLHSTMT stmt, SQLUSMALLINT fetch_orientation, |
| 1110 | SQLLEN fetch_offset, SQLULEN* row_count_ptr, |