/* <odbc::get-connect-option db fInfoType> Performs ODBC SQLGetConnectOption call. Returns a string. */ static void pf_odbc_get_connect_option (PFunArgs) { char *finfo = mhtml_evaluate_string (get_positional_arg (vars, 1)); /* No errors yet! */ gsql_clear_error_message (); if (database_environment_level != 0) { Database *db = get_dbref (vars); if ((db != (Database *)NULL) && gsql_database_connected (db)) { RETCODE status = SQL_ERROR; char buf[1024]; int numval; ODBC_option opt; strcpy (buf, ""); if (find_odbc_option (finfo, &opt) != 0) { switch (opt.type) { case ODBC_OPT_STRING: status = SQLGetConnectOption (db->hdbc, opt.code, buf); break; case ODBC_OPT_INT32: status = SQLGetConnectOption (db->hdbc, opt.code, &numval); sprintf (buf, "%d", numval); break; case ODBC_OPT_INT16: status = SQLGetConnectOption (db->hdbc, opt.code, &numval); sprintf (buf, "%d", numval & 0xffff); break; } } if (status == SQL_SUCCESS) { bprintf_insert (page, start, "%s", buf); *newstart += strlen (buf); } else gsql_save_error_message (db, GSQL_DEFAULT_ERRMSG); } } xfree (finfo); }
static void test_bug_7628 (HDBC hdbc) { RETCODE rc; SQLCHAR qual[100]; rc = SQLGetConnectOption (hdbc, SQL_CURRENT_QUALIFIER, qual); }
Transaction::Transaction(Connection &conn) : Conn(conn) , SavedOption(0) , Commited(false) { SQLRETURN Ret = SQLGetConnectOption(Conn.GetHolder().GetHandle(), SQL_AUTOCOMMIT, reinterpret_cast<SQLPOINTER *>(&SavedOption)); if (Ret != SQL_SUCCESS) throw TransactionException("Error save options", teErrorSaveOptions); Ret = SQLSetConnectOption(Conn.GetHolder().GetHandle(), SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); if (Ret != SQL_SUCCESS) throw TransactionException("Error get init transaction", teErrorInitTransactio); }
/*-----------------------------------------------------------------------------*/ void ODBCConnectOption() { HDBC hdbc = (HDBC)ptoc_int(2); int set = ptoc_int(3); long value = 0; RETCODE rc; if (set) { rc = SQLSetConnectOption(hdbc,(UWORD)ptoc_int(4),(UDWORD)ptoc_int(5)); } else { rc = SQLGetConnectOption(hdbc,(UWORD)ptoc_int(4),(PTR)&value); ctop_int(5,value); } if ((rc == SQL_SUCCESS) || (rc == SQL_SUCCESS_WITH_INFO)) ctop_int(6,0); else ctop_int(6,PrintErrorMsg(NULL)); }
static int odbc_dispatch11(void) { unsigned long retval; PWord rval; int rtype; PWord arg1; int type1; PWord arg2; int type2; PWord arg3; int type3; PWord arg4; int type4; PWord arg5; int type5; PI_getan(&arg1,&type1,1); if (type1 != PI_INT) if (!CI_get_integer((unsigned long *)&arg1,type1)) PI_FAIL; PI_getan(&arg2,&type2,2); if (type2 != PI_INT) if (!CI_get_integer((unsigned long *)&arg2,type2)) PI_FAIL; PI_getan(&arg3,&type3,3); if (type3 != PI_INT) if (!CI_get_integer((unsigned long *)&arg3,type3)) PI_FAIL; PI_getan(&arg4,&type4,4); if (type4 != PI_INT) if (!CI_get_integer((unsigned long *)&arg4,type4)) PI_FAIL; PI_getan(&arg5,&type5,5); switch(arg1) { case 0: retval = (unsigned long) SQLAllocHandleStd(((SQLSMALLINT ) arg2),((SQLHANDLE ) arg3),((SQLHANDLE * ) arg4)); break; case 1: retval = (unsigned long) SQLParamOptions(((SQLHSTMT ) arg2),((SQLUINTEGER ) arg3),((SQLUINTEGER * ) arg4)); break; case 2: retval = (unsigned long) SQLTransact(((SQLHENV ) arg2),((SQLHDBC ) arg3),((SQLUSMALLINT ) arg4)); break; case 3: retval = (unsigned long) SQLSetStmtOption(((SQLHSTMT ) arg2),((SQLUSMALLINT ) arg3),((SQLUINTEGER ) arg4)); break; case 4: retval = (unsigned long) SQLSetConnectOption(((SQLHDBC ) arg2),((SQLUSMALLINT ) arg3),((SQLUINTEGER ) arg4)); break; case 5: retval = (unsigned long) SQLPutData(((SQLHSTMT ) arg2),((SQLPOINTER ) arg3),((SQLINTEGER ) arg4)); break; case 6: retval = (unsigned long) SQLGetStmtOption(((SQLHSTMT ) arg2),((SQLUSMALLINT ) arg3),((SQLPOINTER ) arg4)); break; case 7: retval = (unsigned long) SQLGetFunctions(((SQLHDBC ) arg2),((SQLUSMALLINT ) arg3),((SQLUSMALLINT * ) arg4)); break; case 8: retval = (unsigned long) SQLGetConnectOption(((SQLHDBC ) arg2),((SQLUSMALLINT ) arg3),((SQLPOINTER ) arg4)); break; case 9: retval = (unsigned long) SQLFetchScroll(((SQLHSTMT ) arg2),((SQLSMALLINT ) arg3),((SQLINTEGER ) arg4)); break; case 10: retval = (unsigned long) SQLEndTran(((SQLSMALLINT ) arg2),((SQLHANDLE ) arg3),((SQLSMALLINT ) arg4)); break; case 11: retval = (unsigned long) SQLAllocHandle(((SQLSMALLINT ) arg2),((SQLHANDLE ) arg3),((SQLHANDLE * ) arg4)); break; default: PI_FAIL; } PI_makedouble(&rval,&rtype,(double) retval); if (PI_unify(arg5,type5,rval,rtype)) PI_SUCCEED; PI_FAIL; }