private void parseQueryResponse ( boolean lastChunk ) { if ( sectionDone || queryParsingState == QUERY_STATE_INITIAL ) { queryParsingState = transitionToNextToken ( lastChunk ) ; } if ( queryParsingState == QUERY_STATE_SIGNATURE ) { parseQuerySignature ( lastChunk ) ; } if ( queryParsingState == QUERY_STATE_ROWS_DECIDE ) { decideBetweenRawAndObjects ( lastChunk ) ; } if ( queryParsingState == QUERY_STATE_ROWS ) { parseQueryRows ( lastChunk ) ; } else if ( queryParsingState == QUERY_STATE_ROWS_RAW ) { parseQueryRowsRaw ( lastChunk ) ; } if ( queryParsingState == QUERY_STATE_ERROR ) { parseQueryError ( lastChunk ) ; } if ( queryParsingState == QUERY_STATE_WARNING ) { parseQueryError ( lastChunk ) ; //warning are treated the same as errors -> sent to errorObservable } if ( queryParsingState == QUERY_STATE_STATUS ) { parseQueryStatus ( lastChunk ) ; } if ( queryParsingState == QUERY_STATE_INFO ) { parseQueryInfo ( lastChunk ) ; } else if ( queryParsingState == QUERY_STATE_NO_INFO ) { finishInfo ( ) ; } if ( queryParsingState == QUERY_STATE_DONE ) { //final state, but there could still be a small chunk with closing brackets //only finalize and reset if this is the last chunk sectionDone = lastChunk ; //if false this will allow next iteration to skip non-relevant automatic //transition to next token (which is desirable since there is no more token). //complete queryProfile as we are parsing it only in handler v2 queryProfileInfoObservable . onCompleted ( ) ; if ( sectionDone ) { cleanupQueryStates ( ) ; } } }
Generic dispatch method to parse the query response chunks .