// DisplayAndClear - will display results after this many milliseconds. should be called regularly void AP_PerfMon::DisplayAndClear(uint32_t display_after_seconds) { if( (AP_HAL::micros() - allStartTime) > (uint32_t)(display_after_seconds * 1000000) ) { DisplayResults(); ClearAll(); } }
void ValidationResultsView::ValidateCurrentBook() { ClearResults(); std::vector< fc::Result > results; QApplication::setOverrideCursor( Qt::WaitCursor ); m_Book->SaveAllResourcesToDisk(); try { results = fc::ValidateEpubRootFolder( m_Book->GetFolderKeeper().GetFullPathToMainFolder().toUtf8().constData() ); } catch ( std::exception& exception ) { // TODO: extract boost exception info Utility::DisplayStdErrorDialog( tr( "An exception occurred during validation: %1." ) .arg( QString::fromStdString( exception.what() ) ) ); return; } QApplication::restoreOverrideCursor(); DisplayResults( results ); show(); }
void TcpClient::ReceiveResponse(const bool display) { // Receive whole response std::string response = ""; bool noError = true; const int bufferSize = sizeof(_buffer); do { memset(_buffer, 0, bufferSize); std::cout << "Receiving response part..." << std::endl; try { _recvCount = _socket.Recv(_buffer, bufferSize, NO_TIMEOUT); response += _buffer; if (_recvCount < bufferSize) _recvCount = 0; } catch (CBrokenSocketException) { std::cout << "Connection closed by remote host..." << std::endl; _recvCount = 0; noError = false; } } while (_recvCount > 0); if (noError) { _responses.push_back(response); DisplayResults(response); } }
bool DoDirect(HSTMT lpStmt, SQLCHAR* input) { RETCODE RetCode; SQLSMALLINT sNumResults; RetCode = SQLExecDirect(lpStmt, (SQLCHAR*) input, SQL_NTS); switch (RetCode) { case SQL_SUCCESS_WITH_INFO: { HandleError(lpStmt, SQL_HANDLE_STMT, RetCode); // fall through } case SQL_SUCCESS: { // If this is a row-returning query, display // results TRYODBC(lpStmt, SQL_HANDLE_STMT, SQLNumResultCols(lpStmt, &sNumResults)); if (sNumResults > 0) { DisplayResults(lpStmt, sNumResults); } else { SQLLEN siRowCount; TRYODBC(lpStmt, SQL_HANDLE_STMT, SQLRowCount(lpStmt, &siRowCount)); if (siRowCount >= 0) { _tprintf(TEXT("%ld %s affected\n"), static_cast<long>(siRowCount), siRowCount == 1 ? TEXT("row") : TEXT("rows")); } } break; } case SQL_ERROR: { _tprintf(TEXT("going to call handle error\n")); HandleError(lpStmt, SQL_HANDLE_STMT, RetCode); break; } default: fprintf(stderr, "Unexpected return code %d!\n", RetCode); } return true; Exit: return false; }
/* Main iterative loop */ void DoRad() { unsigned long shootPatch; while (FindShootPatch(&shootPatch)) { ComputeFormfactors(shootPatch); DistributeRad(shootPatch); DisplayResults(¶ms->displayView); } }
/* Initialize radiosity based on the input parameters p */ void InitRad(TRadParams *p) { int n; int hRes; unsigned long i; int j; TPatch* pp; TElement* ep; params = p; /* initialize hemi-cube */ hemicube.view.fovx = 90; hemicube.view.fovy = 90; /* make sure hemicube resolution is an even number */ hRes = ((int)(params->hemicubeRes/2.0+0.5))*2; hemicube.view.xRes = hemicube.view.yRes = hRes; n = hRes*hRes; hemicube.view.buffer = calloc(n, sizeof(unsigned long)); hemicube.view.wid=0; hemicube.view.near = params->worldSize*0.001; hemicube.view.far = params->worldSize; /* take advantage of the symmetry in the delta form-factors */ hemicube.topFactors= calloc(n/4, sizeof(double)); hemicube.sideFactors= calloc(n/4, sizeof(double)); MakeTopFactors(hRes/2, hemicube.topFactors); MakeSideFactors(hRes/2, hemicube.sideFactors); formfactors = calloc(params->nElements, sizeof(double)); /* initialize radiosity */ pp = params->patches; for (i=params->nPatches; i--; pp++) pp->unshotRad = *(pp->emission); ep = params->elements; for (i=params->nElements; i--; ep++) ep->rad = *(ep->patch->emission); /* compute total energy */ totalEnergy = 0; pp = params->patches; for (i=params->nPatches; i--; pp++) for (j=0; j<kNumberOfRadSamples; j++) totalEnergy += pp->emission->samples[j] * pp->area; DisplayResults(¶ms->displayView); }
int _tmain(int argc, _TCHAR* argv[]) { Game game; InitGame(game); while (!IsGameFinished(game)) { // Get game time game.t = timeGetTime(); GetUserInput(game); PerformAI(game); DrawGame(game); } DisplayResults(game); TerminateGame(game); return 0; }
bool DoPrepared(HDBC lpDbc, TCHAR* szInput) { int arrIdx = 0; RETCODE RetCode; SQLSMALLINT sNumResults; HSTMT lpStmt = NULL; TCHAR* szIter = szInput; int cnt = 0; TRYODBCP(lpDbc, SQL_HANDLE_DBC, SQLAllocHandle(SQL_HANDLE_STMT, lpDbc, &lpStmt)); RetCode = SQLPrepare(lpStmt, (SQLCHAR*) szInput, SQL_NTS); while (NULL != (szIter = strstr(szIter, "?"))) { ++cnt; ++szIter; } TCHAR szParams[MAX_PARAMS][SQL_QUERY_SIZE]; SQLLEN lenParams[MAX_PARAMS]; for (int sqlIdx = 1; sqlIdx <= cnt; ++sqlIdx) { arrIdx = sqlIdx - 1; _fgetts(szParams[arrIdx], SQL_QUERY_SIZE - 1, stdin); lenParams[arrIdx] = strlen(szParams[arrIdx]); szParams[arrIdx][lenParams[arrIdx]] = '\0'; lenParams[arrIdx] -= 1; TRYODBCP(lpStmt, SQL_HANDLE_STMT, SQLBindParameter(lpStmt, sqlIdx, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 255, 0, szParams[arrIdx], SQL_QUERY_SIZE, &lenParams[arrIdx])); } RetCode = SQLExecute(lpStmt); switch (RetCode) { case SQL_SUCCESS_WITH_INFO: { HandleError(lpStmt, SQL_HANDLE_STMT, RetCode); // fall through } case SQL_SUCCESS: { // If this is a row-returning query, display // results TRYODBCP(lpStmt, SQL_HANDLE_STMT, SQLNumResultCols(lpStmt, &sNumResults)); if (sNumResults > 0) { DisplayResults(lpStmt, sNumResults); } else { SQLLEN siRowCount; TRYODBCP(lpStmt, SQL_HANDLE_STMT, SQLRowCount(lpStmt, &siRowCount)); if (siRowCount >= 0) { _tprintf(TEXT("%ld %s affected\n"), static_cast<long>(siRowCount), siRowCount == 1 ? TEXT("row") : TEXT("rows")); } } break; } case SQL_ERROR: { HandleError(lpStmt, SQL_HANDLE_STMT, RetCode); break; } default: fprintf(stderr, "Unexpected return code %d!\n", RetCode); } SQLFreeStmt(lpStmt, SQL_DROP); return true; ExitP: return false; }
int main(int argc, char **argv) { SQLHENV hEnv = NULL; SQLHDBC hDbc = NULL; SQLHSTMT hStmt = NULL; char* pConnStr; char pQuery[1000]; bool silent = true; if (argc != 5) { fprintf(stderr, "Usage: %s <ConnString> <pkey range> <ccol range> <rand seed>\n", argv[0]); return 1; } pConnStr = argv[1]; char *endptr; long long numkeys = strtoll(argv[2], &endptr, 10); long long rowsperkey = strtoll(argv[3], &endptr, 10); int seed = atoi(argv[4]); struct drand48_data lcg; srand48_r(seed, &lcg); // Allocate an environment if (!silent) fprintf(stderr, "Allocating Handle Enviroment\n"); if (SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hEnv) == SQL_ERROR) { fprintf(stderr, "Unable to allocate an environment handle\n"); exit(-1); } // Register this as an application that expects 3.x behavior, // you must register something if you use AllocHandle if (!silent) fprintf(stderr, "Setting to ODBC3\n"); TRYODBC(hEnv, SQL_HANDLE_ENV, SQLSetEnvAttr(hEnv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0)); // Allocate a connection if (!silent) fprintf(stderr, "Allocating Handle\n"); TRYODBC(hEnv, SQL_HANDLE_ENV, SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDbc)); // Connect to the driver. Use the connection string if supplied // on the input, otherwise let the driver manager prompt for input. if (!silent) fprintf(stderr, "Connecting to driver\n"); TRYODBC(hDbc, SQL_HANDLE_DBC, SQLDriverConnect(hDbc, NULL, pConnStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE)); fprintf(stderr, "Connected!\n"); if (!silent) fprintf(stderr, "Allocating statement\n"); TRYODBC(hDbc, SQL_HANDLE_DBC, SQLAllocHandle(SQL_HANDLE_STMT, hDbc, &hStmt)); RETCODE RetCode; SQLSMALLINT sNumResults; // Execute the query if (!silent) fprintf(stderr, "Executing query\n"); long long i; double rval; for (i = 0; i < 100000; i++) { drand48_r(&lcg, &rval); sprintf(pQuery, "SELECT MAX(col1) FROM otest.test10 WHERE ccol = %lld", (long long)(rval * numkeys)); RetCode = SQLExecDirect(hStmt, pQuery, SQL_NTS); switch(RetCode) { case SQL_SUCCESS_WITH_INFO: { HandleDiagnosticRecord(hStmt, SQL_HANDLE_STMT, RetCode); // fall through } case SQL_SUCCESS: { // If this is a row-returning query, display // results TRYODBC(hStmt, SQL_HANDLE_STMT, SQLNumResultCols(hStmt,&sNumResults)); if (sNumResults > 0) { DisplayResults(hStmt,sNumResults, silent); } else { SQLLEN cRowCount; TRYODBC(hStmt, SQL_HANDLE_STMT, SQLRowCount(hStmt,&cRowCount)); if (cRowCount >= 0) { printf("%d %s returned\n", (int)cRowCount, (cRowCount == 1) ? "row" : "rows"); } } break; } case SQL_ERROR: { HandleDiagnosticRecord(hStmt, SQL_HANDLE_STMT, RetCode); break; } default: fprintf(stderr, "Unexpected return code %hd!\n", RetCode); } } TRYODBC(hStmt, SQL_HANDLE_STMT, SQLFreeStmt(hStmt, SQL_CLOSE)); Exit: // Free ODBC handles and exit if (hStmt) { SQLFreeHandle(SQL_HANDLE_STMT, hStmt); } if (hDbc) { SQLDisconnect(hDbc); SQLFreeHandle(SQL_HANDLE_DBC, hDbc); } if (hEnv) { SQLFreeHandle(SQL_HANDLE_ENV, hEnv); } return 0; }
bool CThreadMonitor::ListProcessThreads( DWORD dwOwnerPID ) { HANDLE hThreadSnap = INVALID_HANDLE_VALUE; THREADENTRY32 te32; // Take a snapshot of all running threads hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 ); if( hThreadSnap == INVALID_HANDLE_VALUE ) return( FALSE ); // Fill in the size of the structure before using it. te32.dwSize = sizeof(THREADENTRY32 ); // Retrieve information about the first thread, and exit if unsuccessful if( !Thread32First( hThreadSnap, &te32 ) ) { HandleError( _T("Thread32First") ); // Show cause of failure CloseHandle( hThreadSnap ); // Must clean up the snapshot object! return( FALSE ); } //Invalid all existing so we can remove exited threads m_InfoList.InvalidateAll(); // Now walk the thread list of the system, and display information //about each thread associated with the specified process CThreadInfo* pInfo = NULL; FILETIME ftCreation; FILETIME ftExit; FILETIME ftKernel; FILETIME ftUser; HANDLE hThread = NULL; BOOL bSuccess = false; DWORD dwError = 0; do { if( te32.th32OwnerProcessID == dwOwnerPID ) { hThread = OpenThread( THREAD_QUERY_INFORMATION , FALSE, te32.th32ThreadID); if ( hThread ) { bSuccess = ::GetThreadTimes( hThread, &ftCreation, &ftExit, &ftKernel, &ftUser ); CloseHandle( hThread ); if ( bSuccess ) { pInfo = CThreadInfo::Make( te32.th32ThreadID, ftCreation, ftExit, ftKernel, ftUser ); m_InfoList.Update( *pInfo ); delete pInfo; } else { dwError = GetLastError(); } } } } while( Thread32Next(hThreadSnap, &te32 ) ); CloseHandle( hThreadSnap ); DisplayResults(); return( TRUE ); }
int _tmain(int argc, TCHAR **argv) { SQLHENV lpEnv = NULL; SQLHDBC lpDbc = NULL; SQLHSTMT lpStmt = NULL; TCHAR *pszConnStr; TCHAR szInput[SQL_QUERY_SIZE]; // Allocate an environment if (SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&lpEnv) == SQL_ERROR) { fprintf(stderr,"Unable to allocate an environment handle\n"); exit(-1); } // Register this as an application that expects 2.x behavior, // you must register something if you use AllocHandle TRYODBC(lpEnv, SQL_HANDLE_ENV, SQLSetEnvAttr(lpEnv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC2, 0)); // Allocate a connection TRYODBC(lpEnv, SQL_HANDLE_ENV, SQLAllocHandle(SQL_HANDLE_DBC,lpEnv,&lpDbc)); if (argc > 1) { pszConnStr = *++argv; } else { pszConnStr = NULL; } // Connect to the driver. Use the connection string if supplied // on the input, otherwise let the driver manager prompt for input. TRYODBC(lpDbc, SQL_HANDLE_DBC, SQLDriverConnect(lpDbc, GetDesktopWindow(), pszConnStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE)); fprintf(stderr,"Connected!\n"); TRYODBC(lpDbc, SQL_HANDLE_DBC, SQLAllocHandle(SQL_HANDLE_STMT,lpDbc,&lpStmt)); printf("Enter SQL commands, type (control)Z to exit\nSQL COMMAND>"); // Loop to get input and execute queries while(_fgetts(szInput, SQL_QUERY_SIZE-1, stdin)) { RETCODE RetCode; SQLSMALLINT sNumResults; // Execute the query if (!(*szInput)) { printf("SQL COMMAND>"); continue; } RetCode = SQLExecDirect(lpStmt,szInput,SQL_NTS); switch(RetCode) { case SQL_SUCCESS_WITH_INFO: { HandleError(lpStmt,SQL_HANDLE_STMT,RetCode); // fall through } case SQL_SUCCESS: { // If this is a row-returning query, display // results TRYODBC(lpStmt, SQL_HANDLE_STMT, SQLNumResultCols(lpStmt,&sNumResults)); if (sNumResults > 0) { DisplayResults(lpStmt,sNumResults); } else { SQLLEN siRowCount; TRYODBC(lpStmt, SQL_HANDLE_STMT, SQLRowCount(lpStmt,&siRowCount)); if (siRowCount >= 0) { _tprintf(TEXT("%d %s affected\n"), siRowCount, siRowCount == 1 ? TEXT("row") : TEXT("rows")); } } break; } case SQL_ERROR: { HandleError(lpStmt,SQL_HANDLE_STMT,RetCode); break; } default: fprintf(stderr,"Unexpected return code %d!\n",RetCode); } TRYODBC(lpStmt, SQL_HANDLE_STMT, SQLFreeStmt(lpStmt,SQL_CLOSE)); printf("SQL COMMAND>"); } Exit: // Free ODBC handles and exit if (lpDbc) { SQLDisconnect(lpDbc); SQLFreeConnect(lpDbc); } if (lpEnv) SQLFreeEnv(lpEnv); printf("\nDisconnected."); return 0; }
int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_I2C1_Init(); MX_USART1_UART_Init(); MX_TIM16_Init(); MX_TIM17_Init(); /* USER CODE BEGIN 2 */ g_config = g_config_default; #ifdef USE_I2C g_i2c = I2cMaster_Init(&hi2c1); InitializeDisplay(g_i2c); I2cEEPROM_Init(&g_eeprom, g_i2c, EEPROMADDR, 1, 8); #endif #ifdef USE_SERIAL UsartInit(&huart1); #endif #if defined(USE_I2C) && defined(USE_LCD) I2cLcd_Clear(&g_lcd); I2cLcd_PrintStr(&g_lcd, "Hello"); #endif #if defined(USE_SERIAL) && defined(USE_EEPROM) #define TESTSIZE 2048/8 HAL_StatusTypeDef st; uint8_t i2cBuffer[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* for(uint16_t i = 0; i < TESTSIZE; i += sizeof(i2cBuffer)) { if(!(i & (sizeof(i2cBuffer)-1))) { st = I2cEEPROM_Write(&g_eeprom, i, i2cBuffer, sizeof(i2cBuffer)); } } for (uint16_t i = 0; i < TESTSIZE; ++i) { if(!(i & (sizeof(i2cBuffer)-1))) { st = I2cEEPROM_Read(&g_eeprom, i, i2cBuffer, sizeof(i2cBuffer)); UsartSendStr("\r\n", 1); UsartPrintUint(i, 4, 1); UsartSendStr(" ", 1); } UsartPrintByte(i2cBuffer[i&(sizeof(i2cBuffer)-1)], 2, 1); UsartSendStr(" ", 1); } UsartSendStr("\r\n", 1); for(uint16_t i = 0; i < TESTSIZE; i += sizeof(i2cBuffer)) { if(!(i & (sizeof(i2cBuffer)-1))) { for(uint16_t j = 0; j<sizeof(i2cBuffer); ++j) i2cBuffer[j] = i+j; st = I2cEEPROM_Write(&g_eeprom, i, i2cBuffer, sizeof(i2cBuffer)); } } for (uint16_t i = 0; i < TESTSIZE; ++i) { if(!(i & (sizeof(i2cBuffer)-1))) { st = I2cEEPROM_Read(&g_eeprom, i, i2cBuffer, sizeof(i2cBuffer)); UsartSendStr("\r\n", 1); UsartPrintUint(i, 4, 1); UsartSendStr(" ", 1); } UsartPrintByte(i2cBuffer[i&(sizeof(i2cBuffer)-1)], 2, 1); UsartSendStr(" ", 1); } UsartSendStr("\r\n", 1); */ { LIVECONFIG config; if (I2cEEPROM_Read(&g_eeprom, EESTART, &config, sizeof(config)) == HAL_OK) { I2cMaster_WaitCallback(g_i2c); if (config.magic == 0xA5) g_config = config; } } for (uint16_t i = 0; i < TESTSIZE; ++i) { if(!(i & (sizeof(i2cBuffer)-1))) { st = I2cEEPROM_Read(&g_eeprom, i, i2cBuffer, sizeof(i2cBuffer)); UsartSendStr("\r\n", 1); UsartPrintUint(i, 4, 1); UsartSendStr(" ", 1); } UsartPrintByte(i2cBuffer[i&(sizeof(i2cBuffer)-1)], 2, 1); UsartSendStr(" ", 1); } UsartSendStr("\r\n", 1); #endif HAL_TIM_IC_Start_IT(&htim16, TIM_CHANNEL_1); HAL_TIM_IC_Start_IT(&htim17, TIM_CHANNEL_1); HAL_UART_Receive_IT(&huart1, g_lineBuffer, sizeof(g_lineBuffer)); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { if (g_lineReceived) { ProcessInput(&g_config, (char*) g_lineBuffer); //DisplayInput(&i2clcd); g_lineReceived = 0; HAL_UART_Receive_IT(&huart1, g_lineBuffer, sizeof(g_lineBuffer)); } if(g_statuses[0].trigger) { DisplayResults(0); g_statuses[0].trigger = 0; } if(g_statuses[1].trigger) { DisplayResults(1); g_statuses[1].trigger = 0; } /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ }
//int __cdecl wmain(int argc, _In_reads_(argc) WCHAR **argv) //int __cdecl wmain(int argc, WCHAR **argv) int __cdecl wmain2(int argc, WCHAR **argv) { SQLHENV hEnv = NULL; SQLHDBC hDbc = NULL; SQLHSTMT hStmt = NULL; WCHAR* pwszConnStr; WCHAR wszInput[SQL_QUERY_SIZE]; // Allocate an environment if (SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hEnv) == SQL_ERROR) { fwprintf(stderr, L"Unable to allocate an environment handle\n"); exit(-1); } // Register this as an application that expects 3.x behavior, // you must register something if you use AllocHandle TRYODBC(hEnv, SQL_HANDLE_ENV, SQLSetEnvAttr(hEnv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0)); // Allocate a connection TRYODBC(hEnv, SQL_HANDLE_ENV, SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDbc)); if (argc > 1) { pwszConnStr = *++argv; } else { pwszConnStr = L""; } // Connect to the driver. Use the connection string if supplied // on the input, otherwise let the driver manager prompt for input. TRYODBC(hDbc, SQL_HANDLE_DBC, SQLDriverConnect(hDbc, GetDesktopWindow(), pwszConnStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE)); fwprintf(stderr, L"Connected!\n"); TRYODBC(hDbc, SQL_HANDLE_DBC, SQLAllocHandle(SQL_HANDLE_STMT, hDbc, &hStmt)); wprintf(L"Enter SQL commands, type (control)Z to exit\nSQL COMMAND>"); // Loop to get input and execute queries while(_fgetts(wszInput, SQL_QUERY_SIZE-1, stdin)) { RETCODE RetCode; SQLSMALLINT sNumResults; // Execute the query if (!(*wszInput)) { wprintf(L"SQL COMMAND>"); continue; } RetCode = SQLExecDirect(hStmt,wszInput, SQL_NTS); switch(RetCode) { case SQL_SUCCESS_WITH_INFO: { HandleDiagnosticRecord(hStmt, SQL_HANDLE_STMT, RetCode); // fall through } case SQL_SUCCESS: { // If this is a row-returning query, display // results TRYODBC(hStmt, SQL_HANDLE_STMT, SQLNumResultCols(hStmt,&sNumResults)); if (sNumResults > 0) { DisplayResults(hStmt,sNumResults); } else { SQLLEN cRowCount; TRYODBC(hStmt, SQL_HANDLE_STMT, SQLRowCount(hStmt,&cRowCount)); if (cRowCount >= 0) { wprintf(L"%Id %s affected\n", cRowCount, cRowCount == 1 ? L"row" : L"rows"); } } break; } case SQL_ERROR: { HandleDiagnosticRecord(hStmt, SQL_HANDLE_STMT, RetCode); break; } default: fwprintf(stderr, L"Unexpected return code %hd!\n", RetCode); } TRYODBC(hStmt, SQL_HANDLE_STMT, SQLFreeStmt(hStmt, SQL_CLOSE)); wprintf(L"SQL COMMAND>"); } Exit: // Free ODBC handles and exit if (hStmt) { SQLFreeHandle(SQL_HANDLE_STMT, hStmt); } if (hDbc) { SQLDisconnect(hDbc); SQLFreeHandle(SQL_HANDLE_DBC, hDbc); } if (hEnv) { SQLFreeHandle(SQL_HANDLE_ENV, hEnv); } wprintf(L"\nDisconnected."); return 0; }