| 145 | // |
| 146 | |
| 147 | int EXE_two_phase(const TEXT* database, const SINT64 switches) |
| 148 | { |
| 149 | bool error = false; |
| 150 | AliceGlobals* tdgbl = AliceGlobals::getSpecific(); |
| 151 | { |
| 152 | Firebird::AutoMemoryPool newPool(MemoryPool::createPool()); |
| 153 | AliceContextPoolHolder context(tdgbl, newPool); |
| 154 | |
| 155 | for (USHORT i = 0; i < MAX_VAL_ERRORS; i++) |
| 156 | { |
| 157 | tdgbl->ALICE_data.ua_val_errors[i] = 0; |
| 158 | } |
| 159 | |
| 160 | // generate the database parameter block for the attach, |
| 161 | // based on the various switches |
| 162 | Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE); |
| 163 | buildDpb(dpb, switches); |
| 164 | |
| 165 | FB_API_HANDLE handle = 0; |
| 166 | isc_attach_database(tdgbl->status, 0, database, &handle, |
| 167 | dpb.getBufferLength(), reinterpret_cast<const SCHAR*>(dpb.getBuffer())); |
| 168 | |
| 169 | if (tdgbl->status[1]) |
| 170 | { |
| 171 | error = true; |
| 172 | } |
| 173 | else if (switches & sw_list) |
| 174 | { |
| 175 | TDR_list_limbo((handle), database, switches); |
| 176 | } |
| 177 | else if (switches & (sw_commit | sw_rollback | sw_two_phase)) |
| 178 | { |
| 179 | error = TDR_reconnect_multiple(handle, tdgbl->ALICE_data.ua_transaction, database, switches); |
| 180 | } |
| 181 | |
| 182 | if (handle) |
| 183 | { |
| 184 | isc_detach_database(tdgbl->status, &handle); |
| 185 | } |
| 186 | |
| 187 | if (error) |
| 188 | { |
| 189 | tdgbl->uSvc->getStatusAccessor().setServiceStatus(tdgbl->status); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | if (error) |
| 194 | return FINI_ERROR; |
| 195 | |
| 196 | tdgbl->uSvc->started(); |
| 197 | |
| 198 | return FINI_OK; |
| 199 | } |
| 200 | |
| 201 | //____________________________________________________________ |
| 202 | // |
no test coverage detected