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

Method attach

src/remote/client/interface.cpp:1203–1266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1201}
1202
1203IAttachment* RProvider::attach(CheckStatusWrapper* status, const char* filename, unsigned int dpb_length,
1204 const unsigned char* dpb, bool loopback)
1205{
1206/**************************************
1207 *
1208 * g d s _ a t t a c h _ d a t a b a s e
1209 *
1210 **************************************
1211 *
1212 * Functional description
1213 * Connect to an old, grungy database, corrupted by user data.
1214 *
1215 **************************************/
1216 try
1217 {
1218 reset(status);
1219
1220 ClumpletWriter newDpb(ClumpletReader::dpbList, MAX_DPB_SIZE, dpb, dpb_length);
1221 unsigned flags = ANALYZE_MOUNTS;
1222
1223 if (get_new_dpb(newDpb, dpbParam, loopback))
1224 flags |= ANALYZE_USER_VFY;
1225
1226 if (loopback)
1227 flags |= ANALYZE_LOOPBACK;
1228
1229 PathName expanded_name(filename);
1230 resolveAlias(filename, expanded_name, nullptr);
1231
1232 ClntAuthBlock cBlock(&expanded_name, &newDpb, &dpbParam);
1233 PathName node_name;
1234 rem_port* port = analyze(cBlock, expanded_name, flags, newDpb, dpbParam, node_name, NULL, cryptCallback);
1235
1236 if (!port)
1237 {
1238 Arg::Gds(isc_unavailable).copyTo(status);
1239 return NULL;
1240 }
1241
1242 RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION);
1243
1244 // The client may have set a parameter for dummy_packet_interval. Add that to the
1245 // the DPB so the server can pay attention to it.
1246
1247 add_other_params(port, newDpb, dpbParam);
1248 add_working_directory(newDpb, node_name);
1249
1250 IntlDpb intl;
1251 HANDSHAKE_DEBUG(fprintf(stderr, "Cli: call init for DB='%s'\n", expanded_name.c_str()));
1252 if (!init(status, cBlock, port, op_attach, expanded_name, newDpb, intl, cryptCallback))
1253 return NULL;
1254
1255 Attachment* att = FB_NEW Attachment(port->port_context, filename);
1256 att->addRef();
1257 att->setParamsFromDPB(newDpb);
1258
1259 return att;
1260 }

Callers

nothing calls this directly

Calls 14

get_new_dpbFunction · 0.85
resolveAliasFunction · 0.85
analyzeFunction · 0.85
GdsClass · 0.85
add_other_paramsFunction · 0.85
add_working_directoryFunction · 0.85
setParamsFromDPBMethod · 0.80
resetFunction · 0.70
initFunction · 0.70
AttachmentClass · 0.70
copyToMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected