Duplex Filters - MySQL

Duplex filters are filters that are invoked when a request is received from the database client, and when a response is received from the database server. Duplex filters are given the opportunity to look at the request/response and do whatever they want with it: let it through, modify it, or reject it.

Duplex filters can potentially be called for every single type of request and response, such as authentication, close result set, and so on.

A typical example is a query filter, which is called whenever a database query is received from the client. Query filters are given a chance to look at the request and do with it as they please.

Context

All duplex 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

    • 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

Request filters types