Skip to content

Commit 7347827

Browse files
committed
Feature #1113 - Add support for SQL Schemas. (WIP)
1 parent 855f25a commit 7347827

File tree

224 files changed

+16251
-9682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+16251
-9682
lines changed

builds/install/misc/replication.conf

+28-10
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,25 @@ database
1111
#
1212
# plugin =
1313

14+
# Pattern (regular expression) that defines what schemas must be included into
15+
# replication. By default, tables from all schemas are replicated.
16+
#
17+
# include_schema_filter =
18+
19+
# Pattern (regular expression) that defines what schemas must be excluded from
20+
# replication. By default, tables from all schemas are replicated.
21+
#
22+
# exclude_schema_filter =
23+
1424
# Pattern (regular expression) that defines what tables must be included into
1525
# replication. By default, all tables are replicated.
1626
#
17-
# include_filter =
27+
# include_filter =
1828

1929
# Pattern (regular expression) that defines what tables must be excluded from
2030
# replication. By default, all tables are replicated.
2131
#
22-
# exclude_filter =
32+
# exclude_filter =
2333

2434
# Boolean parameters describing how replication errors must be handled.
2535
#
@@ -42,20 +52,20 @@ database
4252

4353
# Directory to store replication journal files.
4454
#
45-
# journal_directory =
55+
# journal_directory =
4656

4757
# Prefix for replication journal file names. It will be automatically suffixed
4858
# with an ordinal sequential number. If not specified, database filename
4959
# (without path) is used as a prefix.
5060
#
51-
# journal_file_prefix =
61+
# journal_file_prefix =
5262

5363
# Maximum allowed size for a single replication segment.
5464
#
5565
# journal_segment_size = 16777216 # 16MB
5666

5767
# Maximum allowed number of full replication segments. Once this limit is reached,
58-
# the replication process is temporarily delayed to allow the archiving to catch up.
68+
# the replication process is temporarily delayed to allow the archiving to catch up.
5969
# If any of the full segments is not archived during one minute,
6070
# the replication fails with an error.
6171
#
@@ -76,7 +86,7 @@ database
7686
# Directory to store archived replication segments.
7787
# It also defines the $(archpathname) substitution macro (see below).
7888
#
79-
# journal_archive_directory =
89+
# journal_archive_directory =
8090

8191
# Program (complete command line with arguments) that is executed when some
8292
# replication segment gets full and needs archiving.
@@ -97,7 +107,7 @@ database
97107
# or
98108
# Windows: "copy $(pathname) $(archivepathname)"
99109
#
100-
# journal_archive_command =
110+
# journal_archive_command =
101111

102112
# Timeout, in seconds, to wait until incomplete segment is scheduled for archiving.
103113
# It allows to minimize the replication gap if the database is modified rarely.
@@ -121,7 +131,7 @@ database
121131
#
122132
# Multiple entries are allowed (for different synchronous replicas).
123133
#
124-
# sync_replica =
134+
# sync_replica =
125135
#
126136
# It's also possible to configure replicas as separate sub-sections, e.g.:
127137
#
@@ -175,13 +185,13 @@ database
175185

176186
# Directory to search for the journal files to be replicated.
177187
#
178-
# journal_source_directory =
188+
# journal_source_directory =
179189

180190
# Filter to limit replication to the particular source database (based on its GUID).
181191
# Expected format: "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
182192
# Note that double quotes are mandatory, as well as curly braces.
183193
#
184-
# source_guid =
194+
# source_guid =
185195

186196
# If enabled, replication.log contains the detailed log of operations performed
187197
# by the replication server. Otherwise (by default), only errors and warnings are logged.
@@ -202,6 +212,14 @@ database
202212
# then reconnects back and tries to re-apply the latest segments from the point of failure.
203213
#
204214
# apply_error_timeout = 60
215+
216+
# Schema search path for compatibility with Firebird versions below 6.0
217+
#
218+
# Firebird master databases below v6 has no schemas, so use this search path in the replica to
219+
# locate the objects.
220+
# Used only with asynchronous replication.
221+
#
222+
# schema_search_path =
205223
}
206224

207225
#

builds/win32/msvc15/common.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
<ClInclude Include="..\..\..\src\common\classes\NoThrowTimeStamp.h" />
145145
<ClInclude Include="..\..\..\src\common\classes\objects_array.h" />
146146
<ClInclude Include="..\..\..\src\common\classes\ParsedList.h" />
147-
<ClInclude Include="..\..\..\src\common\classes\QualifiedName.h" />
147+
<ClInclude Include="..\..\..\src\common\classes\QualifiedMetaString.h" />
148148
<ClInclude Include="..\..\..\src\common\classes\RefCounted.h" />
149149
<ClInclude Include="..\..\..\src\common\classes\RefMutex.h" />
150150
<ClInclude Include="..\..\..\src\common\classes\rwlock.h" />

builds/win32/msvc15/common.vcxproj.filters

+1-1
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@
449449
<ClInclude Include="..\..\..\src\common\classes\objects_array.h">
450450
<Filter>headers</Filter>
451451
</ClInclude>
452-
<ClInclude Include="..\..\..\src\common\classes\QualifiedName.h">
452+
<ClInclude Include="..\..\..\src\common\classes\MetaString.h">
453453
<Filter>headers</Filter>
454454
</ClInclude>
455455
<ClInclude Include="..\..\..\src\common\classes\RefCounted.h">

builds/win32/msvc15/common_test.vcxproj

+5-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@
181181
<ClCompile Include="..\..\..\src\common\tests\StringTest.cpp" />
182182
<ClCompile Include="..\..\..\src\common\classes\tests\AlignerTest.cpp" />
183183
<ClCompile Include="..\..\..\src\common\classes\tests\ArrayTest.cpp" />
184+
<ClCompile Include="..\..\..\src\common\classes\tests\ClumpletTest.cpp" />
184185
<ClCompile Include="..\..\..\src\common\classes\tests\DoublyLinkedListTest.cpp" />
186+
<ClCompile Include="..\..\..\src\common\classes\tests\MetaStringTest.cpp" />
187+
<ClCompile Include="..\..\..\src\common\classes\tests\QualifiedMetaStringTest.cpp" />
188+
<ClCompile Include="..\..\..\src\common\classes\tests\VectorTest.cpp" />
185189
<ClCompile Include="..\..\..\src\yvalve\gds.cpp" />
186190
</ItemGroup>
187191
<ItemGroup>
@@ -197,4 +201,4 @@
197201
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
198202
<ImportGroup Label="ExtensionTargets">
199203
</ImportGroup>
200-
</Project>
204+
</Project>

builds/win32/msvc15/common_test.vcxproj.filters

+13-1
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,23 @@
3030
<ClCompile Include="..\..\..\src\common\classes\tests\ArrayTest.cpp">
3131
<Filter>source</Filter>
3232
</ClCompile>
33+
<ClCompile Include="..\..\..\src\common\classes\tests\ClumpletTest.cpp">
34+
<Filter>source</Filter>
35+
</ClCompile>
3336
<ClCompile Include="..\..\..\src\common\classes\tests\DoublyLinkedListTest.cpp">
3437
<Filter>source</Filter>
3538
</ClCompile>
39+
<ClCompile Include="..\..\..\src\common\classes\tests\MetaStringTest.cpp">
40+
<Filter>source</Filter>
41+
</ClCompile>
42+
<ClCompile Include="..\..\..\src\common\classes\tests\QualifiedMetaStringTest.cpp">
43+
<Filter>source</Filter>
44+
</ClCompile>
45+
<ClCompile Include="..\..\..\src\common\classes\tests\VectorTest.cpp">
46+
<Filter>source</Filter>
47+
</ClCompile>
3648
<ClCompile Include="..\..\..\src\yvalve\gds.cpp">
3749
<Filter>source</Filter>
3850
</ClCompile>
3951
</ItemGroup>
40-
</Project>
52+
</Project>

doc/README.replication.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ ALTER DATABASE EXCLUDE ALL FROM PUBLICATION
4747
-- to disable replication of specific tables:
4848
ALTER DATABASE EXCLUDE TABLE T1, T2, T3 FROM PUBLICATION
4949

50-
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.
50+
Tables enabled for replicated can be additionally filtered using four settings in the configuration file: include\_schema\_filter, exclude\_schema\_filter, include\_filter and exclude\_filter.
51+
They are regular expressions that are applied to schema and table names and define rules for inclusion table\(s\) into the replication set or excluding them from the replication set.
5152

5253
Synchronous replication can be turned on using the sync\_replica setting \(multiple entries are allowed\). It must specify a connection string to the replica database, prefixed with username/password. In SuperServer and SuperClassic architectures, replica database is being internally attached when the first user gets connected to the master database and detached when the last user disconnects from the master database. In Classic Server architecture, every server process keeps an active connection to the replica database.
5354

doc/sql.extensions/README.ddl_triggers.txt

+17-16
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ DDL_TRIGGER context namespace:
119119
- EVENT_TYPE: event type (CREATE, ALTER, DROP)
120120
- OBJECT_TYPE: object type (TABLE, VIEW, etc)
121121
- DDL_EVENT: event name (<ddl event item>), where <ddl_event_item> is EVENT_TYPE || ' ' || OBJECT_TYPE
122+
- SCHEMA_NAME: object's schema name
122123
- OBJECT_NAME: metadata object name
123124
- OLD_OBJECT_NAME: metadata object name before a rename
124125
- NEW_OBJECT_NAME: metadata object name after a rename
@@ -294,51 +295,51 @@ commit;
294295

295296
select id, ddl_event, object_name, old_object_name, new_object_name, sql_text, ok from ddl_log order by id;
296297

297-
ID DDL_EVENT OBJECT_NAME OLD_OBJECT_NAME NEW_OBJECT_NAME SQL_TEXT OK
298-
===================== ========================= =============================== =============================== =============================== ================= ======
299-
2 CREATE TABLE T1 <null> <null> 80:0 Y
298+
ID DDL_EVENT OBJECT_NAME OLD_OBJECT_NAME NEW_OBJECT_NAME SQL_TEXT OK
299+
===================== ========================= =============================== =============================== =============================== ================= ======
300+
2 CREATE TABLE T1 <null> <null> 80:0 Y
300301
==============================================================================
301-
SQL_TEXT:
302+
SQL_TEXT:
302303
recreate table t1 (
303304
n1 integer,
304305
n2 integer
305306
)
306307
==============================================================================
307-
3 CREATE TABLE T1 <null> <null> 80:1 N
308+
3 CREATE TABLE T1 <null> <null> 80:1 N
308309
==============================================================================
309-
SQL_TEXT:
310+
SQL_TEXT:
310311
create table t1 (
311312
n1 integer,
312313
n2 integer
313314
)
314315
==============================================================================
315-
4 DROP TABLE T1 <null> <null> 80:2 Y
316+
4 DROP TABLE T1 <null> <null> 80:2 Y
316317
==============================================================================
317-
SQL_TEXT:
318+
SQL_TEXT:
318319
recreate table t1 (
319320
n integer
320321
)
321322
==============================================================================
322-
5 CREATE TABLE T1 <null> <null> 80:3 Y
323+
5 CREATE TABLE T1 <null> <null> 80:3 Y
323324
==============================================================================
324-
SQL_TEXT:
325+
SQL_TEXT:
325326
recreate table t1 (
326327
n integer
327328
)
328329
==============================================================================
329-
6 CREATE DOMAIN DOM1 <null> <null> 80:4 Y
330+
6 CREATE DOMAIN DOM1 <null> <null> 80:4 Y
330331
==============================================================================
331-
SQL_TEXT:
332+
SQL_TEXT:
332333
create domain dom1 as integer
333334
==============================================================================
334-
7 ALTER DOMAIN DOM1 <null> <null> 80:5 Y
335+
7 ALTER DOMAIN DOM1 <null> <null> 80:5 Y
335336
==============================================================================
336-
SQL_TEXT:
337+
SQL_TEXT:
337338
alter domain dom1 type bigint
338339
==============================================================================
339-
8 ALTER DOMAIN DOM1 DOM1 DOM2 80:6 Y
340+
8 ALTER DOMAIN DOM1 DOM1 DOM2 80:6 Y
340341
==============================================================================
341-
SQL_TEXT:
342+
SQL_TEXT:
342343
alter domain dom1 to dom2
343344
==============================================================================
344345

doc/sql.extensions/README.profiler.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ execute procedure rdb$profiler.finish_session(true);
109109
110110
-- Data analysis
111111
112+
set search_path to plg$profiler, public, system;
113+
112114
set transaction read committed;
113115
114116
select * from plg$prof_sessions;
@@ -243,7 +245,9 @@ Input parameters:
243245

244246
# Snapshot tables
245247

246-
Snapshot tables (as well views and sequence) are automatically created in the first usage of the profiler. They are owned by the database owner, with read/write permissions for `PUBLIC`.
248+
The profiler schema, snapshot tables, views and sequence are automatically created in the first usage of the profiler.
249+
250+
They are owned by the database owner, with usage/read/write permissions for the RDB$PROFILER role, granted by default to `PUBLIC`.
247251

248252
When a session is deleted, the related data in other profiler snapshot tables are automatically deleted too through foreign keys with `DELETE CASCADE` option.
249253

doc/sql.extensions/README.sql_package.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Output parameters:
1717
- `RECORD_SOURCE_ID` type `BIGINT NOT NULL` - record source id
1818
- `PARENT_RECORD_SOURCE_ID` type `BIGINT` - parent record source id
1919
- `LEVEL` type `INTEGER NOT NULL` - indentation level (may have gaps in relation to parent's level)
20+
- `SCHEMA_NAME` type `RDB$SCHEMA_NAME` - schema name of a stored procedure
2021
- `PACKAGE_NAME` type `RDB$PACKAGE_NAME` - package name of a stored procedure
2122
- `OBJECT_NAME` type `RDB$RELATION_NAME` - object (table, procedure) name
2223
- `ALIAS` type `RDB$SHORT_DESCRIPTION` - alias name

0 commit comments

Comments
 (0)