#include <switch.h>
#include <switch_odbc.h>
+#if (ODBCVER < 0x0300)
+#define SQL_NO_DATA SQL_SUCCESS
+#endif
+
struct switch_odbc_handle {
char *dsn;
char *username;
result = SQLExecute(stmt);
+ if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
+ goto error;
+ }
+
SQLRowCount (stmt, &m);
rc = SQLNumResultCols (stmt, &nresultcols);
if (rc != SQL_SUCCESS){
result = SQLExecute(stmt);
- if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO) {
+ if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO && result != SQL_NO_DATA) {
goto error;
}
int y = 0;
int done = 0;
- if (!(result = SQLFetch(stmt)) == SQL_SUCCESS) {
- err++;
+ result = SQLFetch(stmt);
+
+ if (result != SQL_SUCCESS) {
+ if (result != SQL_NO_DATA){
+ err++;
+ }
break;
}