@@ -149,34 +149,34 @@ struct DdlTriggerContext
149
149
150
150
// Attachment flags
151
151
152
- const ULONG ATT_no_cleanup = 0x00001L ; // Don't expunge, purge, or garbage collect
153
- const ULONG ATT_shutdown = 0x00002L ; // attachment has been shutdown
154
- const ULONG ATT_shutdown_manager = 0x00004L ; // attachment requesting shutdown
155
- const ULONG ATT_exclusive = 0x00008L ; // attachment wants exclusive database access
156
- const ULONG ATT_attach_pending = 0x00010L ; // Indicate attachment is only pending
157
- const ULONG ATT_exclusive_pending = 0x00020L ; // Indicate exclusive attachment pending
158
- const ULONG ATT_notify_gc = 0x00040L ; // Notify garbage collector to expunge, purge ..
159
- const ULONG ATT_garbage_collector = 0x00080L ; // I'm a garbage collector
160
- const ULONG ATT_cancel_raise = 0x00100L ; // Cancel currently running operation
161
- const ULONG ATT_cancel_disable = 0x00200L ; // Disable cancel operations
162
- const ULONG ATT_no_db_triggers = 0x00400L ; // Don't execute database triggers
163
- const ULONG ATT_manual_lock = 0x00800L ; // Was locked manually
164
- const ULONG ATT_async_manual_lock = 0x01000L ; // Async mutex was locked manually
165
- const ULONG ATT_overwrite_check = 0x02000L ; // Attachment checks is it possible to overwrite DB
166
- const ULONG ATT_system = 0x04000L ; // Special system attachment
167
- const ULONG ATT_creator = 0x08000L ; // This attachment created the DB
168
- const ULONG ATT_monitor_disabled = 0x10000L ; // Monitoring lock is downgraded
169
- const ULONG ATT_security_db = 0x20000L ; // Attachment used for security purposes
170
- const ULONG ATT_mapping = 0x40000L ; // Attachment used for mapping auth block
171
- const ULONG ATT_from_thread = 0x80000L ; // Attachment from internal special thread (sweep, crypt)
172
- const ULONG ATT_monitor_init = 0x100000L ; // Attachment is registered in monitoring
173
- const ULONG ATT_repl_reset = 0x200000L ; // Replication set has been reset
174
- const ULONG ATT_replicating = 0x400000L ; // Replication is active
175
- const ULONG ATT_resetting = 0x800000L ; // Session reset is in progress
176
- const ULONG ATT_worker = 0x1000000L ; // Worker attachment, managed by the engine
177
- const ULONG ATT_gbak_restore_has_schema = 0x2000000L ;
178
-
179
- const ULONG ATT_NO_CLEANUP = (ATT_no_cleanup | ATT_notify_gc);
152
+ inline constexpr ULONG ATT_no_cleanup = 0x00001L ; // Don't expunge, purge, or garbage collect
153
+ inline constexpr ULONG ATT_shutdown = 0x00002L ; // attachment has been shutdown
154
+ inline constexpr ULONG ATT_shutdown_manager = 0x00004L ; // attachment requesting shutdown
155
+ inline constexpr ULONG ATT_exclusive = 0x00008L ; // attachment wants exclusive database access
156
+ inline constexpr ULONG ATT_attach_pending = 0x00010L ; // Indicate attachment is only pending
157
+ inline constexpr ULONG ATT_exclusive_pending = 0x00020L ; // Indicate exclusive attachment pending
158
+ inline constexpr ULONG ATT_notify_gc = 0x00040L ; // Notify garbage collector to expunge, purge ..
159
+ inline constexpr ULONG ATT_garbage_collector = 0x00080L ; // I'm a garbage collector
160
+ inline constexpr ULONG ATT_cancel_raise = 0x00100L ; // Cancel currently running operation
161
+ inline constexpr ULONG ATT_cancel_disable = 0x00200L ; // Disable cancel operations
162
+ inline constexpr ULONG ATT_no_db_triggers = 0x00400L ; // Don't execute database triggers
163
+ inline constexpr ULONG ATT_manual_lock = 0x00800L ; // Was locked manually
164
+ inline constexpr ULONG ATT_async_manual_lock = 0x01000L ; // Async mutex was locked manually
165
+ inline constexpr ULONG ATT_overwrite_check = 0x02000L ; // Attachment checks is it possible to overwrite DB
166
+ inline constexpr ULONG ATT_system = 0x04000L ; // Special system attachment
167
+ inline constexpr ULONG ATT_creator = 0x08000L ; // This attachment created the DB
168
+ inline constexpr ULONG ATT_monitor_disabled = 0x10000L ; // Monitoring lock is downgraded
169
+ inline constexpr ULONG ATT_security_db = 0x20000L ; // Attachment used for security purposes
170
+ inline constexpr ULONG ATT_mapping = 0x40000L ; // Attachment used for mapping auth block
171
+ inline constexpr ULONG ATT_from_thread = 0x80000L ; // Attachment from internal special thread (sweep, crypt)
172
+ inline constexpr ULONG ATT_monitor_init = 0x100000L ; // Attachment is registered in monitoring
173
+ inline constexpr ULONG ATT_repl_reset = 0x200000L ; // Replication set has been reset
174
+ inline constexpr ULONG ATT_replicating = 0x400000L ; // Replication is active
175
+ inline constexpr ULONG ATT_resetting = 0x800000L ; // Session reset is in progress
176
+ inline constexpr ULONG ATT_worker = 0x1000000L ; // Worker attachment, managed by the engine
177
+ inline constexpr ULONG ATT_gbak_restore_has_schema = 0x2000000L ;
178
+
179
+ inline constexpr ULONG ATT_NO_CLEANUP = (ATT_no_cleanup | ATT_notify_gc);
180
180
181
181
class Attachment ;
182
182
class DatabaseOptions ;
@@ -215,13 +215,13 @@ class StableAttachmentPart : public Firebird::RefCounted, public Firebird::Globa
215
215
class Sync
216
216
{
217
217
public:
218
- Sync ()
218
+ Sync () noexcept
219
219
: waiters(0 ), threadId(0 ), totalLocksCounter(0 ), currentLocksCounter(0 )
220
220
{ }
221
221
222
222
void enter (const char * aReason)
223
223
{
224
- ThreadId curTid = getThreadId ();
224
+ const ThreadId curTid = getThreadId ();
225
225
226
226
if (threadId == curTid)
227
227
{
@@ -245,7 +245,7 @@ class StableAttachmentPart : public Firebird::RefCounted, public Firebird::Globa
245
245
246
246
bool tryEnter (const char * aReason)
247
247
{
248
- ThreadId curTid = getThreadId ();
248
+ const ThreadId curTid = getThreadId ();
249
249
250
250
if (threadId == curTid)
251
251
{
@@ -274,12 +274,12 @@ class StableAttachmentPart : public Firebird::RefCounted, public Firebird::Globa
274
274
}
275
275
}
276
276
277
- bool hasContention () const
277
+ bool hasContention () const noexcept
278
278
{
279
279
return (waiters.load (std::memory_order_relaxed) > 0 );
280
280
}
281
281
282
- FB_UINT64 getLockCounter () const
282
+ FB_UINT64 getLockCounter () const noexcept
283
283
{
284
284
return totalLocksCounter;
285
285
}
@@ -299,8 +299,8 @@ class StableAttachmentPart : public Firebird::RefCounted, public Firebird::Globa
299
299
300
300
private:
301
301
// copying is prohibited
302
- Sync (const Sync&);
303
- Sync& operator =(const Sync&);
302
+ Sync (const Sync&) = delete ;
303
+ Sync& operator =(const Sync&) = delete ;
304
304
305
305
Firebird::Mutex syncMutex;
306
306
std::atomic<int > waiters;
@@ -318,7 +318,7 @@ class StableAttachmentPart : public Firebird::RefCounted, public Firebird::Globa
318
318
return att;
319
319
}
320
320
321
- JAttachment* getInterface ()
321
+ JAttachment* getInterface () noexcept
322
322
{
323
323
return jAtt;
324
324
}
@@ -341,7 +341,7 @@ class StableAttachmentPart : public Firebird::RefCounted, public Firebird::Globa
341
341
return useAsync ? &async : &mainSync;
342
342
}
343
343
344
- Firebird::Mutex* getBlockingMutex ()
344
+ Firebird::Mutex* getBlockingMutex () noexcept
345
345
{
346
346
return &blockingMutex;
347
347
}
@@ -367,13 +367,13 @@ class StableAttachmentPart : public Firebird::RefCounted, public Firebird::Globa
367
367
void manualUnlock (ULONG& flags);
368
368
void manualAsyncUnlock (ULONG& flags);
369
369
370
- void setShutError (ISC_STATUS code)
370
+ void setShutError (ISC_STATUS code) noexcept
371
371
{
372
372
if (!shutError)
373
373
shutError = code;
374
374
}
375
375
376
- ISC_STATUS getShutError () const
376
+ ISC_STATUS getShutError () const noexcept
377
377
{
378
378
return shutError;
379
379
}
@@ -430,8 +430,8 @@ class Attachment : public pool_alloc<type_att>
430
430
431
431
private:
432
432
// copying is prohibited
433
- SyncGuard (const SyncGuard&);
434
- SyncGuard& operator =(const SyncGuard&);
433
+ SyncGuard (const SyncGuard&) = delete ;
434
+ SyncGuard& operator =(const SyncGuard&) = delete ;
435
435
436
436
void init (const char * f, bool optional);
437
437
@@ -502,12 +502,12 @@ class Attachment : public pool_alloc<type_att>
502
502
void setInitialOptions (thread_db* tdbb, const DatabaseOptions& options);
503
503
void resetAttachment (Attachment* attachment) const ;
504
504
505
- CoercionArray *getBindings ()
505
+ CoercionArray *getBindings () noexcept
506
506
{
507
507
return &bindings;
508
508
}
509
509
510
- const CoercionArray *getBindings () const
510
+ const CoercionArray *getBindings () const noexcept
511
511
{
512
512
return &bindings;
513
513
}
@@ -523,12 +523,12 @@ class Attachment : public pool_alloc<type_att>
523
523
class DebugOptions
524
524
{
525
525
public:
526
- bool getDsqlKeepBlr () const
526
+ bool getDsqlKeepBlr () const noexcept
527
527
{
528
528
return dsqlKeepBlr;
529
529
}
530
530
531
- void setDsqlKeepBlr (bool value)
531
+ void setDsqlKeepBlr (bool value) noexcept
532
532
{
533
533
dsqlKeepBlr = value;
534
534
}
@@ -540,7 +540,7 @@ class Attachment : public pool_alloc<type_att>
540
540
class UseCountHolder
541
541
{
542
542
public:
543
- explicit UseCountHolder (Attachment* a)
543
+ explicit UseCountHolder (Attachment* a) noexcept
544
544
: att(a)
545
545
{
546
546
if (att)
@@ -711,22 +711,22 @@ class Attachment : public pool_alloc<type_att>
711
711
// / former Database members - end
712
712
713
713
bool locksmith (thread_db* tdbb, SystemPrivilege sp) const ;
714
- jrd_tra* getSysTransaction ();
715
- void setSysTransaction (jrd_tra* trans); // used only by TRA_init
714
+ jrd_tra* getSysTransaction () noexcept ;
715
+ void setSysTransaction (jrd_tra* trans) noexcept ; // used only by TRA_init
716
716
717
- bool isSystem () const
717
+ inline bool isSystem () const noexcept
718
718
{
719
719
return (att_flags & ATT_system);
720
720
}
721
721
722
- bool isWorker () const
722
+ inline bool isWorker () const noexcept
723
723
{
724
724
return (att_flags & ATT_worker);
725
725
}
726
726
727
- bool isGbak () const ;
728
- bool isRWGbak () const ;
729
- bool isUtility () const ; // gbak, gfix and gstat.
727
+ bool isGbak () const noexcept ;
728
+ bool isRWGbak () const noexcept ;
729
+ bool isUtility () const noexcept ; // gbak, gfix and gstat.
730
730
731
731
PreparedStatement* prepareStatement (thread_db* tdbb, jrd_tra* transaction,
732
732
const Firebird::string& text, Firebird::MemoryPool* pool = NULL );
@@ -772,24 +772,24 @@ class Attachment : public pool_alloc<type_att>
772
772
773
773
JAttachment* getInterface () noexcept ;
774
774
775
- unsigned int getIdleTimeout () const
775
+ unsigned int getIdleTimeout () const noexcept
776
776
{
777
777
return att_idle_timeout;
778
778
}
779
779
780
- void setIdleTimeout (unsigned int timeOut)
780
+ void setIdleTimeout (unsigned int timeOut) noexcept
781
781
{
782
782
att_idle_timeout = timeOut;
783
783
}
784
784
785
785
unsigned int getActualIdleTimeout () const ;
786
786
787
- unsigned int getStatementTimeout () const
787
+ unsigned int getStatementTimeout () const noexcept
788
788
{
789
789
return att_stmt_timeout;
790
790
}
791
791
792
- void setStatementTimeout (unsigned int timeOut)
792
+ void setStatementTimeout (unsigned int timeOut) noexcept
793
793
{
794
794
att_stmt_timeout = timeOut;
795
795
}
@@ -830,7 +830,7 @@ class Attachment : public pool_alloc<type_att>
830
830
return att_user ? att_user->getSqlRole () : emptyName;
831
831
}
832
832
833
- const UserId* getEffectiveUserId () const
833
+ const UserId* getEffectiveUserId () const noexcept
834
834
{
835
835
if (att_ss_user)
836
836
return att_ss_user;
@@ -844,12 +844,13 @@ class Attachment : public pool_alloc<type_att>
844
844
}
845
845
846
846
void setInitialOptions (thread_db* tdbb, DatabaseOptions& options, bool newDb);
847
- const CoercionArray* getInitialBindings () const
847
+
848
+ const CoercionArray* getInitialBindings () const noexcept
848
849
{
849
850
return att_initial_options.getBindings ();
850
851
}
851
852
852
- DebugOptions& getDebugOptions ()
853
+ DebugOptions& getDebugOptions () noexcept
853
854
{
854
855
return att_debug_options;
855
856
}
@@ -899,32 +900,32 @@ inline bool Attachment::locksmith(thread_db* tdbb, SystemPrivilege sp) const
899
900
return (user && user->locksmith (tdbb, sp));
900
901
}
901
902
902
- inline jrd_tra* Attachment::getSysTransaction ()
903
+ inline jrd_tra* Attachment::getSysTransaction () noexcept
903
904
{
904
905
return att_sys_transaction;
905
906
}
906
907
907
- inline void Attachment::setSysTransaction (jrd_tra* trans)
908
+ inline void Attachment::setSysTransaction (jrd_tra* trans) noexcept
908
909
{
909
910
att_sys_transaction = trans;
910
911
}
911
912
912
913
// Connection is from GBAK
913
- inline bool Attachment::isGbak () const
914
+ inline bool Attachment::isGbak () const noexcept
914
915
{
915
916
return (att_utility == UTIL_GBAK);
916
917
}
917
918
918
919
// Gbak changes objects when it's restoring (creating) a db.
919
920
// Other attempts are fake. Gbak reconnects to change R/O status and other db-wide settings,
920
921
// but it doesn't modify generators or tables that seconds time.
921
- inline bool Attachment::isRWGbak () const
922
+ inline bool Attachment::isRWGbak () const noexcept
922
923
{
923
924
return (isGbak () && (att_flags & ATT_creator));
924
925
}
925
926
926
927
// Any of the three original utilities: gbak, gfix or gstat.
927
- inline bool Attachment::isUtility () const
928
+ inline bool Attachment::isUtility () const noexcept
928
929
{
929
930
return (att_utility != UTIL_NONE);
930
931
}
@@ -939,19 +940,19 @@ class AttachmentsRefHolder
939
940
class Iterator
940
941
{
941
942
public:
942
- explicit Iterator (AttachmentsRefHolder& list)
943
+ explicit Iterator (AttachmentsRefHolder& list) noexcept
943
944
: m_list(list), m_index(0 )
944
945
{}
945
946
946
- StableAttachmentPart* operator *()
947
+ StableAttachmentPart* operator *() noexcept
947
948
{
948
949
if (m_index < m_list.m_attachments .getCount ())
949
950
return m_list.m_attachments [m_index];
950
951
951
952
return NULL ;
952
953
}
953
954
954
- void operator ++()
955
+ void operator ++() noexcept
955
956
{
956
957
m_index++;
957
958
}
@@ -967,8 +968,8 @@ class AttachmentsRefHolder
967
968
968
969
private:
969
970
// copying is prohibited
970
- Iterator (const Iterator&);
971
- Iterator& operator =(const Iterator&);
971
+ Iterator (const Iterator&) = delete ;
972
+ Iterator& operator =(const Iterator&) = delete ;
972
973
973
974
AttachmentsRefHolder& m_list;
974
975
FB_SIZE_T m_index;
0 commit comments