| 1036 | } |
| 1037 | |
| 1038 | SQLRETURN SQLExecDirect(SQLHSTMT stmt, SQLWCHAR* query_text, SQLINTEGER text_length) { |
| 1039 | ARROW_LOG(DEBUG) << "SQLExecDirectW called with stmt: " << stmt |
| 1040 | << ", query_text: " << static_cast<const void*>(query_text) |
| 1041 | << ", text_length: " << text_length; |
| 1042 | |
| 1043 | using ODBC::ODBCStatement; |
| 1044 | // The driver is built to handle SELECT statements only. |
| 1045 | return ODBCStatement::ExecuteWithDiagnostics(stmt, SQL_ERROR, [=]() { |
| 1046 | ODBCStatement* statement = reinterpret_cast<ODBCStatement*>(stmt); |
| 1047 | std::string query = ODBC::SqlWcharToString(query_text, text_length); |
| 1048 | |
| 1049 | statement->Prepare(query); |
| 1050 | statement->ExecutePrepared(); |
| 1051 | |
| 1052 | return SQL_SUCCESS; |
| 1053 | }); |
| 1054 | } |
| 1055 | |
| 1056 | SQLRETURN SQLPrepare(SQLHSTMT stmt, SQLWCHAR* query_text, SQLINTEGER text_length) { |
| 1057 | ARROW_LOG(DEBUG) << "SQLPrepareW called with stmt: " << stmt |