Skip to main content
Common Reference

ansiquotes.js Filter

The ansiquotes filter operates by inserting an SQL mode change to ANSI_QUOTES into the replication stream before a statement is executed, and returning to an empty SQL mode.

Pre-configured filter nameansiquotes
JavaScript Filter Filetungsten-replicator/support/filters-javascript/ansiquotes.js
Property prefixreplicator.filter.ansiquotes
Stage compatibilitybinlog-to-q
tpm Option compatibilitysvc-extractor-filters
Data compatibilityAny event

This changes a statement such as:

INSERT INTO notepad VALUES ('message',0);

To:

SET sql_mode='ANSI_QUOTES';
INSERT INTO notepad VALUES ('message',0);
SET sql_mode='';

This is achieved within the JavaScript by processing the incoming events and adding a new statement before the first DBMSData object in each event:

query = "SET sql_mode='ANSI_QUOTES'";
newStatement = new com.continuent.tungsten.replicator.dbms.StatementData(
query,
null,
null
);
data.add(0, newStatement);

A corresponding statement is appended to the end of the event:

query = "SET sql_mode=''";
newStatement = new com.continuent.tungsten.replicator.dbms.StatementData(
query,
null,
null
);
data.add(data.size(), newStatement);