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

Method attach_database

src/utilities/nbackup/nbackup.cpp:995–1041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

993}
994
995void NBackup::attach_database()
996{
997 if (username.length() > 255 || password.length() > 255)
998 {
999 if (m_silent)
1000 return;
1001 status_exception::raise(Arg::Gds(isc_nbackup_userpw_toolong));
1002 }
1003
1004 ClumpletWriter dpb(ClumpletReader::dpbList, MAX_DPB_SIZE);
1005 uSvc->fillDpb(dpb);
1006
1007 const unsigned char* authBlock;
1008 unsigned int authBlockSize = uSvc->getAuthBlock(&authBlock);
1009 if (authBlockSize)
1010 {
1011 dpb.insertBytes(isc_dpb_auth_block, authBlock, authBlockSize);
1012 }
1013 else
1014 {
1015 if (username.hasData())
1016 dpb.insertString(isc_dpb_user_name, username);
1017
1018 if (password.hasData())
1019 dpb.insertString(isc_dpb_password, password);
1020 }
1021 if (role.hasData())
1022 dpb.insertString(isc_dpb_sql_role_name, role);
1023
1024 if (!run_db_triggers)
1025 dpb.insertByte(isc_dpb_no_db_triggers, 1);
1026
1027 if (m_flash_map)
1028 dpb.insertByte(isc_dpb_clear_map, 1);
1029
1030 if (m_silent)
1031 {
1032 ISC_STATUS_ARRAY temp;
1033 isc_attach_database(temp, 0, database.c_str(), &newdb,
1034 dpb.getBufferLength(), reinterpret_cast<const char*>(dpb.getBuffer()));
1035 }
1036 else if (isc_attach_database(status, 0, database.c_str(), &newdb,
1037 dpb.getBufferLength(), reinterpret_cast<const char*>(dpb.getBuffer())))
1038 {
1039 pr_error(status, "attach database");
1040 }
1041}
1042
1043void NBackup::detach_database()
1044{

Callers

nothing calls this directly

Calls 13

raiseFunction · 0.85
GdsClass · 0.85
pr_errorFunction · 0.85
insertByteMethod · 0.80
lengthMethod · 0.45
fillDpbMethod · 0.45
getAuthBlockMethod · 0.45
insertBytesMethod · 0.45
hasDataMethod · 0.45
insertStringMethod · 0.45
c_strMethod · 0.45
getBufferLengthMethod · 0.45

Tested by

no test coverage detected