| 818 | */ |
| 819 | |
| 820 | int CPLODBCStatement::ExecuteSQL(const char *pszStatement) |
| 821 | |
| 822 | { |
| 823 | if (m_poSession == nullptr || m_hStmt == nullptr) |
| 824 | { |
| 825 | // We should post an error. |
| 826 | return FALSE; |
| 827 | } |
| 828 | |
| 829 | if (pszStatement != nullptr) |
| 830 | { |
| 831 | Clear(); |
| 832 | Append(pszStatement); |
| 833 | } |
| 834 | |
| 835 | #if (ODBCVER >= 0x0300) |
| 836 | |
| 837 | if (!m_poSession->IsInTransaction()) |
| 838 | { |
| 839 | // Commit pending transactions and set to autocommit mode. |
| 840 | m_poSession->ClearTransaction(); |
| 841 | } |
| 842 | |
| 843 | #endif |
| 844 | |
| 845 | // SQL_NTS=-3 is a valid value for SQLExecDirect. |
| 846 | if (Failed(SQLExecDirect(m_hStmt, |
| 847 | reinterpret_cast<SQLCHAR *>(m_pszStatement), |
| 848 | #ifdef __COVERITY__ |
| 849 | |
| 850 | static_cast<SQLINTEGER>(strlen(m_pszStatement)) |
| 851 | #else |
| 852 | SQL_NTS |
| 853 | #endif |
| 854 | ))) |
| 855 | { |
| 856 | return FALSE; |
| 857 | } |
| 858 | |
| 859 | return CollectResultsInfo(); |
| 860 | } |
| 861 | |
| 862 | /************************************************************************/ |
| 863 | /* CollectResultsInfo() */ |
no test coverage detected