Skip to content

Commit e3bb525

Browse files
authored
Merge branch 'master' into alter_constraint
2 parents f3c3ae7 + 52657ab commit e3bb525

File tree

24 files changed

+603
-301
lines changed

24 files changed

+603
-301
lines changed

doc/sql.extensions/README.packages.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Syntax:
2828
PROCEDURE <name> [( <parameters> ) [RETURNS ( <parameters> )]]
2929

3030
<package_body> ::=
31-
{ CREATE | RECREATE } PACKAGE BODY <name>
31+
{ CREATE [OR ALTER] | ALTER | RECREATE } PACKAGE BODY <name>
3232
AS
3333
BEGIN
3434
[ <package_item> ... ]

src/common/tests/CvtTestUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class MockCallback : public Firebird::Callbacks
122122
return m_mockGetLocalDateFunc();
123123
}
124124

125-
ISC_TIMESTAMP getCurrentGmtTimeStamp() override { ISC_TIMESTAMP ts; return ts; }
125+
ISC_TIMESTAMP getCurrentGmtTimeStamp() override { return {0, 0}; }
126126
USHORT getSessionTimeZone() override { return 1439; } // 1439 is ONE_DAY, so we have no offset
127127
void isVersion4(bool& v4) override { }
128128

src/common/utils_proto.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131

3232
#include <cctype>
3333
#include <string.h>
34+
#include <type_traits>
35+
3436
#include "../common/classes/fb_string.h"
3537
#include "../common/classes/array.h"
3638
#include "iberror.h"
3739
#include "firebird/Interface.h"
40+
#include "memory_routines.h"
3841

3942
#ifdef SFIO
4043
#include <stdio.h>
@@ -271,6 +274,51 @@ namespace fb_utils
271274
// Frequently used actions with clumplets
272275
bool isBpbSegmented(unsigned parLength, const unsigned char* par);
273276

277+
278+
// Workaround, to be removed with C++ 23
279+
template <typename... T>
280+
constexpr bool fb_always_false_v = false;
281+
282+
// Put integer value into info buffer
283+
template<typename T>
284+
inline unsigned char* putInfoItemInt(const unsigned char item, T value,
285+
unsigned char* ptr, const unsigned char* end)
286+
{
287+
static_assert(std::is_integral_v<T>, "Integral type expected");
288+
289+
constexpr auto len = sizeof(T);
290+
291+
if (ptr + len + 1 + 2 > end)
292+
{
293+
if (ptr < end)
294+
{
295+
*ptr++ = isc_info_truncated;
296+
if (ptr < end)
297+
*ptr++ = isc_info_end;
298+
}
299+
return nullptr;
300+
}
301+
302+
*ptr++ = item;
303+
*ptr++ = len;
304+
*ptr++ = 0;
305+
306+
if constexpr (len == sizeof(SINT64))
307+
put_vax_int64(ptr, value);
308+
else if constexpr (len == sizeof(SLONG))
309+
put_vax_long(ptr, value);
310+
else if constexpr (len == sizeof(SSHORT))
311+
put_vax_short(ptr, value);
312+
else if constexpr (len == sizeof(char))
313+
*ptr = value;
314+
else
315+
static_assert(fb_always_false_v<T>, "unknown data type");
316+
317+
ptr += len;
318+
return ptr;
319+
}
320+
321+
274322
// RAII to call fb_shutdown() in utilities
275323
class FbShutdown
276324
{

src/dsql/parse-conflicts.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
116 shift/reduce conflicts, 22 reduce/reduce conflicts.
1+
118 shift/reduce conflicts, 22 reduce/reduce conflicts.

src/dsql/parse.y

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,7 @@ replace_clause
17121712
| FUNCTION replace_function_clause { $$ = $2; }
17131713
| TRIGGER replace_trigger_clause { $$ = $2; }
17141714
| PACKAGE replace_package_clause { $$ = $2; }
1715+
| PACKAGE BODY replace_package_body_clause { $$ = $3; }
17151716
| VIEW replace_view_clause { $$ = $2; }
17161717
| EXCEPTION replace_exception_clause { $$ = $2; }
17171718
| GENERATOR replace_sequence_clause { $$ = $2; }
@@ -3248,6 +3249,12 @@ package_body_item
32483249
;
32493250

32503251

3252+
%type <ddlNode> replace_package_body_clause
3253+
replace_package_body_clause
3254+
: package_body_clause
3255+
{ $$ = newNode<RecreatePackageBodyNode>($1); }
3256+
;
3257+
32513258
%type <localDeclarationsNode> local_declarations_opt
32523259
local_declarations_opt
32533260
: local_forward_declarations_opt local_nonforward_declarations_opt
@@ -4314,6 +4321,7 @@ alter_clause
43144321
| TRIGGER alter_trigger_clause { $$ = $2; }
43154322
| PROCEDURE alter_procedure_clause { $$ = $2; }
43164323
| PACKAGE alter_package_clause { $$ = $2; }
4324+
| PACKAGE BODY replace_package_body_clause { $$ = $3; }
43174325
| DATABASE
43184326
{ $<alterDatabaseNode>$ = newNode<AlterDatabaseNode>(); }
43194327
alter_db($<alterDatabaseNode>2)

src/jrd/Monitoring.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,10 @@ MonitoringSnapshot::MonitoringSnapshot(thread_db* tdbb, MemoryPool& pool)
507507
if (LCK_lock(tdbb, lock, LCK_EX, LCK_NO_WAIT))
508508
{
509509
LCK_release(tdbb, lock);
510+
511+
MonitoringData::Guard guard(dbb->dbb_monitoring_data);
510512
dbb->dbb_monitoring_data->cleanup(attId);
513+
511514
continue;
512515
}
513516

@@ -541,7 +544,6 @@ MonitoringSnapshot::MonitoringSnapshot(thread_db* tdbb, MemoryPool& pool)
541544
{ // scope for the guard
542545

543546
MonitoringData::Guard guard(dbb->dbb_monitoring_data);
544-
545547
dbb->dbb_monitoring_data->read(userNamePtr, temp_space);
546548
}
547549

src/jrd/SysFunction.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ const char
396396
CLIENT_VERSION_NAME[] = "CLIENT_VERSION",
397397
CURRENT_USER_NAME[] = "CURRENT_USER",
398398
CURRENT_ROLE_NAME[] = "CURRENT_ROLE",
399+
SERVER_PID_NAME[] = "SERVER_PID",
399400
SESSION_IDLE_TIMEOUT[] = "SESSION_IDLE_TIMEOUT",
400401
STATEMENT_TIMEOUT[] = "STATEMENT_TIMEOUT",
401402
EFFECTIVE_USER_NAME[] = "EFFECTIVE_USER",
@@ -4709,6 +4710,8 @@ dsc* evlGetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& ar
47094710

47104711
resultStr = role.c_str();
47114712
}
4713+
else if (nameStr == SERVER_PID_NAME)
4714+
resultStr.printf("%d", getpid());
47124715
else if (nameStr == SESSION_IDLE_TIMEOUT)
47134716
resultStr.printf("%" ULONGFORMAT, attachment->getIdleTimeout());
47144717
else if (nameStr == STATEMENT_TIMEOUT)
@@ -5467,19 +5470,22 @@ dsc* evlMakeDbkey(Jrd::thread_db* tdbb, const SysFunction* function, const NestV
54675470

54685471

54695472
dsc* evlMaxMinValue(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,
5470-
impure_value*)
5473+
impure_value* impure)
54715474
{
54725475
fb_assert(args.getCount() >= 1);
54735476
fb_assert(function->misc != NULL);
54745477

5475-
Request* request = tdbb->getRequest();
5476-
dsc* result = NULL;
5478+
const auto request = tdbb->getRequest();
5479+
HalfStaticArray<const dsc*, 2> argTypes(args.getCount());
5480+
dsc* result = nullptr;
54775481

54785482
for (FB_SIZE_T i = 0; i < args.getCount(); ++i)
54795483
{
5480-
dsc* value = EVL_expr(tdbb, request, args[i]);
5484+
const auto value = EVL_expr(tdbb, request, args[i]);
54815485
if (request->req_flags & req_null) // return NULL if value is NULL
5482-
return NULL;
5486+
return nullptr;
5487+
5488+
argTypes.add(value);
54835489

54845490
if (i == 0)
54855491
result = value;
@@ -5503,7 +5509,12 @@ dsc* evlMaxMinValue(thread_db* tdbb, const SysFunction* function, const NestValu
55035509
}
55045510
}
55055511

5506-
return result;
5512+
DataTypeUtil(tdbb).makeFromList(&impure->vlu_desc, function->name, argTypes.getCount(), argTypes.begin());
5513+
impure->vlu_desc.dsc_address = (UCHAR*) &impure->vlu_misc;
5514+
5515+
MOV_move(tdbb, result, &impure->vlu_desc);
5516+
5517+
return &impure->vlu_desc;
55075518
}
55085519

55095520

src/jrd/btr.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,10 @@ void IndexScanListIterator::makeKeys(thread_db* tdbb, temporary_key* lower, temp
766766
m_upperValues[m_segno] = *m_iterator;
767767

768768
const auto keyType =
769-
(m_retrieval->irb_desc.idx_flags & idx_unique) ? INTL_KEY_UNIQUE : INTL_KEY_SORT;
769+
(m_retrieval->irb_generic & irb_multi_starting) ? INTL_KEY_MULTI_STARTING :
770+
(m_retrieval->irb_generic & irb_starting) ? INTL_KEY_PARTIAL :
771+
(m_retrieval->irb_desc.idx_flags & idx_unique) ? INTL_KEY_UNIQUE :
772+
INTL_KEY_SORT;
770773

771774
// Make the lower bound key
772775

@@ -6766,7 +6769,7 @@ static bool scan(thread_db* tdbb, UCHAR* pointer, RecordBitmap** bitmap, RecordB
67666769
const bool partUpper = (retrieval->irb_upper_count < idx->idx_count);
67676770

67686771
// Reset flags this routine does not check in the loop below
6769-
flag &= ~(irb_equality | irb_ignore_null_value_key | irb_root_list_scan);
6772+
flag &= ~(irb_equality | irb_unique | irb_ignore_null_value_key | irb_root_list_scan);
67706773
flag &= ~(irb_exclude_lower | irb_exclude_upper);
67716774

67726775
IndexNode node;

src/jrd/btr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ const int irb_exclude_lower = 32; // exclude lower bound keys while scanning i
237237
const int irb_exclude_upper = 64; // exclude upper bound keys while scanning index
238238
const int irb_multi_starting = 128; // Use INTL_KEY_MULTI_STARTING
239239
const int irb_root_list_scan = 256; // Locate list items from the root
240+
const int irb_unique = 512; // Unique match (currently used only for plan output)
240241

241242
// Force include flags - always include appropriate key while scanning index
242243
const int irb_force_lower = irb_exclude_lower;

src/jrd/build_no.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
*** DO NOT EDIT ***
44
TO CHANGE ANY INFORMATION IN HERE PLEASE
55
EDIT src/misc/writeBuildNum.sh
6-
FORMAL BUILD NUMBER:511
6+
FORMAL BUILD NUMBER:520
77
*/
88

9-
#define PRODUCT_VER_STRING "6.0.0.511"
10-
#define FILE_VER_STRING "WI-T6.0.0.511"
11-
#define LICENSE_VER_STRING "WI-T6.0.0.511"
12-
#define FILE_VER_NUMBER 6, 0, 0, 511
9+
#define PRODUCT_VER_STRING "6.0.0.520"
10+
#define FILE_VER_STRING "WI-T6.0.0.520"
11+
#define LICENSE_VER_STRING "WI-T6.0.0.520"
12+
#define FILE_VER_NUMBER 6, 0, 0, 520
1313
#define FB_MAJOR_VER "6"
1414
#define FB_MINOR_VER "0"
1515
#define FB_REV_NO "0"
16-
#define FB_BUILD_NO "511"
16+
#define FB_BUILD_NO "520"
1717
#define FB_BUILD_TYPE "T"
1818
#define FB_BUILD_SUFFIX "Firebird 6.0 Initial"

0 commit comments

Comments
 (0)