public static PostgreSQLCommandPacket newInstance(
            final PostgreSQLCommandPacketType commandPacketType, final PostgreSQLPacketPayload payload, final int connectionId) throws SQLException {
        switch (commandPacketType) {
            case QUERY:
                return new PostgreSQLComQueryPacket(payload);
            case PARSE:
                return new PostgreSQLComParsePacket(payload);
            case BIND:
                return new PostgreSQLComBindPacket(payload, connectionId);
            case DESCRIBE:
                return new PostgreSQLComDescribePacket(payload);
            case EXECUTE:
                return new PostgreSQLComExecutePacket(payload);
            case SYNC:
                return new PostgreSQLComSyncPacket(payload);
            case TERMINATE:
                return new PostgreSQLComTerminationPacket(payload);
            default:
                return new PostgreSQLUnsupportedCommandPacket(commandPacketType.getValue());
        }
    }
public static PostgreSQLCommandPacket newInstance ( final PostgreSQLCommandPacketType commandPacketType , final PostgreSQLPacketPayload payload , final int connectionId ) throws SQLException { switch ( commandPacketType ) { case QUERY : return new PostgreSQLComQueryPacket ( payload ) ; case PARSE : return new PostgreSQLComParsePacket ( payload ) ; case BIND : return new PostgreSQLComBindPacket ( payload , connectionId ) ; case DESCRIBE : return new PostgreSQLComDescribePacket ( payload ) ; case EXECUTE : return new PostgreSQLComExecutePacket ( payload ) ; case SYNC : return new PostgreSQLComSyncPacket ( payload ) ; case TERMINATE : return new PostgreSQLComTerminationPacket ( payload ) ; default : return new PostgreSQLUnsupportedCommandPacket ( commandPacketType . getValue ( ) ) ; } }
Create new instance of command packet.

@param commandPacketType command packet type for PostgreSQL
@param payload packet payload for PostgreSQL
@param connectionId connection id
@return command packet for PostgreSQL
@throws SQLException SQL exception