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

Function init

src/remote/client/interface.cpp:8954–9021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8952}
8953
8954static bool init(CheckStatusWrapper* status, ClntAuthBlock& cBlock, rem_port* port, P_OP op, PathName& file_name,
8955 ClumpletWriter& dpb, IntlParametersBlock& intlParametersBlock, ICryptKeyCallback* cryptCallback)
8956{
8957/**************************************
8958 *
8959 * i n i t
8960 *
8961 **************************************
8962 *
8963 * Functional description
8964 * Initialize for database access. First call from both CREATE and
8965 * OPEN.
8966 *
8967 **************************************/
8968 try
8969 {
8970 Rdb* rdb = port->port_context;
8971 PACKET* packet = &rdb->rdb_packet;
8972
8973 MemoryPool& pool = *getDefaultMemoryPool();
8974 port->port_deferred_packets = FB_NEW_POOL(pool) PacketQueue(pool);
8975
8976 if (port->port_protocol < PROTOCOL_VERSION12)
8977 {
8978 // This is FB < 2.5. Lets remove that not recognized DPB/SPB and convert the UTF8
8979 // strings to the OS codepage.
8980 intlParametersBlock.fromUtf8(dpb);
8981 ISC_unescape(file_name);
8982 ISC_utf8ToSystem(file_name);
8983 }
8984
8985 const ParametersSet* const ps = (op == op_service_attach ? &spbParam : &dpbParam);
8986
8987 HANDSHAKE_DEBUG(fprintf(stderr, "Cli: init calls authFillParametersBlock\n"));
8988 authFillParametersBlock(cBlock, dpb, ps, port);
8989
8990 port->port_client_crypt_callback = cryptCallback;
8991 cBlock.createCryptCallback(&port->port_client_crypt_callback);
8992
8993 // Make attach packet
8994 P_ATCH* attach = &packet->p_atch;
8995 packet->p_operation = op;
8996 attach->p_atch_file.cstr_length = (ULONG) file_name.length();
8997 attach->p_atch_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
8998 attach->p_atch_dpb.cstr_length = (ULONG) dpb.getBufferLength();
8999 attach->p_atch_dpb.cstr_address = dpb.getBuffer();
9000
9001 send_packet(port, packet);
9002
9003 authReceiveResponse(false, cBlock, port, rdb, status, packet, true);
9004 return true;
9005 }
9006 catch (const Exception& ex)
9007 {
9008 // report primary init error
9009 ex.stuffException(status);
9010 }
9011

Callers 4

attachMethod · 0.70
createMethod · 0.70
attachSvcMethod · 0.70
ControlFileMethod · 0.50

Calls 14

getDefaultMemoryPoolFunction · 0.85
ISC_unescapeFunction · 0.85
ISC_utf8ToSystemFunction · 0.85
authFillParametersBlockFunction · 0.85
send_packetFunction · 0.85
authReceiveResponseFunction · 0.85
fromUtf8Method · 0.80
createCryptCallbackMethod · 0.80
disconnectFunction · 0.70
lengthMethod · 0.45
c_strMethod · 0.45
getBufferLengthMethod · 0.45

Tested by

no test coverage detected