private QueryResult createDrizzleQueryResult ( final ResultSetPacket packet ) throws IOException , QueryException { final List < ColumnInformation > columnInformation = new ArrayList < ColumnInformation > ( ) ; for ( int i = 0 ; i < packet . getFieldCount ( ) ; i ++ ) { final RawPacket rawPacket = packetFetcher . getRawPacket ( ) ; final ColumnInformation columnInfo = MySQLFieldPacket . columnInformationFactory ( rawPacket ) ; columnInformation . add ( columnInfo ) ; } packetFetcher . getRawPacket ( ) ; final List < List < ValueObject > > valueObjects = new ArrayList < List < ValueObject > > ( ) ; while ( true ) { final RawPacket rawPacket = packetFetcher . getRawPacket ( ) ; if ( ReadUtil . isErrorPacket ( rawPacket ) ) { ErrorPacket errorPacket = ( ErrorPacket ) ResultPacketFactory . createResultPacket ( rawPacket ) ; checkIfCancelled ( ) ; throw new QueryException ( errorPacket . getMessage ( ) , errorPacket . getErrorNumber ( ) , errorPacket . getSqlState ( ) ) ; } if ( ReadUtil . eofIsNext ( rawPacket ) ) { final EOFPacket eofPacket = ( EOFPacket ) ResultPacketFactory . createResultPacket ( rawPacket ) ; this . hasMoreResults = eofPacket . getStatusFlags ( ) . contains ( EOFPacket . ServerStatus . SERVER_MORE_RESULTS_EXISTS ) ; checkIfCancelled ( ) ; return new DrizzleQueryResult ( columnInformation , valueObjects , eofPacket . getWarningCount ( ) ) ; } if ( getDatabaseType ( ) == SupportedDatabases . MYSQL ) { final MySQLRowPacket rowPacket = new MySQLRowPacket ( rawPacket , columnInformation ) ; valueObjects . add ( rowPacket . getRow ( packetFetcher ) ) ; } else { final DrizzleRowPacket rowPacket = new DrizzleRowPacket ( rawPacket , columnInformation ) ; valueObjects . add ( rowPacket . getRow ( ) ) ; } } }
create a DrizzleQueryResult - precondition is that a result set packet has been read