bool SqliteResultSet::Next() { if (m_pSqliteStatement == NULL) m_pSqliteStatement = m_pStatement->GetLastStatement(); int nReturn = sqlite3_step(m_pSqliteStatement); if (nReturn != SQLITE_ROW) sqlite3_reset(m_pSqliteStatement); if ((nReturn != SQLITE_ROW) && (nReturn != SQLITE_DONE)) { wxLogError(_("Error with RunQueryWithResults\n")); SetErrorCode(SqliteDatabaseLayer::TranslateErrorCode(nReturn)); #if SQLITE_VERSION_NUMBER>=3002002 // sqlite3_db_handle wasn't added to the SQLite3 API until version 3.2.2 SetErrorMessage(ConvertFromUnicodeStream(sqlite3_errmsg(sqlite3_db_handle(m_pSqliteStatement)))); #else SetErrorMessage(_("Unknown error advancing result set")); #endif ThrowDatabaseException(); return false; } return (nReturn == SQLITE_ROW); }
void DecodeBufferWorker::Execute () { CImg<unsigned char> * img = NULL; string err; char * metadata = NULL; err = _decoder(_buffer, _buffsize, &img, &metadata); if (img == NULL) { SetErrorMessage(err.c_str()); return; } _trans = img->spectrum() == 2 || img->spectrum() == 4; err = toRGBA(&img); if (err != "") { if (img) delete img; SetErrorMessage(err.c_str()); return; } img->_is_shared = true; // don't free image data. need it for callback. _pixbuf = img->data(); _width = img->width(); _height = img->height(); _channels = 4; _metadata = metadata; delete img; return; }
wxDatabaseResultSet* wxMysqlPreparedStatementWrapper::RunQueryWithResults() { wxMysqlPreparedStatementResultSet* pResultSet = NULL; MYSQL_BIND* pBoundParameters = m_Parameters.GetMysqlParameterBindings(); if (m_pInterface->GetMysqlStmtBindParam()(m_pStatement, pBoundParameters)) { SetErrorCode(wxMysqlDatabase::TranslateErrorCode(m_pInterface->GetMysqlStmtErrno()(m_pStatement))); SetErrorMessage(ConvertFromUnicodeStream(m_pInterface->GetMysqlStmtError()(m_pStatement))); wxDELETEA(pBoundParameters); ThrowDatabaseException(); return NULL; } else { if (m_pInterface->GetMysqlStmtExecute()(m_pStatement) != 0) { SetErrorCode(wxMysqlDatabase::TranslateErrorCode(m_pInterface->GetMysqlStmtErrno()(m_pStatement))); SetErrorMessage(ConvertFromUnicodeStream(m_pInterface->GetMysqlStmtError()(m_pStatement))); wxDELETEA(pBoundParameters); ThrowDatabaseException(); return NULL; } else { pResultSet = new wxMysqlPreparedStatementResultSet(m_pInterface, m_pStatement); if (pResultSet) pResultSet->SetEncoding(GetEncoding()); } } wxDELETEA(pBoundParameters);; return pResultSet; }
DatabaseResultSet* PostgresPreparedStatement::RunQueryWithResults() { for (unsigned int i=0; i<(m_Statements.size()-1); i++) { m_Statements[i].RunQuery(); if (m_Statements[i].GetErrorCode() != DATABASE_LAYER_OK) { SetErrorCode(m_Statements[i].GetErrorCode()); SetErrorMessage(m_Statements[i].GetErrorMessage()); ThrowDatabaseException(); return NULL; } } PostgresPreparedStatementWrapper* pLastStatement = &(m_Statements[m_Statements.size()-1]); DatabaseResultSet* pResultSet = pLastStatement->RunQueryWithResults(); if (pLastStatement->GetErrorCode() != DATABASE_LAYER_OK) { SetErrorCode(pLastStatement->GetErrorCode()); SetErrorMessage(pLastStatement->GetErrorMessage()); ThrowDatabaseException(); } LogResultSetForCleanup(pResultSet); return pResultSet; }
int wxMysqlPreparedStatementWrapper::RunQuery() { MYSQL_BIND* pBoundParameters = m_Parameters.GetMysqlParameterBindings(); int nBindReturn = m_pInterface->GetMysqlStmtBindParam()(m_pStatement, pBoundParameters); if (nBindReturn != 0) { SetErrorCode(wxMysqlDatabase::TranslateErrorCode(m_pInterface->GetMysqlStmtErrno()(m_pStatement))); SetErrorMessage(ConvertFromUnicodeStream(m_pInterface->GetMysqlStmtError()(m_pStatement))); wxDELETEA(pBoundParameters); ThrowDatabaseException(); return wxDATABASE_QUERY_RESULT_ERROR; } else { int nReturn = m_pInterface->GetMysqlStmtExecute()(m_pStatement); if (nReturn != 0) { SetErrorCode(wxMysqlDatabase::TranslateErrorCode(m_pInterface->GetMysqlStmtErrno()(m_pStatement))); SetErrorMessage(ConvertFromUnicodeStream(m_pInterface->GetMysqlStmtError()(m_pStatement))); wxDELETEA(pBoundParameters); ThrowDatabaseException(); return wxDATABASE_QUERY_RESULT_ERROR; } } wxDELETEA(pBoundParameters); return m_pInterface->GetMysqlStmtAffectedRows()(m_pStatement); }
BOOL RMA::Parse( const SENTENCE& sentence ) { ASSERT_VALID( this ); /* ** RMA - Recommended Minimum Navigation Information ** 12 ** 1 2 3 4 5 6 7 8 9 10 11| ** | | | | | | | | | | | | ** $--RMA,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,x.x,x.x,a*hh<CR><LF> ** ** Field Number: ** 1) Blink Warning ** 2) Latitude ** 3) N or S ** 4) Longitude ** 5) E or W ** 6) Time Difference A, uS ** 7) Time Difference B, uS ** 8) Speed Over Ground, Knots ** 9) Track Made Good, degrees true ** 10) Magnetic Variation, degrees ** 11) E or W ** 12) Checksum */ /* ** First we check the checksum... */ NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 12 ); if ( check == True ) { SetErrorMessage( "Invalid Checksum" ); return( FALSE ); } if ( check == Unknown ) { SetErrorMessage( "Missing Checksum" ); return( FALSE ); } IsDataValid = sentence.Boolean( 1 ); Position.Parse( 2, 3, 4, 5, sentence ); TimeDifferenceA = sentence.Double( 6 ); TimeDifferenceB = sentence.Double( 7 ); SpeedOverGroundKnots = sentence.Double( 8 ); TrackMadeGoodDegreesTrue = sentence.Double( 9 ); MagneticVariation = sentence.Double( 10 ); MagneticVariationDirection = sentence.EastOrWest( 11 ); return( TRUE ); }
HRESULT CAviFile::AppendAudioData(WAVEFORMATEX *wfx, void *dat, unsigned long numbytes) { if (dat == NULL || numbytes == 0) { return AVIERR_BADPARAM; } if (wfx->nChannels == 0) { return AVIERR_BADFORMAT; } unsigned long numsamps = numbytes * 8 / wfx->wBitsPerSample; if ((numsamps * wfx->wBitsPerSample / 8) != numbytes) { return AVIERR_BADPARAM; } if (m_pAviAudioStream == NULL) // create the stream if necessary { if (m_pAviFile == NULL) { return S_OK; } AVISTREAMINFO ahdr; ZeroMemory(&ahdr, sizeof(ahdr)); ahdr.fccType = streamtypeAUDIO; ahdr.dwScale = wfx->nBlockAlign; ahdr.dwRate = wfx->nSamplesPerSec * wfx->nBlockAlign; ahdr.dwSampleSize = wfx->nBlockAlign; ahdr.dwQuality = (DWORD)-1; HRESULT hr = AVIFileCreateStream(m_pAviFile, &m_pAviAudioStream, &ahdr); if (hr != AVIERR_OK) { SetErrorMessage(_T("Unable to create audio stream")); return E_FAIL; } hr = AVIStreamSetFormat(m_pAviAudioStream, m_lVSample, wfx, sizeof(WAVEFORMATEX) + wfx->cbSize); if (hr != AVIERR_OK) { SetErrorMessage(_T("Unable to set audio stream format")); return E_FAIL; } } HRESULT hr = AVIStreamWrite(m_pAviAudioStream, m_lASample, numsamps, dat, numbytes, 0, NULL, NULL); if (hr != AVIERR_OK) { SetErrorMessage(_T("Unable to Write Audio Stream to the output Movie File")); return E_FAIL; } m_lASample += numsamps; return S_OK; }
static void create() { verb::create(); SetVerb("ask"); SetRules("LIV STR", "STR", "LIV to STR", "LIV for STR", "LIV about STR"); if(GUEST_CHECK == "guest") SetErrorMessage("You can't do that."); else SetErrorMessage("Ask what? Or ask whom to do what?"); SetHelp("Syntax: ask <LIVING> <SOMETHING>\n" " ask <SOMETHING>\n" " ask <LIVING> about <SOMETHING>\n" " ask <LIVING> to <DO SOMETHING>\n" " ask <LIVING> for <SOMETHING>\n\n" "Some npcs and perhaps some inanimate objects will respond " "when you query the target with a specific question.\n" "See also: reply, say, shout, speak, tell, whisper, yell"); }
void Job::Execute() { try { ExecuteNativeCode(); } catch (cv::Exception& exc) { SetErrorMessage(exc.what()); } catch (std::runtime_error& e) { SetErrorMessage(e.what()); } }
BOOL STN::Parse( const SENTENCE& sentence ) { ASSERT_VALID( this ); /* ** STN - Multiple Data ID ** ** 1 2 ** | | ** $--STN,x.x,*hh<CR><LF> ** ** Field Number: ** 1) Talker ID Number ** 2) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 2 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( FALSE ); } TalkerIDNumber = sentence.Integer( 1 ); return( TRUE ); }
wxDatabaseResultSet* wxSqlitePreparedStatement::RunQueryWithResults() { ResetErrorCodes(); if (m_Statements.size() > 1) { for (unsigned int i=0; i<m_Statements.size()-1; i++) { int nReturn = sqlite3_step(m_Statements[i]); if (nReturn != SQLITE_ROW) sqlite3_reset(m_Statements[i]); if ((nReturn != SQLITE_ROW) && (nReturn != SQLITE_DONE)) { wxLogError(_("Error with RunQueryWithResults\n")); SetErrorCode(wxSqliteDatabase::TranslateErrorCode(nReturn)); SetErrorMessage(ConvertFromUnicodeStream(sqlite3_errmsg(m_pDatabase))); ThrowDatabaseException(); return NULL; } } } // Work off the assumption that only the last statement will return result wxSqliteResultSet* pResultSet = new wxSqliteResultSet(this); if (pResultSet) pResultSet->SetEncoding(GetEncoding()); LogResultSetForCleanup(pResultSet); return pResultSet; }
HRESULT CAviFile::AppendFrameUsual(HBITMAP hBitmap, int Count) { BITMAPINFO bmpInfo; bmpInfo.bmiHeader.biBitCount=0; bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); GetDIBits(m_hAviDC,hBitmap,0,0,NULL,&bmpInfo,DIB_RGB_COLORS); bmpInfo.bmiHeader.biCompression=BI_RGB; GetDIBits(m_hAviDC,hBitmap,0,bmpInfo.bmiHeader.biHeight,m_lpBits,&bmpInfo,DIB_RGB_COLORS); while( Count > 0 ) { if(FAILED(AVIStreamWrite(m_pAviCompressedStream,m_lSample++,1,m_lpBits,bmpInfo.bmiHeader.biSizeImage,0,NULL,NULL))) { SetErrorMessage(_T("Unable to Write Video Stream to the output Movie File")); ReleaseMemory(); m_LastError = E_FAIL; return E_FAIL; } --Count; } return S_OK; }
// query database int wxPostgresDatabase::RunQuery(const wxString& strQuery, bool WXUNUSED(bParseQuery)) { // PostgreSQL takes care of parsing the queries itself so bParseQuery is ignored ResetErrorCodes(); wxCharBuffer sqlBuffer = ConvertToUnicodeStream(strQuery); PGresult* pResultCode = m_pInterface->GetPQexec()((PGconn*)m_pDatabase, sqlBuffer); if ((pResultCode == NULL) || (m_pInterface->GetPQresultStatus()(pResultCode) != PGRES_COMMAND_OK)) { SetErrorCode(wxPostgresDatabase::TranslateErrorCode(m_pInterface->GetPQresultStatus()(pResultCode))); SetErrorMessage(ConvertFromUnicodeStream(m_pInterface->GetPQerrorMessage()((PGconn*)m_pDatabase))); m_pInterface->GetPQclear()(pResultCode); ThrowDatabaseException(); return wxDATABASE_QUERY_RESULT_ERROR; } else { wxString rowsAffected = ConvertFromUnicodeStream(m_pInterface->GetPQcmdTuples()(pResultCode)); long rows = -1; rowsAffected.ToLong(&rows); m_pInterface->GetPQclear()(pResultCode); return (int)rows; } }
BOOL HSC::Parse( const SENTENCE& sentence ) { ASSERT_VALID( this ); /* ** HSC - Heading Steering Command ** ** 1 2 3 4 5 ** | | | | | ** $--HSC,x.x,T,x.x,M,*hh<CR><LF> ** ** Field Number: ** 1) Heading Degrees, True ** 2) T = True ** 3) Heading Degrees, Magnetic ** 4) M = Magnetic ** 5) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 5 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( FALSE ); } DegreesTrue = sentence.Double( 1 ); DegreesMagnetic = sentence.Double( 3 ); return( TRUE ); }
wxMysqlPreparedStatementParameter::wxMysqlPreparedStatementParameter(MYSQL_BIND* pBind, MYSQL_FIELD* pField) : wxDatabaseErrorReporter() { m_pBind = pBind; m_pBind->is_null = &m_bIsNull; // Set the binding properties m_pBind->buffer_type = pField->type; m_pBind->buffer_length = pField->length + 1; //int nType = m_pBind->buffer_type; //if (nType == MYSQL_TYPE_STRING || nType == MYSQL_TYPE_VAR_STRING || nType == MYSQL_TYPE_BLOB // || nType == MYSQL_TYPE_TINY_BLOB || nType == MYSQL_TYPE_MEDIUM_BLOB || nType == MYSQL_TYPE_LONG_BLOB) //{ //wxLogDebug(_("Allocating %ld bytes in the MYSQL_BIND buffer\n"), pField->length); void* pBuffer = m_Data.bufferValue.GetWriteBuf(m_pBind->buffer_length); if (pBuffer == 0) { SetErrorCode(wxMysqlDatabase::TranslateErrorCode(0)); SetErrorMessage(_("Error allocating buffer")); ThrowDatabaseException(); } m_pBind->buffer = pBuffer; ClearBuffer(); // } // else // { // pCurrentBinding->buffer = malloc(1); // } int nType = m_pBind->buffer_type; if (nType == MYSQL_TYPE_BLOB || nType == MYSQL_TYPE_TINY_BLOB || nType == MYSQL_TYPE_MEDIUM_BLOB || nType == MYSQL_TYPE_LONG_BLOB) m_pBind->length = &m_Data.nBufferLength; }
bool HDM::Parse( const SENTENCE& sentence ) { /* ** HDM - Heading - Magnetic ** ** 1 2 3 ** | | | ** $--HDM,x.x,M*hh<CR><LF> ** ** Field Number: ** 1) Heading Degrees, Magnetic ** 2) M = Magnetic ** 3) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 3 ) == TRUE ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } DegreesMagnetic = sentence.Double( 1 ); return( TRUE ); }
bool GTD::Parse( const SENTENCE& sentence ) { /* ** GTD - Geographical Position, Loran-C TDs ** ** 1 2 3 4 5 6 ** | | | | | | ** $--GTD,x.x,x.x,x.x,x,x,x.x*hh<CR><LF> ** ** 1) Time Difference 1 Microseconds ** 2) Time Difference 2 Microseconds ** 3) Time Difference 3 Microseconds ** 4) Time Difference 4 Microseconds ** 5) Time Difference 5 Microseconds ** 6) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 6 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } TimeDifference1 = sentence.Field( 1 ); TimeDifference2 = sentence.Field( 2 ); TimeDifference3 = sentence.Field( 3 ); TimeDifference4 = sentence.Field( 4 ); TimeDifference5 = sentence.Field( 5 ); return( true ); }
bool TEP::Parse( const SENTENCE& sentence ) { /* ** TEP - TRANSIT Satellite Predicted Elevation ** ** 1 2 3 ** | | | ** $--TEP,x.x,T*hh<CR><LF> ** ** Field Number: ** 1) Elevation degrees ** 2) D = Degrees ** 3) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 3 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } ElevationDegrees = sentence.Double( 1 ); return( true ); }
bool GPWPL::Parse( const SENTENCE& sentence ) { /* ** WPL - Waypoint Location ** ** +-------------------------------- 1) Latitude ** | +------------------------ 2) N or S (North or South) ** | | +---------------------- 3) Longitude ** | | | +------------- 4) E or W (East or West) ** | | | | +----------- 5) Waypoint name ** | | | | | +-------6) Checksum ** | | | | | | ** $--WPL,llll.ll,a,yyyyy.yy,a,c--c*hh<CR><LF> */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 6 ) == NTrue ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } Position.Parse( 1, 2, 3, 4, sentence ); To = sentence.Field( 5 ); return( TRUE ); }
bool VPW::Parse( const SENTENCE& sentence ) { /* ** VPW - Speed - Measured Parallel to Wind ** ** 1 2 3 4 5 ** | | | | | ** $--VPW,x.x,N,x.x,M*hh<CR><LF> ** ** Field Number: ** 1) Speed, "-" means downwind ** 2) N = Knots ** 3) Speed, "-" means downwind ** 4) M = Meters per second ** 5) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 5 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } Knots = sentence.Double( 1 ); MetersPerSecond = sentence.Double( 3 ); return( true ); }
bool RMB::Parse( const SENTENCE& sentence ) { /* ** RMB - Recommended Minimum Navigation Information ** 14 ** 1 2 3 4 5 6 7 8 9 10 11 12 13| ** | | | | | | | | | | | | | | ** $--RMB,A,x.x,a,c--c,c--c,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,A*hh<CR><LF> ** ** Field Number: ** 1) Status, V = Navigation receiver warning ** 2) Cross Track error - nautical miles ** 3) Direction to Steer, Left or Right ** 4) TO Waypoint ID ** 5) FROM Waypoint ID ** 6) Destination Waypoint Latitude ** 7) N or S ** 8) Destination Waypoint Longitude ** 9) E or W ** 10) Range to destination in nautical miles ** 11) Bearing to destination in degrees True ** 12) Destination closing velocity in knots ** 13) Arrival Status, A = Arrival Circle Entered ** 14) Checksum */ /* ** First we check the checksum... */ NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 14 ); if ( check == NTrue ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } /* if ( check == Unknown0183 ) { SetErrorMessage( _T("Missing Checksum") ); return( FALSE ); } */ IsDataValid = sentence.Boolean( 1 ); CrossTrackError = sentence.Double( 2 ); DirectionToSteer = sentence.LeftOrRight( 3 ); From = sentence.Field( 4 ); To = sentence.Field( 5 ); DestinationPosition.Parse( 6, 7, 8, 9, sentence ); RangeToDestinationNauticalMiles = sentence.Double( 10 ); BearingToDestinationDegreesTrue = sentence.Double( 11 ); DestinationClosingVelocityKnots = sentence.Double( 12 ); IsArrivalCircleEntered = sentence.Boolean( 13 ); return( TRUE ); }
int wxOdbcDatabase::RunQuery( const wxString& strQuery, bool bParseQuery ) { ResetErrorCodes(); //wxPrintf("Running: '%s'\n", strQuery.c_str()); wxOdbcPreparedStatement* pStatement = (wxOdbcPreparedStatement*)PrepareStatement( strQuery, bParseQuery ); if ( pStatement ) { try { int nRows = pStatement->RunQuery(); wxDELETE( pStatement ); return nRows; } catch (...) { SetErrorCode(pStatement->GetErrorCode()); SetErrorMessage(pStatement->GetErrorMessage()); wxDELETE( pStatement ); ThrowDatabaseException(); return wxDATABASE_QUERY_RESULT_ERROR; } } else return wxDATABASE_QUERY_RESULT_ERROR; }
bool MTW::Parse( const SENTENCE& sentence ) { // ASSERT_VALID( this ); /* ** MTW - Water Temperature ** ** 1 2 3 ** | | | ** $--MTW,x.x,C*hh<CR><LF> ** ** Field Number: ** 1) Degrees ** 2) Unit of Measurement, Celcius ** 3) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 3 ) == TRUE ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } Temperature = sentence.Double( 1 ); UnitOfMeasurement = sentence.Field( 2 ); return( TRUE ); }
//void wxOdbcDatabase::InterpretErrorCodes( long nCode, SQLHSTMT stmth_ptr ) void wxOdbcDatabase::InterpretErrorCodes( long WXUNUSED(nCode), void* stmth_ptr ) { wxLogDebug(_("wxOdbcDatabase::InterpretErrorCodes()\n")); //if ((nCode != SQL_SUCCESS) ) // && (nCode != SQL_SUCCESS_WITH_INFO)) //{ SQLINTEGER iNativeCode; SQLTCHAR strState[ERR_STATE_LEN]; SQLTCHAR strBuffer[ERR_BUFFER_LEN]; SQLSMALLINT iMsgLen; memset(strState, 0, ERR_STATE_LEN*sizeof(SQLTCHAR)); memset(strBuffer, 0, ERR_BUFFER_LEN*sizeof(SQLTCHAR)); if (stmth_ptr) m_pInterface->GetSQLGetDiagRec()(SQL_HANDLE_STMT, (SQLHSTMT)stmth_ptr, 1, strState, &iNativeCode, strBuffer, ERR_BUFFER_LEN, &iMsgLen); else m_pInterface->GetSQLGetDiagRec()(SQL_HANDLE_DBC, (SQLHDBC)m_sqlHDBC, 1, strState, &iNativeCode, strBuffer, ERR_BUFFER_LEN, &iMsgLen); SetErrorCode((int)iNativeCode); SetErrorMessage(ConvertFromUnicodeStream((char*)strBuffer)); //AML //AML SetErrorMessage(wxString((wxChar*)strBuffer)); //} }
bool WDR::Parse( const SENTENCE& sentence ) { /* ** WDR - Distance to Waypoint, Rhumb Line ** ** 1 2 3 4 ** | | | | ** $--WDR,x.x,N,c--c*hh<CR><LF> ** ** 1) Distance to waypoint ** 2) N = Nautical Miles ** 3) Waypoint ID (To) ** 4) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 4 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } NauticalMiles = sentence.Double( 1 ); To = sentence.Field( 3 ); return( true ); }
int wxSqlitePreparedStatement::RunQuery() { ResetErrorCodes(); wxSqliteStatementVector::iterator start = m_Statements.begin(); wxSqliteStatementVector::iterator stop = m_Statements.end(); while (start != stop) { int nReturn = sqlite3_step((sqlite3_stmt*)(*start)); if (nReturn != SQLITE_ROW) sqlite3_reset((sqlite3_stmt*)(*start)); if ((nReturn != SQLITE_ROW) && (nReturn != SQLITE_DONE)) { SetErrorCode(wxSqliteDatabase::TranslateErrorCode(nReturn)); SetErrorMessage(ConvertFromUnicodeStream(sqlite3_errmsg(m_pDatabase))); ThrowDatabaseException(); return wxDATABASE_QUERY_RESULT_ERROR; } start++; } return sqlite3_changes(m_pDatabase); }
wxDatabaseResultSet* wxOdbcDatabase::RunQueryWithResults(const wxString& strQuery) { ResetErrorCodes(); wxOdbcPreparedStatement* pStatement = (wxOdbcPreparedStatement*)PrepareStatement( strQuery, true ); if ( pStatement ) { try { pStatement->SetOneTimer(true); wxDatabaseResultSet* pResults = pStatement->RunQueryWithResults(false /*false for "Don't log this result set for cleanup*/); LogResultSetForCleanup(pResults); return pResults; } catch (...) { SetErrorCode(pStatement->GetErrorCode()); SetErrorMessage(pStatement->GetErrorMessage()); wxDELETE( pStatement ); ThrowDatabaseException(); return NULL; } } else return NULL; }
// query database int OTLDatabaseLayer::RunQuery(const wxString& strQuery, bool bParseQuery) { try { wxArrayString QueryArray; if (bParseQuery) QueryArray = ParseQueries(strQuery); else QueryArray.push_back(strQuery); wxArrayString::iterator start = QueryArray.begin(); wxArrayString::iterator stop = QueryArray.end(); while (start != stop) { wxCharBuffer sqlBuffer = ConvertToUnicodeStream((*start)); std::string strSQL(sqlBuffer); strSQL = RemoveLastSemiColon(strSQL); //wxPrintf(_("RunQuery: '%s'\n"), strSQL.c_str()); otl_stream otlStream(1,strSQL.c_str(),m_database); start++; } } catch (otl_exception& e) { SetErrorCode(OTLDatabaseLayer::TranslateErrorCode(e.code)); SetErrorMessage(ConvertFromUnicodeStream((char*)e.msg)); ThrowDatabaseException(); return false; } return true; }
BOOL ZTG::Parse( const SENTENCE& sentence ) { ASSERT_VALID( this ); /* ** ZTG - UTC & Time to Destination Waypoint ** ** 1 2 3 4 ** | | | | ** $--ZTG,hhmmss.ss,hhmmss.ss,c--c*hh<CR><LF> ** ** Fields: ** 1) Universal Time Coordinated (UTC) ** 2) Time Remaining ** 3) Destination Waypoint ID ** 4) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 4 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( FALSE ); } UTCTime = sentence.Field( 1 ); TimeRemaining = sentence.Field( 2 ); To = sentence.Field( 3 ); return( TRUE ); }
bool BEC::Parse( const SENTENCE& sentence ) { /* ** BEC - Bearing & Distance to Waypoint - Dead Reckoning ** 12 ** 1 2 3 4 5 6 7 8 9 10 11| 13 ** | | | | | | | | | | | | | ** $--BEC,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c*hh<CR><LF> */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 13 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } UTCTime = sentence.Field( 1 ); Time = sentence.Time( 1 ); Position.Parse( 2, 3, 4, 5, sentence ); BearingTrue = sentence.Double( 6 ); BearingMagnetic = sentence.Double( 8 ); DistanceNauticalMiles = sentence.Double( 10 ); To = sentence.Field( 12 ); return( true ); }