Skip to content

Commit 898a15b

Browse files
committed
Merge remote-tracking branch 'origin/master' into add_cleanup_journal
* origin/master: (80 commits) increment build number Fix conversion warnings in TableValueFunctionScan Fix conversion warnings in inf Fix compiler warning in filters Silence unused warning in ExtDS Fix conversion warnings in blob Fix conversion warnings in ConfigTable Fix conversion warnings in dsql and Parser/parse Fix regression in #6278 pointed by Pavel Zotov. Fix conversion warnings in gen, dfw, scl Fix conversion warnings in ini Fix conversion warnings gbak (burp) Fix conversion warnings in TracePluginImpl Fix conversion warnings Fix conversion warnings in inet/remote Fix conversion warnings in ISQL increment build number Fix conversion warning in LegacyManagement Fix conversion warning in DoublyLinkedList Fix conversion warnings in tests ...
2 parents 16b0169 + f90eae0 commit 898a15b

File tree

162 files changed

+3238
-2716
lines changed

Some content is hidden

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

162 files changed

+3238
-2716
lines changed

doc/sql.extensions/README.schemas.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ you can reset the current search path to its initial configuration with the `ALT
7676

7777
Nonexistent schemas can be included in the search path but are ignored during name resolution.
7878

79+
If `SYSTEM` is not included in the schema list, it is automatically added as the last schema in the search path.
80+
7981
The first existing schema in the search path is referred to as the **current schema** and is exclusively used in some
8082
operations.
8183

@@ -103,7 +105,7 @@ create or alter function F1 returns integer as begin end;
103105
grant create table to user USER1;
104106
```
105107

106-
For `ALTER`, `DROP`, and others statements, the system searches for the specified object across all schemas in the
108+
For `ALTER`, `DROP`, and others statements, Firebird searches for the specified object across all schemas in the
107109
search path. The reference is bound to the first matching object found. If no matching object exists in any schema, an
108110
error is raised.
109111

@@ -133,8 +135,7 @@ In this case, the search path is used to locate `TABLE1`, `DOMAIN1`, and `TABLE2
133135

134136
For DDL statements, the search path operates similarly, but with a subtle difference. Once the object being created or
135137
modified is bound to a schema during statement preparation, the search path is implicitly and temporarily modified.
136-
This adjustment sets the search path to the schema of the object. Additionally, if the `SYSTEM` schema was already
137-
present in the search path, it is appended as the last schema.
138+
This adjustment sets the search path to the schema of the object with `SYSTEM` added as the final schema in the path.
138139

139140
```sql
140141
create schema SCHEMA1;
@@ -198,8 +199,8 @@ grant select on table SCHEMA1.TABLE1 to user USER2;
198199
## The SYSTEM schema
199200

200201
All system schema-bound objects (e.g., `RDB$*` and `MON$*`) are now created in a dedicated schema called `SYSTEM`.
201-
The `SYSTEM` schema has a default `USAGE` permission granted to `PUBLIC` and is included in the default search path.
202-
This ensures backward compatibility with previous Firebird versions.
202+
The `SYSTEM` schema has a default `USAGE` permission granted to `PUBLIC` and is automatically included in the
203+
search path. This ensures backward compatibility with previous Firebird versions.
203204

204205
While the `SYSTEM` schema allows operations like index creation and manipulation of those indexes, it is otherwise
205206
locked for DDL changes. Modifying objects within the `SYSTEM` schema through DDL operations is strongly discouraged.
@@ -265,6 +266,8 @@ schema exists, it returns `NULL`.
265266
SET SEARCH_PATH TO <schema name> [, <schema name>]...
266267
```
267268

269+
If `SYSTEM` is not included in the schema list, it is automatically added as the last schema in the search path.
270+
268271
### RDB$GET_CONTEXT
269272

270273
#### CURRENT_SCHEMA (SYSTEM)
@@ -626,8 +629,7 @@ slave side. This allows mapping database objects to a specific schema using a se
626629
## System packages and functions
627630

628631
Firebird includes system packages such as `RDB$TIME_ZONE_UTIL`, `RDB$PROFILER`, and others. These system packages
629-
are now located in the `SYSTEM` schema. If the `SYSTEM` schema is not included in the search path, their usage
630-
requires explicit qualification with `SYSTEM`, as with any other object bound to the `SYSTEM` schema.
632+
are now located in the `SYSTEM` schema.
631633

632634
In contrast, Firebird also provides non-packaged built-in functions like `RDB$GET_CONTEXT`, `ABS`, and `DATEDIFF`.
633635
These functions are not listed in the database metadata (`RDB$FUNCTIONS`) and neither require nor accept the

examples/dbcrypt/CryptApplication.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class App
113113
throw "setDbCryptCallback";
114114

115115
char s[256];
116-
sprintf(s, "localhost:%s", dbName);
116+
snprintf(s, sizeof(s), "localhost:%s", dbName);
117117
att = p->attachDatabase(status, s, 0, NULL);
118118
if (status->getState() & IStatus::STATE_ERRORS)
119119
throw "attachDatabase";

examples/empbuild/empbuild.epp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ else
7474
/* Create the database */
7575

7676
printf ("creating database %s\n", Db_name);
77-
sprintf (cmd, "CREATE DATABASE \"%s\"", Db_name);
77+
snprintf(cmd, sizeof(cmd), "CREATE DATABASE \"%s\"", Db_name);
7878
gds_trans = 0;
7979

8080
EXEC SQL EXECUTE IMMEDIATE :cmd;
@@ -94,39 +94,39 @@ if (SQLCODE)
9494
}
9595

9696
printf ("Turning forced writes off\n");
97-
sprintf (cmd, "gfix -write async %s", Db_name);
97+
snprintf(cmd, sizeof(cmd), "gfix -write async %s", Db_name);
9898
if (system (cmd))
9999
{
100100
printf ("Couldn't turn forced writes off\n");
101101
exit (FINI_ERROR);
102102
}
103103

104104
printf ("Creating tables\n");
105-
sprintf (cmd, "isql %s -q -i empddl.sql", Db_name);
105+
snprintf(cmd, sizeof(cmd), "isql %s -q -i empddl.sql", Db_name);
106106
if (system (cmd))
107107
{
108108
printf ("Couldn't create tables \n");
109109
exit (FINI_ERROR);
110110
}
111111

112112
printf ("Turning off indices and triggers \n");
113-
sprintf (cmd, "isql %s -i indexoff.sql", Db_name);
113+
snprintf(cmd, sizeof(cmd), "isql %s -i indexoff.sql", Db_name);
114114
if (system (cmd))
115115
{
116116
printf ("Couldn't turn off indices and triggers \n");
117117
exit (FINI_ERROR);
118118
}
119119

120120
printf ("Loading column data\n");
121-
sprintf (cmd, "isql %s -i empdml.sql", Db_name);
121+
snprintf(cmd, sizeof(cmd), "isql %s -i empdml.sql", Db_name);
122122
if (system (cmd))
123123
{
124124
printf ("Couldn't load column data \n");
125125
exit (FINI_ERROR);
126126
}
127127

128128
printf ("Turning on indices and triggers \n");
129-
sprintf (cmd, "isql %s -i indexon.sql", Db_name);
129+
snprintf(cmd, sizeof(cmd), "isql %s -i indexon.sql", Db_name);
130130
if (system (cmd))
131131
{
132132
printf ("Couldn't turn on indices and triggers \n");

examples/extauth/TcWrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void check(ThrowStatusWrapper* status, int err, const char* text)
5858
return;
5959

6060
char buf[256];
61-
sprintf(buf, "%s: %s", text, error_to_string(err));
61+
snprintf(buf, sizeof(buf), "%s: %s", text, error_to_string(err));
6262
error(status, buf);
6363
}
6464

examples/interfaces/04.print_table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ int main()
106106

107107
default:
108108
{
109-
sprintf(s, "Unknown type %d for %s", t, meta->getField(&status, j));
109+
snprintf(s, sizeof(s), "Unknown type %d for %s", t, meta->getField(&status, j));
110110
throw s;
111111
}
112112
continue;

examples/replication/fbSampleReplicator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static const ISC_STATUS wrn[] = { isc_arg_gds, isc_random, isc_arg_string, (ISC_
124124
ReplPlugin::ReplPlugin(IPluginConfig* conf)
125125
{
126126
char fn[100];
127-
sprintf(fn, "session_%08x_%d.log", (unsigned)time(nullptr), logCounter++);
127+
snprintf(fn, sizeof(fn), "session_%08x_%d.log", (unsigned)time(nullptr), logCounter++);
128128
log = fopen(fn, "w");
129129
WriteLog(log, "%p\tReplicatedSession constructed\n", this);
130130
status = master->getStatus();

examples/udr/Triggers.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ FB_UDR_BEGIN_TRIGGER(replicate)
135135
const char* name = triggerMetadata->getField(status, i);
136136

137137
strcat(buffer, " p");
138-
sprintf(buffer + strlen(buffer), "%d type of column \"%s\".\"%s\" = ?", i, table, name);
138+
const size_t buflen = strlen(buffer);
139+
snprintf(buffer + buflen, sizeof(buffer) - buflen, "%d type of column \"%s\".\"%s\" = ?", i, table, name);
139140
}
140141

141142
strcat(buffer,
@@ -175,7 +176,8 @@ FB_UDR_BEGIN_TRIGGER(replicate)
175176
if (i > 0)
176177
strcat(buffer, ", ");
177178
strcat(buffer, ":p");
178-
sprintf(buffer + strlen(buffer), "%d", i);
179+
const size_t buflen = strlen(buffer);
180+
snprintf(buffer + buflen, sizeof(buffer) - buflen, "%d", i);
179181
}
180182

181183
strcat(buffer, ")\n on external data source '");

extern/cloop/src/cloop/Action.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,13 @@ void IfThenElseAction::generate(const ActionParametersBlock& apb, unsigned ident
7777
void CallAction::generate(const ActionParametersBlock& apb, unsigned ident)
7878
{
7979
identify(apb, ident);
80-
fprintf(apb.out, "%s(", name.c_str());
80+
fprintf(apb.out, "%s(", (apb.language == LANGUAGE_PASCAL ? PascalGenerator::escapeName(name) : name).c_str());
8181
for (auto itr = parameters.begin(); itr != parameters.end(); ++itr)
8282
{
83-
fprintf(apb.out, "%s%s", itr == parameters.begin() ? "" : ", ", itr->c_str());
83+
string parname = *itr;
84+
if (apb.language == LANGUAGE_PASCAL)
85+
parname = PascalGenerator::escapeName(parname);
86+
fprintf(apb.out, "%s%s", itr == parameters.begin() ? "" : ", ", parname.c_str());
8487
}
8588
fprintf(apb.out, ");\n");
8689
}

extern/cloop/src/cloop/Generator.cpp

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ void PascalGenerator::generate()
10191019
++i)
10201020
{
10211021
Interface* interface = *i;
1022-
fprintf(out, "\t%s = class;\n", escapeName(interface->name, true).c_str());
1022+
fprintf(out, "\t%s = class;\n", escapeIfaceName(interface->name).c_str());
10231023
}
10241024

10251025
fprintf(out, "\n");
@@ -1077,9 +1077,9 @@ void PascalGenerator::generate()
10771077
!method->returnTypeRef.isPointer;
10781078

10791079
fprintf(out, "\t%s_%sPtr = %s(this: %s",
1080-
escapeName(interface->name, true).c_str(), escapeName(method->name).c_str(),
1080+
escapeIfaceName(interface->name).c_str(), escapeName(method->name).c_str(),
10811081
(isProcedure ? "procedure" : "function"),
1082-
escapeName(interface->name, true).c_str());
1082+
escapeIfaceName(interface->name).c_str());
10831083

10841084
for (vector<Parameter*>::iterator k = method->parameters.begin();
10851085
k != method->parameters.end();
@@ -1123,15 +1123,15 @@ void PascalGenerator::generate()
11231123
Method* method = *j;
11241124

11251125
fprintf(out, "\t\t%s: %s_%sPtr;\n", escapeName(method->name).c_str(),
1126-
escapeName(interface->name, true).c_str(), escapeName(method->name).c_str());
1126+
escapeIfaceName(interface->name).c_str(), escapeName(method->name).c_str());
11271127
}
11281128

11291129
fprintf(out, "\tend;\n\n");
11301130

1131-
fprintf(out, "\t%s = class", escapeName(interface->name, true).c_str());
1131+
fprintf(out, "\t%s = class", escapeIfaceName(interface->name).c_str());
11321132

11331133
if (interface->super)
1134-
fprintf(out, "(%s)", escapeName(interface->super->name, true).c_str());
1134+
fprintf(out, "(%s)", escapeIfaceName(interface->super->name).c_str());
11351135

11361136
fprintf(out, "\n");
11371137

@@ -1196,7 +1196,7 @@ void PascalGenerator::generate()
11961196
fprintf(out, "\tend;\n\n");
11971197

11981198
fprintf(out, "\t%sImpl = class(%s)\n",
1199-
escapeName(interface->name, true).c_str(), escapeName(interface->name, true).c_str());
1199+
escapeIfaceName(interface->name).c_str(), escapeIfaceName(interface->name).c_str());
12001200
fprintf(out, "\t\tconstructor create;\n\n");
12011201

12021202
deque<Method*> methods;
@@ -1262,7 +1262,7 @@ void PascalGenerator::generate()
12621262

12631263
fprintf(out, "%s %s.%s(",
12641264
(isProcedure ? "procedure" : "function"),
1265-
escapeName(interface->name, true).c_str(),
1265+
escapeIfaceName(interface->name).c_str(),
12661266
escapeName(method->name).c_str());
12671267

12681268
for (vector<Parameter*>::iterator k = method->parameters.begin();
@@ -1360,9 +1360,9 @@ void PascalGenerator::generate()
13601360

13611361
fprintf(out, "%s %sImpl_%sDispatcher(this: %s",
13621362
(isProcedure ? "procedure" : "function"),
1363-
escapeName(interface->name, true).c_str(),
1363+
escapeIfaceName(interface->name).c_str(),
13641364
escapeName(method->name).c_str(),
1365-
escapeName(interface->name, true).c_str());
1365+
escapeIfaceName(interface->name).c_str());
13661366

13671367
for (vector<Parameter*>::iterator k = method->parameters.begin();
13681368
k != method->parameters.end();
@@ -1390,7 +1390,7 @@ void PascalGenerator::generate()
13901390
if (!isProcedure)
13911391
fprintf(out, "Result := ");
13921392

1393-
fprintf(out, "%sImpl(this).%s(", escapeName(interface->name, true).c_str(),
1393+
fprintf(out, "%sImpl(this).%s(", escapeIfaceName(interface->name).c_str(),
13941394
escapeName(method->name).c_str());
13951395

13961396
for (vector<Parameter*>::iterator k = method->parameters.begin();
@@ -1428,7 +1428,7 @@ void PascalGenerator::generate()
14281428
{
14291429
fprintf(out, "%s %sImpl.%s(",
14301430
(isProcedure ? "procedure" : "function"),
1431-
escapeName(interface->name, true).c_str(),
1431+
escapeIfaceName(interface->name).c_str(),
14321432
escapeName(method->name).c_str());
14331433

14341434
for (vector<Parameter*>::iterator k = method->parameters.begin();
@@ -1455,11 +1455,11 @@ void PascalGenerator::generate()
14551455

14561456
fprintf(out, "var\n");
14571457
fprintf(out, "\t%sImpl_vTable: %sVTable;\n\n",
1458-
escapeName(interface->name, true).c_str(), escapeName(interface->name).c_str());
1458+
escapeIfaceName(interface->name).c_str(), escapeName(interface->name).c_str());
14591459

1460-
fprintf(out, "constructor %sImpl.create;\n", escapeName(interface->name, true).c_str());
1460+
fprintf(out, "constructor %sImpl.create;\n", escapeIfaceName(interface->name).c_str());
14611461
fprintf(out, "begin\n");
1462-
fprintf(out, "\tvTable := %sImpl_vTable;\n", escapeName(interface->name, true).c_str());
1462+
fprintf(out, "\tvTable := %sImpl_vTable;\n", escapeIfaceName(interface->name).c_str());
14631463
fprintf(out, "end;\n\n");
14641464
}
14651465

@@ -1479,18 +1479,18 @@ void PascalGenerator::generate()
14791479
methods.insert(methods.begin(), p->methods.begin(), p->methods.end());
14801480

14811481
fprintf(out, "\t%sImpl_vTable := %sVTable.create;\n",
1482-
escapeName(interface->name, true).c_str(), escapeName(interface->name).c_str());
1482+
escapeIfaceName(interface->name).c_str(), escapeName(interface->name).c_str());
14831483
fprintf(out, "\t%sImpl_vTable.version := %d;\n",
1484-
escapeName(interface->name, true).c_str(), interface->version);
1484+
escapeIfaceName(interface->name).c_str(), interface->version);
14851485

14861486
for (deque<Method*>::iterator j = methods.begin(); j != methods.end(); ++j)
14871487
{
14881488
Method* method = *j;
14891489

14901490
fprintf(out, "\t%sImpl_vTable.%s := @%sImpl_%sDispatcher;\n",
1491-
escapeName(interface->name, true).c_str(),
1491+
escapeIfaceName(interface->name).c_str(),
14921492
escapeName(method->name).c_str(),
1493-
escapeName(interface->name, true).c_str(),
1493+
escapeIfaceName(interface->name).c_str(),
14941494
escapeName(method->name).c_str());
14951495
}
14961496

@@ -1504,7 +1504,7 @@ void PascalGenerator::generate()
15041504
++i)
15051505
{
15061506
Interface* interface = *i;
1507-
fprintf(out, "\t%sImpl_vTable.destroy;\n", escapeName(interface->name, true).c_str());
1507+
fprintf(out, "\t%sImpl_vTable.destroy;\n", escapeIfaceName(interface->name).c_str());
15081508
}
15091509

15101510
fprintf(out, "\n");
@@ -1577,7 +1577,7 @@ string PascalGenerator::convertType(const TypeRef& typeRef)
15771577
return name;
15781578
}
15791579

1580-
string PascalGenerator::escapeName(string name, bool interfaceName)
1580+
string PascalGenerator::escapeName(string name)
15811581
{
15821582
//// TODO: Create a table of keywords.
15831583

@@ -1592,9 +1592,6 @@ string PascalGenerator::escapeName(string name, bool interfaceName)
15921592
name += "_";
15931593
}
15941594

1595-
if (interfaceName)
1596-
name = prefix + name;
1597-
15981595
return name;
15991596
}
16001597

extern/cloop/src/cloop/Generator.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,15 @@ class PascalGenerator : public FileGenerator
127127

128128
public:
129129
virtual void generate();
130+
static std::string escapeName(std::string name);
130131

131132
private:
132133
std::string convertParameter(const Parameter& parameter);
133134
std::string convertType(const TypeRef& typeRef);
134-
std::string escapeName(std::string name, bool interfaceName = false);
135+
std::string escapeIfaceName(std::string name)
136+
{
137+
return prefix + name;
138+
}
135139

136140
void insertFile(const std::string& filename);
137141

0 commit comments

Comments
 (0)