Response Filters

Response filters are filters that are invoked whenever a response is received from the database server. Response filters can examine the response and do whatever they want to it before it gets sent over to the database client.

Response filters need to be more careful about performance than request filter, because a single request packet can result in millions of response packets

Context

All response filters define the following variables, which can be accessed from your JavaScript code:

  • log : A Logger object to output messages to the logging system

  • context : a container object with the following properties:

    • packet : the packet being processed - can be any response packet type

    • packetType : the type of the packet, equivalent to context.packet.getPacketType()

    • filterContext : the variables that persist through the life of the filter

    • adapterContext : the variables that persist through the life of this database connection

Response filters for Postgres

  • result set filter: invoked when a result set is received from the server, if the connection is not configured for batch processing. Can be used to hide or modify rows or columns from result sets.

  • result set batch filter: invoked when a result set is received from the server, if the connection is configured for batch processing. Can be used to hide or modify rows or columns from result sets.

  • authentication response filter : invoked when the server sends an authentication request packet.

  • JavaScript filter : can be invoked for any response packets.

  • response logging filter: logs responses from the database server