mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 08:00:39 +01:00
Replaced ADD/DROP with INCLUDE/EXCLUDE in replication DDL
This commit is contained in:
parent
c47d0b3780
commit
b30ff76118
@ -36,16 +36,16 @@ ALTER DATABASE ENABLE PUBLICATION
|
||||
Also, the replication set (aka publication) should be defined. It includes tables that should be replicated. This is also done via the DDL command:
|
||||
|
||||
-- to replicate all tables (including the ones created later):
|
||||
ALTER DATABASE ADD ALL TO PUBLICATION
|
||||
ALTER DATABASE INCLUDE ALL TO PUBLICATION
|
||||
-- to replicate specific tables:
|
||||
ALTER DATABASE ADD TABLE T1, T2, T3 TO PUBLICATION
|
||||
ALTER DATABASE INCLUDE TABLE T1, T2, T3 TO PUBLICATION
|
||||
|
||||
Tables may later be excluded from the replication set:
|
||||
|
||||
-- to disable replication of all tables (including the ones created later):
|
||||
ALTER DATABASE DROP ALL FROM PUBLICATION
|
||||
ALTER DATABASE EXCLUDE ALL FROM PUBLICATION
|
||||
-- to disable replication of specific tables:
|
||||
ALTER DATABASE DROP TABLE T1, T2, T3 FROM PUBLICATION
|
||||
ALTER DATABASE EXCLUDE TABLE T1, T2, T3 FROM PUBLICATION
|
||||
|
||||
Tables enabled for replicated can be additionally filtered using two settings in the configuration file: include\_filter and exclude\_filter. They are regular expressions that are applied to table names and define rules for inclusion table\(s\) into the replication set or excluding them from the replication set.
|
||||
|
||||
|
@ -577,19 +577,19 @@ ALTER DATABASE {ENABLE | DISABLE} PUBLICATION
|
||||
|
||||
Enables or disabled replication. The change is applied immediately after commit.
|
||||
|
||||
ALTER DATABASE ADD ALL TO PUBLICATION
|
||||
ALTER DATABASE INCLUDE ALL TO PUBLICATION
|
||||
|
||||
Enables replication for all tables inside the database, including the ones to be created in the future.
|
||||
|
||||
ALTER DATABASE ADD TABLE {<table1>, <table2>, ..., <tableN>} TO PUBLICATION
|
||||
ALTER DATABASE INCLUDE TABLE {<table1>, <table2>, ..., <tableN>} TO PUBLICATION
|
||||
|
||||
Enables replication for the specified set of tables.
|
||||
|
||||
ALTER DATABASE DROP ALL FROM PUBLICATION
|
||||
ALTER DATABASE EXCLUDE ALL FROM PUBLICATION
|
||||
|
||||
Disables replication for all tables inside the database, including the ones to be created in the future.
|
||||
|
||||
ALTER DATABASE DROP TABLE {<table1>, <table2>, ..., <tableN>} FROM PUBLICATION
|
||||
ALTER DATABASE EXCLUDE TABLE {<table1>, <table2>, ..., <tableN>} FROM PUBLICATION
|
||||
|
||||
Disables replication for the specified set of tables.
|
||||
|
||||
|
@ -247,6 +247,7 @@ static const TOK tokens[] =
|
||||
{TOK_IIF, "IIF", true},
|
||||
{TOK_IN, "IN", false},
|
||||
{TOK_INACTIVE, "INACTIVE", true},
|
||||
{TOK_INCLUDE, "INCLUDE", true},
|
||||
{TOK_INCREMENT, "INCREMENT", true},
|
||||
{TOK_INDEX, "INDEX", false},
|
||||
{TOK_INNER, "INNER", false},
|
||||
|
@ -12508,8 +12508,8 @@ void AlterDatabaseNode::checkClauses(thread_db* tdbb)
|
||||
if ((clauses & CLAUSE_ENABLE_PUB) && (clauses & CLAUSE_DISABLE_PUB))
|
||||
(Arg::PrivateDyn(298) << Arg::Str("ENABLE PUBLICATION") << Arg::Str("DISABLE PUBLICATION")).raise();
|
||||
|
||||
if ((clauses & CLAUSE_PUB_ADD_TABLE) && (clauses & CLAUSE_PUB_DROP_TABLE))
|
||||
(Arg::PrivateDyn(298) << Arg::Str("ADD TABLE TO PUBLICATION") << Arg::Str("DROP TABLE FROM PUBLICATION")).raise();
|
||||
if ((clauses & CLAUSE_PUB_INCL_TABLE) && (clauses & CLAUSE_PUB_EXCL_TABLE))
|
||||
(Arg::PrivateDyn(298) << Arg::Str("INCLUDE TABLE TO PUBLICATION") << Arg::Str("EXCLUDE TABLE FROM PUBLICATION")).raise();
|
||||
}
|
||||
|
||||
void AlterDatabaseNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||
@ -12562,7 +12562,7 @@ void AlterDatabaseNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
||||
END_FOR
|
||||
}
|
||||
|
||||
if (clauses & (CLAUSE_PUB_ADD_TABLE | CLAUSE_PUB_DROP_TABLE))
|
||||
if (clauses & (CLAUSE_PUB_INCL_TABLE | CLAUSE_PUB_EXCL_TABLE))
|
||||
{
|
||||
if (pubTables.isEmpty())
|
||||
{
|
||||
@ -12588,7 +12588,7 @@ void AlterDatabaseNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
||||
WITH PUB.RDB$PUBLICATION_NAME EQ DEFAULT_PUBLICATION
|
||||
{
|
||||
MODIFY PUB
|
||||
PUB.RDB$AUTO_ENABLE = (clauses & CLAUSE_PUB_ADD_TABLE) ? 1 : 0;
|
||||
PUB.RDB$AUTO_ENABLE = (clauses & CLAUSE_PUB_INCL_TABLE) ? 1 : 0;
|
||||
PUB.RDB$AUTO_ENABLE.NULL = FALSE;
|
||||
END_MODIFY
|
||||
}
|
||||
@ -12626,7 +12626,7 @@ void AlterDatabaseNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
||||
{
|
||||
const MetaName& tableName = *iter;
|
||||
|
||||
if (clauses & CLAUSE_PUB_ADD_TABLE)
|
||||
if (clauses & CLAUSE_PUB_INCL_TABLE)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -2390,8 +2390,8 @@ public:
|
||||
static const unsigned CLAUSE_CRYPT = 0x08;
|
||||
static const unsigned CLAUSE_ENABLE_PUB = 0x10;
|
||||
static const unsigned CLAUSE_DISABLE_PUB = 0x20;
|
||||
static const unsigned CLAUSE_PUB_ADD_TABLE = 0x40;
|
||||
static const unsigned CLAUSE_PUB_DROP_TABLE = 0x80;
|
||||
static const unsigned CLAUSE_PUB_INCL_TABLE = 0x40;
|
||||
static const unsigned CLAUSE_PUB_EXCL_TABLE = 0x80;
|
||||
|
||||
static const unsigned RDB_DATABASE_MASK =
|
||||
CLAUSE_BEGIN_BACKUP | CLAUSE_END_BACKUP | CLAUSE_DROP_DIFFERENCE;
|
||||
|
@ -615,6 +615,7 @@ using namespace Firebird;
|
||||
%token <metaNamePtr> HEX_DECODE
|
||||
%token <metaNamePtr> HEX_ENCODE
|
||||
%token <metaNamePtr> IDLE
|
||||
%token <metaNamePtr> INCLUDE
|
||||
%token <metaNamePtr> INT128
|
||||
%token <metaNamePtr> INVOKER
|
||||
%token <metaNamePtr> IV
|
||||
@ -4441,10 +4442,10 @@ db_alter_clause($alterDatabaseNode)
|
||||
{ $alterDatabaseNode->clauses |= AlterDatabaseNode::CLAUSE_ENABLE_PUB; }
|
||||
| DISABLE PUBLICATION
|
||||
{ $alterDatabaseNode->clauses |= AlterDatabaseNode::CLAUSE_DISABLE_PUB; }
|
||||
| ADD pub_table_filter($alterDatabaseNode) TO PUBLICATION
|
||||
{ $alterDatabaseNode->clauses |= AlterDatabaseNode::CLAUSE_PUB_ADD_TABLE; }
|
||||
| DROP pub_table_filter($alterDatabaseNode) FROM PUBLICATION
|
||||
{ $alterDatabaseNode->clauses |= AlterDatabaseNode::CLAUSE_PUB_DROP_TABLE; }
|
||||
| INCLUDE pub_table_filter($alterDatabaseNode) TO PUBLICATION
|
||||
{ $alterDatabaseNode->clauses |= AlterDatabaseNode::CLAUSE_PUB_INCL_TABLE; }
|
||||
| EXCLUDE pub_table_filter($alterDatabaseNode) FROM PUBLICATION
|
||||
{ $alterDatabaseNode->clauses |= AlterDatabaseNode::CLAUSE_PUB_EXCL_TABLE; }
|
||||
;
|
||||
|
||||
%type crypt_key_clause(<alterDatabaseNode>)
|
||||
@ -8968,6 +8969,7 @@ non_reserved_word
|
||||
| HEX_DECODE
|
||||
| HEX_ENCODE
|
||||
| IDLE
|
||||
| INCLUDE
|
||||
| INVOKER
|
||||
| IV
|
||||
| LAST_DAY
|
||||
|
Loading…
Reference in New Issue
Block a user