____________________________________________________________ Write a header record for split operation
| 2104 | // Write a header record for split operation |
| 2105 | // |
| 2106 | bool MVOL_split_hdr_write() |
| 2107 | { |
| 2108 | TEXT buffer[HDR_SPLIT_SIZE + 1]; |
| 2109 | |
| 2110 | BurpGlobals* tdgbl = BurpGlobals::getSpecific(); |
| 2111 | |
| 2112 | fb_assert(tdgbl->action->act_action == ACT_backup_split); |
| 2113 | fb_assert(tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE); |
| 2114 | |
| 2115 | if (tdgbl->action->act_file->fil_length < HDR_SPLIT_SIZE) { |
| 2116 | return false; |
| 2117 | } |
| 2118 | |
| 2119 | time_t seconds = time(NULL); |
| 2120 | |
| 2121 | Firebird::string nm = tdgbl->toSystem(tdgbl->action->act_file->fil_name); |
| 2122 | sprintf(buffer, "%s%.24s , file No. %4d of %4d, %-27.27s", |
| 2123 | HDR_SPLIT_TAG, ctime(&seconds), tdgbl->action->act_file->fil_seq, |
| 2124 | tdgbl->action->act_total, nm.c_str()); |
| 2125 | |
| 2126 | #ifdef WIN_NT |
| 2127 | DWORD bytes_written = 0; |
| 2128 | WriteFile(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE, &bytes_written, NULL); |
| 2129 | #else |
| 2130 | ULONG bytes_written = write(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE); |
| 2131 | #endif // WIN_NT |
| 2132 | |
| 2133 | if (bytes_written != HDR_SPLIT_SIZE) { |
| 2134 | return false; |
| 2135 | } |
| 2136 | |
| 2137 | tdgbl->action->act_file->fil_length -= bytes_written; |
| 2138 | return true; |
| 2139 | } |
| 2140 | |
| 2141 | |
| 2142 | //____________________________________________________________ |