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

Function SQLFreeStmt

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

Source from the content-addressed store, hash-verified

207}
208
209SQLRETURN SQLFreeStmt(SQLHSTMT handle, SQLUSMALLINT option) {
210 ARROW_LOG(DEBUG) << "SQLFreeStmt called with handle: " << handle
211 << ", option: " << option;
212
213 switch (option) {
214 case SQL_CLOSE: {
215 using ODBC::ODBCStatement;
216
217 return ODBCStatement::ExecuteWithDiagnostics(handle, SQL_ERROR, [=]() {
218 ODBCStatement* statement = reinterpret_cast<ODBCStatement*>(handle);
219
220 // Close cursor with suppressErrors set to true
221 statement->CloseCursor(true);
222
223 return SQL_SUCCESS;
224 });
225 }
226
227 case SQL_DROP: {
228 return SQLFreeHandle(SQL_HANDLE_STMT, handle);
229 }
230
231 case SQL_UNBIND: {
232 using ODBC::ODBCDescriptor;
233 using ODBC::ODBCStatement;
234 return ODBCStatement::ExecuteWithDiagnostics(handle, SQL_ERROR, [=]() {
235 ODBCStatement* statement = reinterpret_cast<ODBCStatement*>(handle);
236 ODBCDescriptor* ard = statement->GetARD();
237 // Unbind columns
238 ard->SetHeaderField(SQL_DESC_COUNT, (void*)0, 0);
239 return SQL_SUCCESS;
240 });
241 }
242
243 // SQLBindParameter is not supported
244 case SQL_RESET_PARAMS: {
245 return SQL_SUCCESS;
246 }
247 }
248
249 return SQL_ERROR;
250}
251
252#if defined(__APPLE__)
253SQLRETURN SQLError(SQLHENV env, SQLHDBC conn, SQLHSTMT stmt, SQLWCHAR* sql_state,

Callers 4

TYPED_TESTFunction · 0.50
TYPED_TESTFunction · 0.50
TYPED_TESTFunction · 0.50
TYPED_TESTFunction · 0.50

Calls 4

CloseCursorMethod · 0.80
GetARDMethod · 0.80
SetHeaderFieldMethod · 0.80
SQLFreeHandleFunction · 0.70

Tested by 4

TYPED_TESTFunction · 0.40
TYPED_TESTFunction · 0.40
TYPED_TESTFunction · 0.40
TYPED_TESTFunction · 0.40