| 207 | } |
| 208 | |
| 209 | SQLRETURN 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__) |
| 253 | SQLRETURN SQLError(SQLHENV env, SQLHDBC conn, SQLHSTMT stmt, SQLWCHAR* sql_state, |