MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / run

Method run

src/jrd/validation.cpp:1000–1068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

998
999
1000bool Validation::run(thread_db* tdbb, USHORT flags)
1001{
1002/**************************************
1003 *
1004 * r u n
1005 *
1006 **************************************
1007 *
1008 * Functional description
1009 * Validate a database.
1010 *
1011 **************************************/
1012 vdr_tdbb = tdbb;
1013 MemoryPool* val_pool = NULL;
1014 Database* dbb = tdbb->getDatabase();
1015 Firebird::PathName fileName = tdbb->getAttachment()->att_filename;
1016
1017 try
1018 {
1019 val_pool = dbb->createPool();
1020 Jrd::ContextPoolHolder context(tdbb, val_pool);
1021
1022 vdr_flags = flags;
1023
1024 // initialize validate errors
1025 vdr_errors = vdr_warns = vdr_fixed = 0;
1026 for (USHORT i = 0; i < VAL_MAX_ERROR; i++)
1027 vdr_err_counts[i] = 0;
1028
1029 ThreadSweepGuard sweepGuard(tdbb);
1030
1031 gds__log("Database: %s\n\tValidation started", fileName.c_str());
1032
1033 walk_database();
1034 if (vdr_errors || vdr_warns)
1035 vdr_flags &= ~VDR_update;
1036
1037 if (!(vdr_flags & VDR_online) && !(vdr_flags & VDR_partial)) {
1038 garbage_collect();
1039 }
1040
1041 if (vdr_fixed)
1042 {
1043 const USHORT flushFlags = ((dbb->dbb_flags & DBB_shared) && (vdr_flags & VDR_online)) ?
1044 FLUSH_SYSTEM : FLUSH_FINI;
1045 CCH_flush(tdbb, flushFlags, 0);
1046 }
1047
1048 cleanup();
1049
1050 gds__log("Database: %s\n\tValidation finished: %d errors, %d warnings, %d fixed",
1051 fileName.c_str(), vdr_errors, vdr_warns, vdr_fixed);
1052 } // try
1053 catch (const Firebird::Exception& ex)
1054 {
1055 ex.stuffException(tdbb->tdbb_status_vector);
1056
1057 Firebird::string err;

Callers 2

VAL_validateFunction · 0.45
validateFunction · 0.45

Calls 11

CCH_flushFunction · 0.85
iscLogStatusFunction · 0.85
getDatabaseMethod · 0.80
garbage_collectFunction · 0.70
cleanupFunction · 0.50
getAttachmentMethod · 0.45
createPoolMethod · 0.45
c_strMethod · 0.45
stuffExceptionMethod · 0.45
printfMethod · 0.45
deletePoolMethod · 0.45

Tested by

no test coverage detected