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

Function open_files

src/burp/burp.cpp:1994–2488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1992
1993
1994static gbak_action open_files(const TEXT* file1,
1995 const TEXT** file2,
1996 USHORT sw_replace,
1997 const Firebird::ClumpletWriter& dpb)
1998{
1999/**************************************
2000 *
2001 * o p e n _ f i l e s
2002 *
2003 **************************************
2004 *
2005 * Functional description
2006 * from the input file names and
2007 * positions, guess what the users
2008 * intention was. Return the type
2009 * of the first file, plus open file
2010 * and db handle.
2011 *
2012 **************************************/
2013 BurpGlobals* tdgbl = BurpGlobals::getSpecific();
2014 FbLocalStatus status_vector;
2015
2016 // try to attach the database using the first file_name
2017
2018 if (sw_replace != IN_SW_BURP_C && sw_replace != IN_SW_BURP_R)
2019 {
2020 Firebird::DispatcherPtr provider;
2021
2022 // provide crypt key(s) for engine
2023
2024 if (tdgbl->gbl_sw_keyholder)
2025 {
2026 tdgbl->gbl_database_file_name = file1;
2027 provider->setDbCryptCallback(&status_vector, MVOL_get_crypt(tdgbl));
2028
2029 if (!status_vector.isSuccess())
2030 {
2031 BURP_print_status(true, &status_vector);
2032 return QUIT;
2033 }
2034 }
2035
2036 tdgbl->db_handle = provider->attachDatabase(&status_vector, file1,
2037 dpb.getBufferLength(), dpb.getBuffer());
2038
2039 if (!(status_vector->getState() & Firebird::IStatus::STATE_ERRORS))
2040 {
2041 if (sw_replace != IN_SW_BURP_B)
2042 {
2043 // msg 13 REPLACE specified, but the first file %s is a database
2044 BURP_error(13, true, file1);
2045 tdgbl->db_handle->detach(&status_vector);
2046
2047 if (status_vector->getState() & Firebird::IStatus::STATE_ERRORS)
2048 BURP_print_status(true, &status_vector);
2049 else
2050 tdgbl->db_handle = NULL;
2051

Callers 1

gbakFunction · 0.70

Calls 15

MVOL_get_cryptFunction · 0.85
BURP_print_statusFunction · 0.85
BURP_errorFunction · 0.85
BURP_printFunction · 0.85
UtilInterfacePtrClass · 0.85
BURP_verboseFunction · 0.85
GBAK_STDOUT_DESCFunction · 0.85
NT_tape_openFunction · 0.85
GBAK_STDIN_DESCFunction · 0.85
MVOL_split_hdr_readFunction · 0.85
strnicmpFunction · 0.85
lseekFunction · 0.85

Tested by

no test coverage detected