The nocreatedbifnotexists filter
removes statements that start with:
CREATE DATABASE IF NOT EXISTS
| Pre-configured filter name |
nocreatedbifnotexists
| ||
| JavaScript Filter File |
tungsten-replicator/support/filters-javascript/nocreatedbifnotexists.js
| ||
| Property prefix |
replicator.filter.nocreatedbifnotexists
| ||
| Stage compatibility |
q-to-dbms
| ||
| tpm Option compatibility |
--svc-applier-filters
| ||
| Data compatibility | Any event | ||
| Parameters | |||
| Parameter | Type | Default | Description |
This can be useful in heterogeneous replication where Tungsten Replicator specific databases need to be removed from the replication stream.
The filter works in two phases. The first phase creates a global variable
within the prepare() function
that defines the string to be examined:
function prepare()
{
beginning = "CREATE DATABASE IF NOT EXISTS";
}
Row based changes can be ignored, but for statement based events, the SQL
is examine and the statement removed if the SQL starts with the text in
the beginning variable:
sql = d.getQuery();
if(sql.startsWith(beginning))
{
data.remove(i);
i--;
}