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

Function SQLFetchScroll

cpp/src/arrow/flight/sql/odbc/odbc_api.cc:1148–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

TYPED_TESTFunction · 0.50

Calls 4

DriverExceptionClass · 0.85
GetARDMethod · 0.80
GetArraySizeMethod · 0.80
FetchMethod · 0.80

Tested by 1

TYPED_TESTFunction · 0.40