| 993 | } |
| 994 | |
| 995 | void 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 | |
| 1043 | void NBackup::detach_database() |
| 1044 | { |
nothing calls this directly
no test coverage detected