SQLRETURN UncaughtOdbcEntry() { SQLRETURN error = SQL_ERROR; ENV* env; DBC* dbc; switch (mHandleType) { case SQL_HANDLE_ENV: error = rets_SQLAllocEnv(mOutputHandlePtr); break; case SQL_HANDLE_DBC: env = static_cast<ENV*>(mInputHandle); error = env->SQLAllocConnect(mOutputHandlePtr); break; case SQL_HANDLE_STMT: dbc = static_cast<DBC*>(mInputHandle); error = dbc->SQLAllocStmt(mOutputHandlePtr); break; default: return SQL_ERROR; } return error; }
void glp_puts(const char *s) { #ifdef HAVE_ENV ENV *env = get_env_ptr(); /* if terminal output is disabled, do nothing */ if (!env->term_out) goto skip; /* pass the string to the hook routine, if defined */ if (env->term_hook != NULL) { if (env->term_hook(env->term_info, s) != 0) goto skip; } /* write the string on the terminal */ fputs(s, stdout); fflush(stdout); /* write the string on the tee file, if required */ if (env->tee_file != NULL) { fputs(s, env->tee_file); fflush(env->tee_file); } skip: return; #else /* write the string on the terminal */ if (_term_hook_) _term_hook_(s); #endif }
SQLRETURN UncaughtOdbcEntry() { SQLRETURN error = SQL_ERROR; ENV* env; DBC* dbc; STMT* stmt; switch (mHandleType) { case SQL_HANDLE_ENV: error = rets_SQLFreeEnv((ENV *)mHandle); break; case SQL_HANDLE_DBC: dbc = static_cast<DBC*>(mHandle); env = dbc->getEnv(); error = env->SQLFreeConnect(dbc); break; case SQL_HANDLE_STMT: stmt = static_cast<STMT*>(mHandle); dbc = stmt->getDbc(); error = dbc->SQLFreeStmt(stmt, SQL_DROP); break; default: break; } return error; }
static void error(const char *fmt, ...) { ENV *env = get_env_ptr(); va_list arg; env->term_out = GLP_ON; va_start(arg, fmt); xvprintf(fmt, arg); va_end(arg); xprintf("Error detected in file %s at line %d\n", env->err_file, env->err_line); if (env->err_hook != NULL) env->err_hook(env->err_info); abort(); exit(EXIT_FAILURE); /* no return */ }
void glp_vprintf(const char *fmt, va_list arg) { ENV *env = get_env_ptr(); /* if terminal output is disabled, do nothing */ if (!env->term_out) goto skip; /* format the output */ vsprintf(env->term_buf, fmt, arg); /* pass the output to the user-defined routine */ if (env->term_hook != NULL) { if (env->term_hook(env->term_info, env->term_buf) != 0) goto skip; } /* send the output to the terminal */ fputs(env->term_buf, stdout); fflush(stdout); /* copy the output to the text file */ if (env->tee_file != NULL) { fputs(env->term_buf, env->tee_file); fflush(env->tee_file); } skip: return; }