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

Function SQLFetchScroll

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

Source from the content-addressed store, hash-verified

1147}
1148
1149SQLRETURN 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
1181SQLRETURN SQLBindCol(SQLHSTMT stmt, SQLUSMALLINT record_number, SQLSMALLINT c_type,
1182 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