| 179 | // |
| 180 | |
| 181 | bool TDR_attach_database(ISC_STATUS* status_vector, tdr* trans, const TEXT* pathname) |
| 182 | { |
| 183 | AliceGlobals* tdgbl = AliceGlobals::getSpecific(); |
| 184 | |
| 185 | if (tdgbl->ALICE_data.ua_debug) |
| 186 | ALICE_print(68, SafeArg() << pathname); // msg 68: ATTACH_DATABASE: attempted attach of %s |
| 187 | |
| 188 | Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::dpbList, MAX_DPB_SIZE); |
| 189 | dpb.insertTag(isc_dpb_no_garbage_collect); |
| 190 | dpb.insertTag(isc_dpb_gfix_attach); |
| 191 | tdgbl->uSvc->fillDpb(dpb); |
| 192 | if (tdgbl->ALICE_data.ua_user) { |
| 193 | dpb.insertString(isc_dpb_user_name, tdgbl->ALICE_data.ua_user, fb_strlen(tdgbl->ALICE_data.ua_user)); |
| 194 | } |
| 195 | if (tdgbl->ALICE_data.ua_role) { |
| 196 | dpb.insertString(isc_dpb_sql_role_name, tdgbl->ALICE_data.ua_role, fb_strlen(tdgbl->ALICE_data.ua_role)); |
| 197 | } |
| 198 | if (tdgbl->ALICE_data.ua_password) |
| 199 | { |
| 200 | dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password, |
| 201 | tdgbl->ALICE_data.ua_password, fb_strlen(tdgbl->ALICE_data.ua_password)); |
| 202 | } |
| 203 | |
| 204 | trans->tdr_db_handle = 0; |
| 205 | |
| 206 | isc_attach_database(status_vector, 0, pathname, |
| 207 | &trans->tdr_db_handle, dpb.getBufferLength(), |
| 208 | reinterpret_cast<const char*>(dpb.getBuffer())); |
| 209 | |
| 210 | if (status_vector[1]) |
| 211 | { |
| 212 | if (tdgbl->ALICE_data.ua_debug) |
| 213 | { |
| 214 | ALICE_print(69); // msg 69: failed |
| 215 | ALICE_print_status(false, status_vector); |
| 216 | } |
| 217 | return false; |
| 218 | } |
| 219 | |
| 220 | MET_set_capabilities(status_vector, trans); |
| 221 | |
| 222 | if (tdgbl->ALICE_data.ua_debug) |
| 223 | ALICE_print(70); // msg 70: succeeded |
| 224 | |
| 225 | return true; |
| 226 | } |
| 227 | |
| 228 | |
| 229 |
no test coverage detected