mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 07:23:03 +01:00
Style.
This commit is contained in:
parent
e36f4f35be
commit
fda9c3bc75
@ -878,7 +878,7 @@ public:
|
|||||||
TEXT mvol_db_name_buffer [MAX_FILE_NAME_SIZE];
|
TEXT mvol_db_name_buffer [MAX_FILE_NAME_SIZE];
|
||||||
SCHAR mvol_old_file [MAX_FILE_NAME_SIZE];
|
SCHAR mvol_old_file [MAX_FILE_NAME_SIZE];
|
||||||
int mvol_volume_count;
|
int mvol_volume_count;
|
||||||
USHORT mvol_empty_file;
|
bool mvol_empty_file;
|
||||||
isc_db_handle db_handle;
|
isc_db_handle db_handle;
|
||||||
isc_tr_handle tr_handle;
|
isc_tr_handle tr_handle;
|
||||||
isc_tr_handle global_trans;
|
isc_tr_handle global_trans;
|
||||||
@ -887,7 +887,7 @@ public:
|
|||||||
ISC_STATUS_ARRAY status_vector;
|
ISC_STATUS_ARRAY status_vector;
|
||||||
int exit_code;
|
int exit_code;
|
||||||
UCHAR* head_of_mem_list;
|
UCHAR* head_of_mem_list;
|
||||||
FILE* output_file;
|
FILE* output_file;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Link list of global fields that were converted from V3 sub_type
|
* Link list of global fields that were converted from V3 sub_type
|
||||||
|
@ -106,8 +106,7 @@ ULONG CAN_encode_decode(burp_rel* relation,
|
|||||||
continue;
|
continue;
|
||||||
UCHAR* p = data + field->fld_offset;
|
UCHAR* p = data + field->fld_offset;
|
||||||
const bool array_fld = ((field->fld_flags & FLD_array) != 0);
|
const bool array_fld = ((field->fld_flags & FLD_array) != 0);
|
||||||
FLD_LENGTH length =
|
const FLD_LENGTH length = (array_fld) ? 8 : field->fld_length;
|
||||||
(array_fld) ? 8 : field->fld_length;
|
|
||||||
if (field->fld_offset >= offset)
|
if (field->fld_offset >= offset)
|
||||||
offset = field->fld_offset + length;
|
offset = field->fld_offset + length;
|
||||||
if (field->fld_type == blr_varying && !array_fld)
|
if (field->fld_type == blr_varying && !array_fld)
|
||||||
@ -129,13 +128,11 @@ ULONG CAN_encode_decode(burp_rel* relation,
|
|||||||
case dtype_varying:
|
case dtype_varying:
|
||||||
{
|
{
|
||||||
vary* pVary = reinterpret_cast<vary*>(p);
|
vary* pVary = reinterpret_cast<vary*>(p);
|
||||||
if (!xdr_short(xdrs,
|
if (!xdr_short(xdrs, reinterpret_cast<SSHORT*>(&pVary->vary_length)))
|
||||||
reinterpret_cast<SSHORT*>(&pVary->vary_length)))
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!xdr_opaque(xdrs,
|
if (!xdr_opaque(xdrs, reinterpret_cast<SCHAR*>(pVary->vary_string),
|
||||||
reinterpret_cast<SCHAR*>(pVary->vary_string),
|
|
||||||
MIN(pVary->vary_length, length)))
|
MIN(pVary->vary_length, length)))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -177,20 +174,20 @@ ULONG CAN_encode_decode(burp_rel* relation,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case dtype_timestamp:
|
case dtype_timestamp:
|
||||||
if (!xdr_long(xdrs, &((SLONG *) p)[0]))
|
if (!xdr_long(xdrs, &((SLONG*) p)[0]))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_long(xdrs, &((SLONG *) p)[1]))
|
if (!xdr_long(xdrs, &((SLONG*) p)[1]))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case dtype_quad:
|
case dtype_quad:
|
||||||
case dtype_blob:
|
case dtype_blob:
|
||||||
if (!xdr_quad(xdrs, (SLONG *) p))
|
if (!xdr_quad(xdrs, (SLONG*) p))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case dtype_int64:
|
case dtype_int64:
|
||||||
if (!xdr_hyper(xdrs, (SINT64 *) p))
|
if (!xdr_hyper(xdrs, (SINT64*) p))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -208,7 +205,7 @@ ULONG CAN_encode_decode(burp_rel* relation,
|
|||||||
continue;
|
continue;
|
||||||
offset = FB_ALIGN(offset, sizeof(SSHORT));
|
offset = FB_ALIGN(offset, sizeof(SSHORT));
|
||||||
UCHAR* p = data + offset;
|
UCHAR* p = data + offset;
|
||||||
if (!xdr_short(xdrs, (SSHORT *) p))
|
if (!xdr_short(xdrs, (SSHORT*) p))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
offset += sizeof(SSHORT);
|
offset += sizeof(SSHORT);
|
||||||
}
|
}
|
||||||
@ -404,9 +401,7 @@ static bool_t burp_putlong(XDR* xdrs, const SLONG* lp)
|
|||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
SLONG l = htonl(*lp);
|
SLONG l = htonl(*lp);
|
||||||
return (*xdrs->x_ops->x_putbytes) (xdrs,
|
return (*xdrs->x_ops->x_putbytes) (xdrs, reinterpret_cast<char*>(&l), 4);
|
||||||
reinterpret_cast<char*>(&l),
|
|
||||||
4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -497,15 +492,12 @@ static bool_t xdr_datum(XDR* xdrs, DSC* desc, UCHAR* buffer)
|
|||||||
case dtype_varying:
|
case dtype_varying:
|
||||||
{
|
{
|
||||||
vary* pVary = reinterpret_cast<vary*>(p);
|
vary* pVary = reinterpret_cast<vary*>(p);
|
||||||
if (!xdr_short(xdrs,
|
if (!xdr_short(xdrs, reinterpret_cast<short*>(&pVary->vary_length)))
|
||||||
reinterpret_cast<short*>(&pVary->vary_length)))
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!xdr_opaque(xdrs,
|
if (!xdr_opaque(xdrs, reinterpret_cast<SCHAR*>(pVary->vary_string),
|
||||||
reinterpret_cast<SCHAR*>(pVary->vary_string),
|
MIN(desc->dsc_length - 2, pVary->vary_length)))
|
||||||
MIN(desc->dsc_length - 2,
|
|
||||||
pVary->vary_length)))
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -514,8 +506,7 @@ static bool_t xdr_datum(XDR* xdrs, DSC* desc, UCHAR* buffer)
|
|||||||
|
|
||||||
case dtype_cstring:
|
case dtype_cstring:
|
||||||
if (xdrs->x_op == XDR_ENCODE) {
|
if (xdrs->x_op == XDR_ENCODE) {
|
||||||
n = MIN(strlen(reinterpret_cast<const char*>(p)),
|
n = MIN(strlen(reinterpret_cast<const char*>(p)), (size_t) (desc->dsc_length - 1));
|
||||||
(size_t) (desc->dsc_length - 1));
|
|
||||||
}
|
}
|
||||||
if (!xdr_short(xdrs, &n))
|
if (!xdr_short(xdrs, &n))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -526,14 +517,14 @@ static bool_t xdr_datum(XDR* xdrs, DSC* desc, UCHAR* buffer)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case dtype_short:
|
case dtype_short:
|
||||||
if (!xdr_short(xdrs, (SSHORT *) p))
|
if (!xdr_short(xdrs, (SSHORT*) p))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case dtype_sql_date:
|
case dtype_sql_date:
|
||||||
case dtype_sql_time:
|
case dtype_sql_time:
|
||||||
case dtype_long:
|
case dtype_long:
|
||||||
if (!xdr_long(xdrs, (SLONG *) p))
|
if (!xdr_long(xdrs, (SLONG*) p))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -548,15 +539,15 @@ static bool_t xdr_datum(XDR* xdrs, DSC* desc, UCHAR* buffer)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case dtype_timestamp:
|
case dtype_timestamp:
|
||||||
if (!xdr_long(xdrs, &((SLONG *) p)[0]))
|
if (!xdr_long(xdrs, &((SLONG*) p)[0]))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!xdr_long(xdrs, &((SLONG *) p)[1]))
|
if (!xdr_long(xdrs, &((SLONG*) p)[1]))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case dtype_quad:
|
case dtype_quad:
|
||||||
case dtype_blob:
|
case dtype_blob:
|
||||||
if (!xdr_quad(xdrs, (SLONG *) p))
|
if (!xdr_quad(xdrs, (SLONG*) p))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -589,8 +580,7 @@ static bool_t xdr_quad(XDR* xdrs, SLONG* ip)
|
|||||||
switch (xdrs->x_op)
|
switch (xdrs->x_op)
|
||||||
{
|
{
|
||||||
case XDR_ENCODE:
|
case XDR_ENCODE:
|
||||||
if ((*xdrs->x_ops->x_putlong) (xdrs, &ip[0]) &&
|
if ((*xdrs->x_ops->x_putlong) (xdrs, &ip[0]) && (*xdrs->x_ops->x_putlong) (xdrs, &ip[1]))
|
||||||
(*xdrs->x_ops->x_putlong) (xdrs, &ip[1]))
|
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -664,8 +654,7 @@ static bool_t xdr_slice(XDR* xdrs,
|
|||||||
case XDR_DECODE:
|
case XDR_DECODE:
|
||||||
if (!slice->lstr_length)
|
if (!slice->lstr_length)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (slice->lstr_length > slice->lstr_allocated &&
|
if (slice->lstr_length > slice->lstr_allocated && slice->lstr_allocated)
|
||||||
slice->lstr_allocated)
|
|
||||||
{
|
{
|
||||||
BURP_free(slice->lstr_address);
|
BURP_free(slice->lstr_address);
|
||||||
slice->lstr_address = NULL;
|
slice->lstr_address = NULL;
|
||||||
|
@ -67,7 +67,7 @@ UCHAR *MISC_alloc_burp(ULONG size)
|
|||||||
* are then freed when gbak exits. This is important for
|
* are then freed when gbak exits. This is important for
|
||||||
* NETWARE in particular.
|
* NETWARE in particular.
|
||||||
*/
|
*/
|
||||||
*((UCHAR **) block) = tdgbl->head_of_mem_list;
|
*((UCHAR**) block) = tdgbl->head_of_mem_list;
|
||||||
tdgbl->head_of_mem_list = block;
|
tdgbl->head_of_mem_list = block;
|
||||||
|
|
||||||
return (block + ROUNDUP(sizeof(UCHAR *), FB_ALIGNMENT));
|
return (block + ROUNDUP(sizeof(UCHAR *), FB_ALIGNMENT));
|
||||||
@ -88,10 +88,10 @@ void MISC_free_burp( void *free)
|
|||||||
**************************************/
|
**************************************/
|
||||||
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
||||||
|
|
||||||
if (free != NULL) {
|
if (free != NULL)
|
||||||
|
{
|
||||||
// Point at the head of the allocated block
|
// Point at the head of the allocated block
|
||||||
UCHAR **block =
|
UCHAR** block = (UCHAR**) ((UCHAR*) free - ROUNDUP(sizeof(UCHAR*), FB_ALIGNMENT));
|
||||||
(UCHAR **) ((UCHAR *) free - ROUNDUP(sizeof(UCHAR *), FB_ALIGNMENT));
|
|
||||||
|
|
||||||
// Scan for this block in the list of blocks
|
// Scan for this block in the list of blocks
|
||||||
for (UCHAR **ptr = &tdgbl->head_of_mem_list; *ptr; ptr = (UCHAR **) *ptr)
|
for (UCHAR **ptr = &tdgbl->head_of_mem_list; *ptr; ptr = (UCHAR **) *ptr)
|
||||||
@ -101,7 +101,7 @@ void MISC_free_burp( void *free)
|
|||||||
*ptr = *block;
|
*ptr = *block;
|
||||||
|
|
||||||
// and free it
|
// and free it
|
||||||
gds__free((SLONG *) block);
|
gds__free(block);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ void MVOL_init_read(const char* database_name, // unused?
|
|||||||
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
||||||
|
|
||||||
tdgbl->mvol_volume_count = 1;
|
tdgbl->mvol_volume_count = 1;
|
||||||
tdgbl->mvol_empty_file = TRUE;
|
tdgbl->mvol_empty_file = true;
|
||||||
|
|
||||||
if (file_name != NULL)
|
if (file_name != NULL)
|
||||||
{
|
{
|
||||||
@ -206,13 +206,11 @@ void MVOL_init_read(const char* database_name, // unused?
|
|||||||
UCHAR* new_buffer = BURP_alloc(temp_buffer_size);
|
UCHAR* new_buffer = BURP_alloc(temp_buffer_size);
|
||||||
memcpy(new_buffer, tdgbl->mvol_io_buffer, tdgbl->mvol_io_buffer_size);
|
memcpy(new_buffer, tdgbl->mvol_io_buffer, tdgbl->mvol_io_buffer_size);
|
||||||
BURP_free(tdgbl->mvol_io_buffer);
|
BURP_free(tdgbl->mvol_io_buffer);
|
||||||
tdgbl->mvol_io_ptr =
|
tdgbl->mvol_io_ptr = new_buffer + (tdgbl->mvol_io_ptr - tdgbl->mvol_io_buffer);
|
||||||
new_buffer + (tdgbl->mvol_io_ptr - tdgbl->mvol_io_buffer);
|
|
||||||
tdgbl->mvol_io_buffer = new_buffer;
|
tdgbl->mvol_io_buffer = new_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
tdgbl->mvol_actual_buffer_size = tdgbl->mvol_io_buffer_size =
|
tdgbl->mvol_actual_buffer_size = tdgbl->mvol_io_buffer_size = temp_buffer_size;
|
||||||
temp_buffer_size;
|
|
||||||
*cnt = tdgbl->mvol_io_cnt;
|
*cnt = tdgbl->mvol_io_cnt;
|
||||||
*ptr = tdgbl->mvol_io_ptr;
|
*ptr = tdgbl->mvol_io_ptr;
|
||||||
}
|
}
|
||||||
@ -230,7 +228,7 @@ void MVOL_init_write(const char* database_name, // unused?
|
|||||||
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
||||||
|
|
||||||
tdgbl->mvol_volume_count = 1;
|
tdgbl->mvol_volume_count = 1;
|
||||||
tdgbl->mvol_empty_file = TRUE;
|
tdgbl->mvol_empty_file = true;
|
||||||
|
|
||||||
if (file_name != NULL)
|
if (file_name != NULL)
|
||||||
{
|
{
|
||||||
@ -244,8 +242,7 @@ void MVOL_init_write(const char* database_name, // unused?
|
|||||||
|
|
||||||
tdgbl->mvol_actual_buffer_size = tdgbl->mvol_io_buffer_size;
|
tdgbl->mvol_actual_buffer_size = tdgbl->mvol_io_buffer_size;
|
||||||
const ULONG temp_buffer_size = tdgbl->mvol_io_buffer_size * tdgbl->gbl_sw_blk_factor;
|
const ULONG temp_buffer_size = tdgbl->mvol_io_buffer_size * tdgbl->gbl_sw_blk_factor;
|
||||||
tdgbl->mvol_io_ptr = tdgbl->mvol_io_buffer =
|
tdgbl->mvol_io_ptr = tdgbl->mvol_io_buffer = BURP_alloc(temp_buffer_size + MAX_HEADER_SIZE);
|
||||||
BURP_alloc(temp_buffer_size + MAX_HEADER_SIZE);
|
|
||||||
tdgbl->mvol_io_cnt = tdgbl->mvol_actual_buffer_size;
|
tdgbl->mvol_io_cnt = tdgbl->mvol_actual_buffer_size;
|
||||||
|
|
||||||
while (!write_header(tdgbl->file_desc, temp_buffer_size, false))
|
while (!write_header(tdgbl->file_desc, temp_buffer_size, false))
|
||||||
@ -554,6 +551,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr)
|
|||||||
#ifndef WIN_NT
|
#ifndef WIN_NT
|
||||||
cnt = write(tdgbl->file_desc, ptr, nBytesToWrite);
|
cnt = write(tdgbl->file_desc, ptr, nBytesToWrite);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
DWORD ret = 0;
|
DWORD ret = 0;
|
||||||
if (!WriteFile(tdgbl->file_desc, ptr, (DWORD) nBytesToWrite, &cnt, NULL))
|
if (!WriteFile(tdgbl->file_desc, ptr, (DWORD) nBytesToWrite, &cnt, NULL))
|
||||||
{
|
{
|
||||||
@ -591,8 +589,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr)
|
|||||||
if (tdgbl->action->act_file->fil_next)
|
if (tdgbl->action->act_file->fil_next)
|
||||||
{
|
{
|
||||||
close_platf(tdgbl->file_desc);
|
close_platf(tdgbl->file_desc);
|
||||||
for (burp_fil* file = tdgbl->gbl_sw_backup_files; file;
|
for (burp_fil* file = tdgbl->gbl_sw_backup_files; file; file = file->fil_next)
|
||||||
file = file->fil_next)
|
|
||||||
{
|
{
|
||||||
if (file->fil_fd == tdgbl->file_desc)
|
if (file->fil_fd == tdgbl->file_desc)
|
||||||
file->fil_fd = INVALID_HANDLE_VALUE;
|
file->fil_fd = INVALID_HANDLE_VALUE;
|
||||||
@ -607,8 +604,7 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr)
|
|||||||
// the rest of the bytes (%d) will be written to file %s
|
// the rest of the bytes (%d) will be written to file %s
|
||||||
tdgbl->action->act_file->fil_next->fil_length +=
|
tdgbl->action->act_file->fil_next->fil_length +=
|
||||||
tdgbl->action->act_file->fil_length;
|
tdgbl->action->act_file->fil_length;
|
||||||
tdgbl->action->act_file =
|
tdgbl->action->act_file = tdgbl->action->act_file->fil_next;
|
||||||
tdgbl->action->act_file->fil_next;
|
|
||||||
tdgbl->file_desc = tdgbl->action->act_file->fil_fd;
|
tdgbl->file_desc = tdgbl->action->act_file->fil_fd;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -675,8 +671,10 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr)
|
|||||||
{
|
{
|
||||||
int dbg_cnt;
|
int dbg_cnt;
|
||||||
if (debug_on)
|
if (debug_on)
|
||||||
|
{
|
||||||
for (dbg_cnt = 0; dbg_cnt < cnt; dbg_cnt++)
|
for (dbg_cnt = 0; dbg_cnt < cnt; dbg_cnt++)
|
||||||
printf("%d,\n", *(ptr + dbg_cnt));
|
printf("%d,\n", *(ptr + dbg_cnt));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -760,7 +758,7 @@ static void file_not_empty()
|
|||||||
{
|
{
|
||||||
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
||||||
|
|
||||||
tdgbl->mvol_empty_file = FALSE;
|
tdgbl->mvol_empty_file = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -848,7 +846,7 @@ static DESC next_volume( DESC handle, ULONG mode, bool full_buffer)
|
|||||||
if (!tdgbl->mvol_empty_file)
|
if (!tdgbl->mvol_empty_file)
|
||||||
++tdgbl->mvol_volume_count;
|
++tdgbl->mvol_volume_count;
|
||||||
|
|
||||||
tdgbl->mvol_empty_file = TRUE;
|
tdgbl->mvol_empty_file = true;
|
||||||
|
|
||||||
// Loop until we have opened a file successfully
|
// Loop until we have opened a file successfully
|
||||||
|
|
||||||
@ -941,14 +939,12 @@ static void prompt_for_name(SCHAR* name, int length)
|
|||||||
// Get a location to read from.
|
// Get a location to read from.
|
||||||
fb_assert(!tdgbl->uSvc->isService());
|
fb_assert(!tdgbl->uSvc->isService());
|
||||||
|
|
||||||
if (isatty(fileno(stdout)) ||
|
if (isatty(fileno(stdout)) || !(term_out = fopen(TERM_OUTPUT, "w")))
|
||||||
!(term_out = fopen(TERM_OUTPUT, "w")))
|
|
||||||
{
|
{
|
||||||
term_out = stdout;
|
term_out = stdout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isatty(fileno(stdin)) ||
|
if (isatty(fileno(stdin)) || !(term_in = fopen(TERM_INPUT, "r")))
|
||||||
!(term_in = fopen(TERM_INPUT, "r")))
|
|
||||||
{
|
{
|
||||||
term_in = stdin;
|
term_in = stdin;
|
||||||
}
|
}
|
||||||
@ -961,8 +957,7 @@ static void prompt_for_name(SCHAR* name, int length)
|
|||||||
|
|
||||||
if (strlen(tdgbl->mvol_old_file) > 0)
|
if (strlen(tdgbl->mvol_old_file) > 0)
|
||||||
{
|
{
|
||||||
BURP_msg_get(225, msg, SafeArg() << (tdgbl->mvol_volume_count - 1) <<
|
BURP_msg_get(225, msg, SafeArg() << (tdgbl->mvol_volume_count - 1) << tdgbl->mvol_old_file);
|
||||||
tdgbl->mvol_old_file);
|
|
||||||
fprintf(term_out, msg);
|
fprintf(term_out, msg);
|
||||||
BURP_msg_get(226, msg);
|
BURP_msg_get(226, msg);
|
||||||
// \tPress return to reopen that file, or type a new\n\tname
|
// \tPress return to reopen that file, or type a new\n\tname
|
||||||
@ -1072,10 +1067,7 @@ static void put_numeric( SCHAR attribute, int value)
|
|||||||
//
|
//
|
||||||
// Functional description
|
// Functional description
|
||||||
//
|
//
|
||||||
static bool read_header(DESC handle,
|
static bool read_header(DESC handle, ULONG* buffer_size, USHORT* format, bool init_flag)
|
||||||
ULONG* buffer_size,
|
|
||||||
USHORT* format,
|
|
||||||
bool init_flag)
|
|
||||||
{
|
{
|
||||||
TEXT buffer[MAX_FILE_NAME_SIZE], msg[BURP_MSG_GET_SIZE];
|
TEXT buffer[MAX_FILE_NAME_SIZE], msg[BURP_MSG_GET_SIZE];
|
||||||
|
|
||||||
@ -1083,15 +1075,16 @@ static bool read_header(DESC handle,
|
|||||||
|
|
||||||
// Headers are a version number, and a volume number
|
// Headers are a version number, and a volume number
|
||||||
|
|
||||||
// CVC: Nobody does an explicit check for the read operation, assuming
|
|
||||||
// that GET_ATTRIBUTE() != rec_burp will provide an implicit test.
|
|
||||||
#ifndef WIN_NT
|
#ifndef WIN_NT
|
||||||
tdgbl->mvol_io_cnt = read(handle, tdgbl->mvol_io_buffer,
|
tdgbl->mvol_io_cnt = read(handle, tdgbl->mvol_io_buffer, tdgbl->mvol_actual_buffer_size);
|
||||||
tdgbl->mvol_actual_buffer_size);
|
|
||||||
#else
|
#else
|
||||||
ReadFile(handle, tdgbl->mvol_io_buffer, tdgbl->mvol_actual_buffer_size,
|
DWORD bytesRead = 0;
|
||||||
reinterpret_cast<DWORD*>(&tdgbl->mvol_io_cnt), NULL);
|
ReadFile(handle, tdgbl->mvol_io_buffer, tdgbl->mvol_actual_buffer_size, &bytesRead, NULL);
|
||||||
|
tdgbl->mvol_io_cnt = bytesRead;
|
||||||
#endif
|
#endif
|
||||||
|
if (!tdgbl->mvol_io_cnt)
|
||||||
|
BURP_error_redirect(0, 45); // maybe there's a better message
|
||||||
|
|
||||||
tdgbl->mvol_io_ptr = tdgbl->mvol_io_buffer;
|
tdgbl->mvol_io_ptr = tdgbl->mvol_io_buffer;
|
||||||
|
|
||||||
int attribute = get(tdgbl);
|
int attribute = get(tdgbl);
|
||||||
@ -1108,7 +1101,7 @@ static bool read_header(DESC handle,
|
|||||||
{
|
{
|
||||||
case att_backup_blksize:
|
case att_backup_blksize:
|
||||||
{
|
{
|
||||||
ULONG temp_buffer_size = get_numeric();
|
const ULONG temp_buffer_size = get_numeric();
|
||||||
if (init_flag)
|
if (init_flag)
|
||||||
*buffer_size = temp_buffer_size;
|
*buffer_size = temp_buffer_size;
|
||||||
}
|
}
|
||||||
@ -1147,8 +1140,7 @@ static bool read_header(DESC handle,
|
|||||||
*p = 0;
|
*p = 0;
|
||||||
if (!init_flag && strcmp(buffer, tdgbl->gbl_backup_start_time))
|
if (!init_flag && strcmp(buffer, tdgbl->gbl_backup_start_time))
|
||||||
{
|
{
|
||||||
BURP_msg_get(230, msg, SafeArg() <<
|
BURP_msg_get(230, msg, SafeArg() << tdgbl->gbl_backup_start_time << buffer);
|
||||||
tdgbl->gbl_backup_start_time << buffer);
|
|
||||||
// Expected backup start time %s, found %s\n
|
// Expected backup start time %s, found %s\n
|
||||||
printf(msg);
|
printf(msg);
|
||||||
return false;
|
return false;
|
||||||
@ -1182,8 +1174,7 @@ static bool read_header(DESC handle,
|
|||||||
*p = 0;
|
*p = 0;
|
||||||
if (!init_flag && strcmp(buffer, tdgbl->gbl_database_file_name))
|
if (!init_flag && strcmp(buffer, tdgbl->gbl_database_file_name))
|
||||||
{
|
{
|
||||||
BURP_msg_get(231, msg, SafeArg() <<
|
BURP_msg_get(231, msg, SafeArg() << tdgbl->gbl_database_file_name << buffer);
|
||||||
tdgbl->gbl_database_file_name << buffer);
|
|
||||||
// Expected backup database %s, found %s\n
|
// Expected backup database %s, found %s\n
|
||||||
printf(msg);
|
printf(msg);
|
||||||
return false;
|
return false;
|
||||||
@ -1212,8 +1203,7 @@ static bool read_header(DESC handle,
|
|||||||
temp = get_numeric();
|
temp = get_numeric();
|
||||||
if (temp != tdgbl->mvol_volume_count)
|
if (temp != tdgbl->mvol_volume_count)
|
||||||
{
|
{
|
||||||
BURP_msg_get(232, msg, SafeArg() <<
|
BURP_msg_get(232, msg, SafeArg() << tdgbl->mvol_volume_count << temp);
|
||||||
tdgbl->mvol_volume_count << temp);
|
|
||||||
// Expected volume number %d, found volume %d\n
|
// Expected volume number %d, found volume %d\n
|
||||||
printf(msg);
|
printf(msg);
|
||||||
return false;
|
return false;
|
||||||
@ -1232,9 +1222,7 @@ static bool read_header(DESC handle,
|
|||||||
//____________________________________________________________
|
//____________________________________________________________
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
static bool write_header(DESC handle,
|
static bool write_header(DESC handle, ULONG backup_buffer_size, bool full_buffer)
|
||||||
ULONG backup_buffer_size,
|
|
||||||
bool full_buffer)
|
|
||||||
{
|
{
|
||||||
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
||||||
|
|
||||||
@ -1267,7 +1255,7 @@ static bool write_header(DESC handle,
|
|||||||
const ULONG vax_value = gds__vax_integer(reinterpret_cast<const UCHAR*>(
|
const ULONG vax_value = gds__vax_integer(reinterpret_cast<const UCHAR*>(
|
||||||
&tdgbl->mvol_volume_count),
|
&tdgbl->mvol_volume_count),
|
||||||
sizeof(tdgbl->mvol_volume_count));
|
sizeof(tdgbl->mvol_volume_count));
|
||||||
const UCHAR* p = (UCHAR *) &vax_value;
|
const UCHAR* p = (UCHAR*) &vax_value;
|
||||||
UCHAR* q = tdgbl->mvol_io_volume;
|
UCHAR* q = tdgbl->mvol_io_volume;
|
||||||
// CVC: Warning, do we want sizeof(int) or sizeof(some_abstract_FB_type)???
|
// CVC: Warning, do we want sizeof(int) or sizeof(some_abstract_FB_type)???
|
||||||
// It seems to me we want sizeof(ULONG) for safety. => Done.
|
// It seems to me we want sizeof(ULONG) for safety. => Done.
|
||||||
@ -1281,7 +1269,7 @@ static bool write_header(DESC handle,
|
|||||||
{
|
{
|
||||||
#ifdef WIN_NT
|
#ifdef WIN_NT
|
||||||
DWORD bytes_written = 0;
|
DWORD bytes_written = 0;
|
||||||
const BOOL err = !WriteFile(handle, tdgbl->mvol_io_header,
|
const bool err = !WriteFile(handle, tdgbl->mvol_io_header,
|
||||||
tdgbl->mvol_io_buffer_size, &bytes_written, NULL);
|
tdgbl->mvol_io_buffer_size, &bytes_written, NULL);
|
||||||
#else
|
#else
|
||||||
ULONG bytes_written = write(handle, tdgbl->mvol_io_header,
|
ULONG bytes_written = write(handle, tdgbl->mvol_io_header,
|
||||||
@ -1305,7 +1293,7 @@ static bool write_header(DESC handle,
|
|||||||
tdgbl->action->act_file->fil_length = 0;
|
tdgbl->action->act_file->fil_length = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tdgbl->mvol_empty_file = FALSE;
|
tdgbl->mvol_empty_file = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1337,11 +1325,9 @@ bool MVOL_split_hdr_write()
|
|||||||
|
|
||||||
#ifdef WIN_NT
|
#ifdef WIN_NT
|
||||||
DWORD bytes_written = 0;
|
DWORD bytes_written = 0;
|
||||||
WriteFile(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE,
|
WriteFile(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE, &bytes_written, NULL);
|
||||||
&bytes_written, NULL);
|
|
||||||
#else
|
#else
|
||||||
ULONG bytes_written =
|
ULONG bytes_written = write(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE);
|
||||||
write(tdgbl->action->act_file->fil_fd, buffer, HDR_SPLIT_SIZE);
|
|
||||||
#endif // WIN_NT
|
#endif // WIN_NT
|
||||||
|
|
||||||
if (bytes_written != HDR_SPLIT_SIZE) {
|
if (bytes_written != HDR_SPLIT_SIZE) {
|
||||||
|
@ -134,7 +134,7 @@ bool get_global_field(BurpGlobals* tdgbl);
|
|||||||
bool get_index(BurpGlobals* tdgbl, const burp_rel*);
|
bool get_index(BurpGlobals* tdgbl, const burp_rel*);
|
||||||
void get_misc_blob(BurpGlobals* tdgbl, ISC_QUAD&, USHORT, bool);
|
void get_misc_blob(BurpGlobals* tdgbl, ISC_QUAD&, USHORT, bool);
|
||||||
SLONG get_numeric(BurpGlobals* tdgbl);
|
SLONG get_numeric(BurpGlobals* tdgbl);
|
||||||
SINT64 get_int64(BurpGlobals* tdgbl);
|
SINT64 get_int64(BurpGlobals* tdgbl);
|
||||||
bool get_procedure(BurpGlobals* tdgbl);
|
bool get_procedure(BurpGlobals* tdgbl);
|
||||||
bool get_procedure_prm (BurpGlobals* tdgbl, GDS_NAME );
|
bool get_procedure_prm (BurpGlobals* tdgbl, GDS_NAME );
|
||||||
bool get_ref_constraint(BurpGlobals* tdgbl);
|
bool get_ref_constraint(BurpGlobals* tdgbl);
|
||||||
@ -239,8 +239,7 @@ const int USER_PRIV_OBJECT_TYPE = 128;
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
int RESTORE_restore (const TEXT* file_name,
|
int RESTORE_restore (const TEXT* file_name, const TEXT* database_name)
|
||||||
const TEXT* database_name)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -480,8 +479,7 @@ int RESTORE_restore (const TEXT* file_name,
|
|||||||
** Change ownership of any procedures necessary
|
** Change ownership of any procedures necessary
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (burp_prc* procedure = tdgbl->procedures; procedure;
|
for (burp_prc* procedure = tdgbl->procedures; procedure; procedure = procedure->prc_next)
|
||||||
procedure = procedure->prc_next)
|
|
||||||
{
|
{
|
||||||
if (procedure->prc_owner[0])
|
if (procedure->prc_owner[0])
|
||||||
{
|
{
|
||||||
@ -596,21 +594,16 @@ int RESTORE_restore (const TEXT* file_name,
|
|||||||
|
|
||||||
if (tdgbl->gbl_sw_user)
|
if (tdgbl->gbl_sw_user)
|
||||||
{
|
{
|
||||||
dpb.insertString(isc_dpb_user_name,
|
dpb.insertString(isc_dpb_user_name, tdgbl->gbl_sw_user, strlen(tdgbl->gbl_sw_user));
|
||||||
tdgbl->gbl_sw_user,
|
|
||||||
strlen(tdgbl->gbl_sw_user));
|
|
||||||
}
|
}
|
||||||
if (tdgbl->gbl_sw_password)
|
if (tdgbl->gbl_sw_password)
|
||||||
{
|
{
|
||||||
dpb.insertString(tdgbl->uSvc->isService() ?
|
dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password,
|
||||||
isc_dpb_password_enc : isc_dpb_password,
|
tdgbl->gbl_sw_password, strlen(tdgbl->gbl_sw_password));
|
||||||
tdgbl->gbl_sw_password,
|
|
||||||
strlen(tdgbl->gbl_sw_password));
|
|
||||||
}
|
}
|
||||||
if (tdgbl->gbl_sw_tr_user)
|
if (tdgbl->gbl_sw_tr_user)
|
||||||
{
|
{
|
||||||
dpb.insertString(isc_dpb_trusted_auth,
|
dpb.insertString(isc_dpb_trusted_auth, tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user));
|
||||||
tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dpb.insertByte(isc_dpb_no_db_triggers, 1);
|
dpb.insertByte(isc_dpb_no_db_triggers, 1);
|
||||||
@ -619,9 +612,8 @@ int RESTORE_restore (const TEXT* file_name,
|
|||||||
dpb.insertByte(isc_dpb_force_write, tdgbl->hdr_forced_writes ? 1 : 0);
|
dpb.insertByte(isc_dpb_force_write, tdgbl->hdr_forced_writes ? 1 : 0);
|
||||||
|
|
||||||
FB_API_HANDLE db_handle = 0;
|
FB_API_HANDLE db_handle = 0;
|
||||||
if (isc_attach_database (tdgbl->status_vector, 0, database_name,
|
if (isc_attach_database(tdgbl->status_vector, 0, database_name, &db_handle,
|
||||||
&db_handle, dpb.getBufferLength(),
|
dpb.getBufferLength(), reinterpret_cast<const SCHAR*>(dpb.getBuffer())))
|
||||||
reinterpret_cast<const SCHAR*>(dpb.getBuffer())))
|
|
||||||
{
|
{
|
||||||
general_on_error();
|
general_on_error();
|
||||||
}
|
}
|
||||||
@ -646,29 +638,23 @@ int RESTORE_restore (const TEXT* file_name,
|
|||||||
dpb.reset(isc_dpb_version1);
|
dpb.reset(isc_dpb_version1);
|
||||||
if (tdgbl->gbl_sw_user)
|
if (tdgbl->gbl_sw_user)
|
||||||
{
|
{
|
||||||
dpb.insertString(isc_dpb_user_name,
|
dpb.insertString(isc_dpb_user_name, tdgbl->gbl_sw_user, strlen(tdgbl->gbl_sw_user));
|
||||||
tdgbl->gbl_sw_user,
|
|
||||||
strlen(tdgbl->gbl_sw_user));
|
|
||||||
}
|
}
|
||||||
if (tdgbl->gbl_sw_password)
|
if (tdgbl->gbl_sw_password)
|
||||||
{
|
{
|
||||||
dpb.insertString(tdgbl->uSvc->isService() ?
|
dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password,
|
||||||
isc_dpb_password_enc : isc_dpb_password,
|
tdgbl->gbl_sw_password, strlen(tdgbl->gbl_sw_password));
|
||||||
tdgbl->gbl_sw_password,
|
|
||||||
strlen(tdgbl->gbl_sw_password));
|
|
||||||
}
|
}
|
||||||
if (tdgbl->gbl_sw_tr_user)
|
if (tdgbl->gbl_sw_tr_user)
|
||||||
{
|
{
|
||||||
dpb.insertString(isc_dpb_trusted_auth,
|
dpb.insertString(isc_dpb_trusted_auth, tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user));
|
||||||
tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dpb.insertByte(isc_dpb_set_db_readonly, 1);
|
dpb.insertByte(isc_dpb_set_db_readonly, 1);
|
||||||
dpb.insertByte(isc_dpb_no_db_triggers, 1);
|
dpb.insertByte(isc_dpb_no_db_triggers, 1);
|
||||||
|
|
||||||
if (isc_attach_database (tdgbl->status_vector, 0, database_name,
|
if (isc_attach_database(tdgbl->status_vector, 0, database_name, &db_handle,
|
||||||
&db_handle, dpb.getBufferLength(),
|
dpb.getBufferLength(), reinterpret_cast<const SCHAR*>(dpb.getBuffer())))
|
||||||
reinterpret_cast<const SCHAR*>(dpb.getBuffer())))
|
|
||||||
{
|
{
|
||||||
general_on_error();
|
general_on_error();
|
||||||
}
|
}
|
||||||
@ -683,8 +669,7 @@ int RESTORE_restore (const TEXT* file_name,
|
|||||||
namespace // unnamed, private
|
namespace // unnamed, private
|
||||||
{
|
{
|
||||||
|
|
||||||
void add_files(BurpGlobals* tdgbl,
|
void add_files(BurpGlobals* tdgbl, const char* file_name)
|
||||||
const char* file_name)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -878,8 +863,7 @@ void check_db_version(BurpGlobals* tdgbl)
|
|||||||
MISC_release_request_silent(req_handle2);
|
MISC_release_request_silent(req_handle2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_database(BurpGlobals* tdgbl,
|
void create_database(BurpGlobals* tdgbl, const TEXT* file_name)
|
||||||
const TEXT* file_name)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -1007,21 +991,16 @@ void create_database(BurpGlobals* tdgbl,
|
|||||||
}
|
}
|
||||||
if (tdgbl->gbl_sw_user)
|
if (tdgbl->gbl_sw_user)
|
||||||
{
|
{
|
||||||
dpb.insertString(isc_dpb_user_name,
|
dpb.insertString(isc_dpb_user_name, tdgbl->gbl_sw_user, strlen(tdgbl->gbl_sw_user));
|
||||||
tdgbl->gbl_sw_user,
|
|
||||||
strlen(tdgbl->gbl_sw_user));
|
|
||||||
}
|
}
|
||||||
if (tdgbl->gbl_sw_password)
|
if (tdgbl->gbl_sw_password)
|
||||||
{
|
{
|
||||||
dpb.insertString(tdgbl->uSvc->isService() ?
|
dpb.insertString(tdgbl->uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password,
|
||||||
isc_dpb_password_enc : isc_dpb_password,
|
tdgbl->gbl_sw_password, strlen(tdgbl->gbl_sw_password));
|
||||||
tdgbl->gbl_sw_password,
|
|
||||||
strlen(tdgbl->gbl_sw_password));
|
|
||||||
}
|
}
|
||||||
if (tdgbl->gbl_sw_tr_user)
|
if (tdgbl->gbl_sw_tr_user)
|
||||||
{
|
{
|
||||||
dpb.insertString(isc_dpb_trusted_auth,
|
dpb.insertString(isc_dpb_trusted_auth, tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user));
|
||||||
tdgbl->gbl_sw_tr_user, strlen(tdgbl->gbl_sw_tr_user));
|
|
||||||
}
|
}
|
||||||
if (page_buffers)
|
if (page_buffers)
|
||||||
{
|
{
|
||||||
@ -1056,10 +1035,9 @@ void create_database(BurpGlobals* tdgbl,
|
|||||||
strlen(tdgbl->gbl_sw_fix_fss_metadata));
|
strlen(tdgbl->gbl_sw_fix_fss_metadata));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isc_create_database (status_vector, 0, file_name,
|
if (isc_create_database(status_vector, 0, file_name, &DB,
|
||||||
&DB, dpb.getBufferLength(),
|
dpb.getBufferLength(), reinterpret_cast<const SCHAR*>(dpb.getBuffer()),
|
||||||
reinterpret_cast<const SCHAR*>(dpb.getBuffer()),
|
0))
|
||||||
0))
|
|
||||||
{
|
{
|
||||||
BURP_error_redirect (status_vector, 33, SafeArg() << file_name);
|
BURP_error_redirect (status_vector, 33, SafeArg() << file_name);
|
||||||
// msg 33 failed to create database %s
|
// msg 33 failed to create database %s
|
||||||
@ -1159,8 +1137,7 @@ void eat_text(BurpGlobals* tdgbl)
|
|||||||
MVOL_skip_block(tdgbl, l);
|
MVOL_skip_block(tdgbl, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
burp_rel* find_relation(BurpGlobals* tdgbl,
|
burp_rel* find_relation(BurpGlobals* tdgbl, const TEXT* name)
|
||||||
const TEXT* name)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -1175,8 +1152,7 @@ burp_rel* find_relation(BurpGlobals* tdgbl,
|
|||||||
**************************************/
|
**************************************/
|
||||||
|
|
||||||
// Why isn't strcmp used here?
|
// Why isn't strcmp used here?
|
||||||
for (burp_rel* relation = tdgbl->relations; relation;
|
for (burp_rel* relation = tdgbl->relations; relation; relation = relation->rel_next)
|
||||||
relation = relation->rel_next)
|
|
||||||
{
|
{
|
||||||
for (const TEXT* p = relation->rel_name, *q = name; *p == *q; p++, q++) {
|
for (const TEXT* p = relation->rel_name, *q = name; *p == *q; p++, q++) {
|
||||||
if (!*p)
|
if (!*p)
|
||||||
@ -1230,9 +1206,12 @@ bool get_acl(BurpGlobals* tdgbl,
|
|||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
|
|
||||||
static const UCHAR blr_items[] = {isc_info_blob_max_segment,
|
static const UCHAR blr_items[] =
|
||||||
isc_info_blob_total_length,
|
{
|
||||||
isc_info_blob_num_segments};
|
isc_info_blob_max_segment,
|
||||||
|
isc_info_blob_total_length,
|
||||||
|
isc_info_blob_num_segments
|
||||||
|
};
|
||||||
|
|
||||||
// If the blob is null, don't store it. It will be restored as null.
|
// If the blob is null, don't store it. It will be restored as null.
|
||||||
|
|
||||||
@ -1393,9 +1372,7 @@ bool get_acl(BurpGlobals* tdgbl,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_array(BurpGlobals* tdgbl,
|
void get_array(BurpGlobals* tdgbl, burp_rel* relation, UCHAR* record_buffer)
|
||||||
burp_rel* relation,
|
|
||||||
UCHAR* record_buffer)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -1515,10 +1492,8 @@ void get_array(BurpGlobals* tdgbl,
|
|||||||
int divisor = 1;
|
int divisor = 1;
|
||||||
for (int i2 = (2 * (i1 + 1) + 1); i2 <= field->fld_dimensions * 2; i2 += 2)
|
for (int i2 = (2 * (i1 + 1) + 1); i2 <= field->fld_dimensions * 2; i2 += 2)
|
||||||
divisor *= (field->fld_ranges[i2] - field->fld_ranges[i2 - 1] + 1);
|
divisor *= (field->fld_ranges[i2] - field->fld_ranges[i2 - 1] + 1);
|
||||||
last_element_dim[i1] =
|
last_element_dim[i1] = (elements_remaining - 1) / divisor + field->fld_ranges[i3];
|
||||||
(elements_remaining - 1) / divisor + field->fld_ranges[i3];
|
elements_remaining -= (last_element_dim[i1] - field->fld_ranges[i3]) * divisor;
|
||||||
elements_remaining -=
|
|
||||||
(last_element_dim[i1] - field->fld_ranges[i3]) * divisor;
|
|
||||||
i3 += 2;
|
i3 += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1556,24 +1531,27 @@ void get_array(BurpGlobals* tdgbl,
|
|||||||
add_byte(blr, isc_sdl_struct);
|
add_byte(blr, isc_sdl_struct);
|
||||||
add_byte(blr, 1);
|
add_byte(blr, 1);
|
||||||
|
|
||||||
if (field->fld_type == blr_text || field->fld_type == blr_varying)
|
switch (field->fld_type)
|
||||||
{
|
{
|
||||||
|
case blr_text:
|
||||||
|
case blr_varying:
|
||||||
if (field->fld_type == blr_text)
|
if (field->fld_type == blr_text)
|
||||||
add_byte(blr, blr_text2);
|
add_byte(blr, blr_text2);
|
||||||
else
|
else
|
||||||
add_byte(blr, blr_varying2);
|
add_byte(blr, blr_varying2);
|
||||||
add_word(blr, field->fld_character_set_id);
|
add_word(blr, field->fld_character_set_id);
|
||||||
add_word(blr, field->fld_length);
|
add_word(blr, field->fld_length);
|
||||||
}
|
break;
|
||||||
else if (field->fld_type == blr_short || field->fld_type == blr_long ||
|
case blr_short:
|
||||||
field->fld_type == blr_quad || field->fld_type == blr_int64)
|
case blr_long:
|
||||||
{
|
case blr_quad:
|
||||||
|
case blr_int64:
|
||||||
add_byte(blr, field->fld_type);
|
add_byte(blr, field->fld_type);
|
||||||
add_byte(blr, field->fld_scale);
|
add_byte(blr, field->fld_scale);
|
||||||
}
|
break;
|
||||||
else
|
default:
|
||||||
add_byte(blr, field->fld_type);
|
add_byte(blr, field->fld_type);
|
||||||
|
}
|
||||||
|
|
||||||
add_byte(blr, isc_sdl_relation);
|
add_byte(blr, isc_sdl_relation);
|
||||||
add_string(blr, relation->rel_name);
|
add_string(blr, relation->rel_name);
|
||||||
@ -1605,8 +1583,7 @@ void get_array(BurpGlobals* tdgbl,
|
|||||||
// dims were (1,2), we would just do a isc_put_slice(1..1, 1..2).
|
// dims were (1,2), we would just do a isc_put_slice(1..1, 1..2).
|
||||||
// This is applied for any number of dimensions.
|
// This is applied for any number of dimensions.
|
||||||
//
|
//
|
||||||
for (range = field->fld_ranges, count = 0; range < end_ranges;
|
for (range = field->fld_ranges, count = 0; range < end_ranges; range += 2, count++)
|
||||||
range += 2, count++)
|
|
||||||
{
|
{
|
||||||
add_byte(blr, isc_sdl_do2);
|
add_byte(blr, isc_sdl_do2);
|
||||||
add_byte(blr, count);
|
add_byte(blr, count);
|
||||||
@ -1627,8 +1604,7 @@ void get_array(BurpGlobals* tdgbl,
|
|||||||
// we perform.
|
// we perform.
|
||||||
//
|
//
|
||||||
if (current_dim + 1 == field->fld_dimensions - 1 &&
|
if (current_dim + 1 == field->fld_dimensions - 1 &&
|
||||||
field->fld_dimensions - count == 2 &&
|
field->fld_dimensions - count == 2 && last_element_dim[count + 1] == range[3])
|
||||||
last_element_dim[count + 1] == range[3])
|
|
||||||
{
|
{
|
||||||
add_byte(blr, isc_sdl_long_integer);
|
add_byte(blr, isc_sdl_long_integer);
|
||||||
add_long(blr, range[0]);
|
add_long(blr, range[0]);
|
||||||
@ -1658,7 +1634,7 @@ void get_array(BurpGlobals* tdgbl,
|
|||||||
lower = range[0];
|
lower = range[0];
|
||||||
add_byte(blr, isc_sdl_long_integer);
|
add_byte(blr, isc_sdl_long_integer);
|
||||||
upper = (current_dim == field->fld_dimensions - 1) ?
|
upper = (current_dim == field->fld_dimensions - 1) ?
|
||||||
last_element_dim[count] : (last_element_dim[count] - 1);
|
last_element_dim[count] : (last_element_dim[count] - 1);
|
||||||
if (upper < range[0])
|
if (upper < range[0])
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -1754,12 +1730,11 @@ void get_array(BurpGlobals* tdgbl,
|
|||||||
CAN_slice (&xdr_buffer, &xdr_slice, FALSE, blr_length, blr_buffer);
|
CAN_slice (&xdr_buffer, &xdr_slice, FALSE, blr_length, blr_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isc_put_slice (status_vector, &DB, &gds_trans,
|
if (isc_put_slice(status_vector, &DB, &gds_trans,
|
||||||
blob_id, blr_length, reinterpret_cast<const char*>(blr_buffer),
|
blob_id, blr_length, reinterpret_cast<const char*>(blr_buffer),
|
||||||
0, // param length for subset of an array handling
|
0, // param length for subset of an array handling
|
||||||
NULL, // param for subset of an array handling
|
NULL, // param for subset of an array handling
|
||||||
elements_written * field->fld_length,
|
elements_written * field->fld_length, buffer + data_at))
|
||||||
buffer + data_at))
|
|
||||||
{
|
{
|
||||||
BURP_print (81, field->fld_name);
|
BURP_print (81, field->fld_name);
|
||||||
// msg 81 error accessing blob field %s -- continuing
|
// msg 81 error accessing blob field %s -- continuing
|
||||||
@ -1786,24 +1761,27 @@ void get_array(BurpGlobals* tdgbl,
|
|||||||
add_byte(blr, isc_sdl_struct);
|
add_byte(blr, isc_sdl_struct);
|
||||||
add_byte(blr, 1);
|
add_byte(blr, 1);
|
||||||
|
|
||||||
if (field->fld_type == blr_text || field->fld_type == blr_varying)
|
switch (field->fld_type)
|
||||||
{
|
{
|
||||||
|
case blr_text:
|
||||||
|
case blr_varying:
|
||||||
if (field->fld_type == blr_text)
|
if (field->fld_type == blr_text)
|
||||||
add_byte(blr, blr_text2);
|
add_byte(blr, blr_text2);
|
||||||
else
|
else
|
||||||
add_byte(blr, blr_varying2);
|
add_byte(blr, blr_varying2);
|
||||||
add_word(blr, field->fld_character_set_id);
|
add_word(blr, field->fld_character_set_id);
|
||||||
add_word(blr, field->fld_length);
|
add_word(blr, field->fld_length);
|
||||||
}
|
break;
|
||||||
else if (field->fld_type == blr_short || field->fld_type == blr_long ||
|
case blr_short:
|
||||||
field->fld_type == blr_quad || field->fld_type == blr_int64)
|
case blr_long:
|
||||||
{
|
case blr_quad:
|
||||||
|
case blr_int64:
|
||||||
add_byte(blr, field->fld_type);
|
add_byte(blr, field->fld_type);
|
||||||
add_byte(blr, field->fld_scale);
|
add_byte(blr, field->fld_scale);
|
||||||
}
|
break;
|
||||||
else
|
default:
|
||||||
add_byte(blr, field->fld_type);
|
add_byte(blr, field->fld_type);
|
||||||
|
}
|
||||||
|
|
||||||
add_byte(blr, isc_sdl_relation);
|
add_byte(blr, isc_sdl_relation);
|
||||||
add_string(blr, relation->rel_name);
|
add_string(blr, relation->rel_name);
|
||||||
@ -1876,12 +1854,12 @@ void get_array(BurpGlobals* tdgbl,
|
|||||||
CAN_slice (&xdr_buffer, &xdr_slice, FALSE, blr_length, blr_buffer);
|
CAN_slice (&xdr_buffer, &xdr_slice, FALSE, blr_length, blr_buffer);
|
||||||
|
|
||||||
|
|
||||||
if (isc_put_slice (status_vector, &DB, &gds_trans,
|
if (isc_put_slice(status_vector, &DB, &gds_trans,
|
||||||
blob_id, blr_length,
|
blob_id, blr_length,
|
||||||
reinterpret_cast<const char*>(blr_buffer),
|
reinterpret_cast<const char*>(blr_buffer),
|
||||||
0, // param length for subset of an array handling
|
0, // param length for subset of an array handling
|
||||||
NULL, // param for subset of an array handling
|
NULL, // param for subset of an array handling
|
||||||
return_length, buffer))
|
return_length, buffer))
|
||||||
{
|
{
|
||||||
BURP_print (81, field->fld_name);
|
BURP_print (81, field->fld_name);
|
||||||
// msg 81 error accessing blob field %s -- continuing
|
// msg 81 error accessing blob field %s -- continuing
|
||||||
@ -1898,9 +1876,7 @@ void get_array(BurpGlobals* tdgbl,
|
|||||||
BURP_free (xdr_buffer.lstr_address);
|
BURP_free (xdr_buffer.lstr_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_blob(BurpGlobals* tdgbl,
|
void get_blob(BurpGlobals* tdgbl, const burp_fld* fields, UCHAR* record_buffer)
|
||||||
const burp_fld* fields,
|
|
||||||
UCHAR* record_buffer)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -2003,9 +1979,7 @@ void get_blob(BurpGlobals* tdgbl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void get_blr_blob(BurpGlobals* tdgbl,
|
void get_blr_blob(BurpGlobals* tdgbl, ISC_QUAD& blob_id, bool glb_trans)
|
||||||
ISC_QUAD& blob_id,
|
|
||||||
bool glb_trans)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -2108,7 +2082,7 @@ bool get_character_set(BurpGlobals* tdgbl)
|
|||||||
|
|
||||||
case att_charset_form:
|
case att_charset_form:
|
||||||
X.RDB$FORM_OF_USE.NULL = FALSE;
|
X.RDB$FORM_OF_USE.NULL = FALSE;
|
||||||
GET_TEXT(X.RDB$FORM_OF_USE);
|
GET_TEXT(X.RDB$FORM_OF_USE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case att_charset_numchar:
|
case att_charset_numchar:
|
||||||
@ -2422,8 +2396,7 @@ bool get_collation(BurpGlobals* tdgbl)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
rec_type get_data(BurpGlobals* tdgbl,
|
rec_type get_data(BurpGlobals* tdgbl, burp_rel* relation)
|
||||||
burp_rel* relation)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -2538,8 +2511,7 @@ rec_type get_data(BurpGlobals* tdgbl,
|
|||||||
length = type_lengths[dtype_blob];
|
length = type_lengths[dtype_blob];
|
||||||
|
|
||||||
if (tdgbl->gbl_sw_fix_fss_data && !(field->fld_flags & FLD_array) &&
|
if (tdgbl->gbl_sw_fix_fss_data && !(field->fld_flags & FLD_array) &&
|
||||||
field->fld_sub_type == isc_blob_text &&
|
field->fld_sub_type == isc_blob_text && field->fld_character_set_id == CS_UNICODE_FSS)
|
||||||
field->fld_character_set_id == CS_UNICODE_FSS)
|
|
||||||
{
|
{
|
||||||
add_byte(blr, blr_blob2);
|
add_byte(blr, blr_blob2);
|
||||||
add_word(blr, field->fld_sub_type);
|
add_word(blr, field->fld_sub_type);
|
||||||
@ -2628,8 +2600,8 @@ rec_type get_data(BurpGlobals* tdgbl,
|
|||||||
ISC_STATUS_ARRAY status_vector;
|
ISC_STATUS_ARRAY status_vector;
|
||||||
USHORT blr_length = blr - blr_buffer;
|
USHORT blr_length = blr - blr_buffer;
|
||||||
|
|
||||||
if (isc_compile_request (status_vector, &DB, &request,
|
if (isc_compile_request (status_vector, &DB, &request,
|
||||||
blr_length, reinterpret_cast<const char*>(blr_buffer)))
|
blr_length, reinterpret_cast<const char*>(blr_buffer)))
|
||||||
{
|
{
|
||||||
isc_print_blr(reinterpret_cast<const char*>(blr_buffer), NULL, NULL, 0);
|
isc_print_blr(reinterpret_cast<const char*>(blr_buffer), NULL, NULL, 0);
|
||||||
if (!tdgbl->gbl_sw_incremental)
|
if (!tdgbl->gbl_sw_incremental)
|
||||||
@ -2744,8 +2716,7 @@ rec_type get_data(BurpGlobals* tdgbl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isc_start_and_send (status_vector, &request, &gds_trans, 0,
|
if (isc_start_and_send (status_vector, &request, &gds_trans, 0, (USHORT) length, buffer, 0))
|
||||||
(USHORT) length, buffer, 0))
|
|
||||||
{
|
{
|
||||||
if (status_vector[1] == isc_not_valid)
|
if (status_vector[1] == isc_not_valid)
|
||||||
{
|
{
|
||||||
@ -2921,8 +2892,7 @@ bool get_exception(BurpGlobals* tdgbl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
burp_fld* get_field(BurpGlobals* tdgbl,
|
burp_fld* get_field(BurpGlobals* tdgbl, burp_rel* relation)
|
||||||
burp_rel* relation)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -4058,8 +4028,8 @@ bool get_global_field(BurpGlobals* tdgbl)
|
|||||||
if (tdgbl->gbl_sw_fix_fss_data && tdgbl->gbl_sw_fix_fss_data_id == 0 &&
|
if (tdgbl->gbl_sw_fix_fss_data && tdgbl->gbl_sw_fix_fss_data_id == 0 &&
|
||||||
!X.RDB$CHARACTER_SET_ID.NULL && X.RDB$CHARACTER_SET_ID == CS_UNICODE_FSS &&
|
!X.RDB$CHARACTER_SET_ID.NULL && X.RDB$CHARACTER_SET_ID == CS_UNICODE_FSS &&
|
||||||
((!X.RDB$CHARACTER_LENGTH.NULL &&
|
((!X.RDB$CHARACTER_LENGTH.NULL &&
|
||||||
(X.RDB$FIELD_TYPE == blr_text || X.RDB$FIELD_TYPE == blr_varying)) ||
|
(X.RDB$FIELD_TYPE == blr_text || X.RDB$FIELD_TYPE == blr_varying)) ||
|
||||||
X.RDB$FIELD_TYPE == blr_blob))
|
X.RDB$FIELD_TYPE == blr_blob))
|
||||||
{
|
{
|
||||||
if (X.RDB$FIELD_TYPE != blr_blob)
|
if (X.RDB$FIELD_TYPE != blr_blob)
|
||||||
X.RDB$CHARACTER_LENGTH = X.RDB$FIELD_LENGTH;
|
X.RDB$CHARACTER_LENGTH = X.RDB$FIELD_LENGTH;
|
||||||
@ -4397,8 +4367,8 @@ bool get_global_field(BurpGlobals* tdgbl)
|
|||||||
if (tdgbl->gbl_sw_fix_fss_data && tdgbl->gbl_sw_fix_fss_data_id == 0 &&
|
if (tdgbl->gbl_sw_fix_fss_data && tdgbl->gbl_sw_fix_fss_data_id == 0 &&
|
||||||
!X.RDB$CHARACTER_SET_ID.NULL && X.RDB$CHARACTER_SET_ID == CS_UNICODE_FSS &&
|
!X.RDB$CHARACTER_SET_ID.NULL && X.RDB$CHARACTER_SET_ID == CS_UNICODE_FSS &&
|
||||||
((!X.RDB$CHARACTER_LENGTH.NULL &&
|
((!X.RDB$CHARACTER_LENGTH.NULL &&
|
||||||
(X.RDB$FIELD_TYPE == blr_text || X.RDB$FIELD_TYPE == blr_varying)) ||
|
(X.RDB$FIELD_TYPE == blr_text || X.RDB$FIELD_TYPE == blr_varying)) ||
|
||||||
X.RDB$FIELD_TYPE == blr_blob))
|
X.RDB$FIELD_TYPE == blr_blob))
|
||||||
{
|
{
|
||||||
if (X.RDB$FIELD_TYPE != blr_blob)
|
if (X.RDB$FIELD_TYPE != blr_blob)
|
||||||
X.RDB$CHARACTER_LENGTH = X.RDB$FIELD_LENGTH;
|
X.RDB$CHARACTER_LENGTH = X.RDB$FIELD_LENGTH;
|
||||||
@ -4423,8 +4393,7 @@ bool get_global_field(BurpGlobals* tdgbl)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_index(BurpGlobals* tdgbl,
|
bool get_index(BurpGlobals* tdgbl, const burp_rel* relation)
|
||||||
const burp_rel* relation)
|
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -4709,8 +4678,7 @@ bool get_procedure(BurpGlobals* tdgbl)
|
|||||||
SSHORT l;
|
SSHORT l;
|
||||||
scan_attr_t scan_next_attr;
|
scan_attr_t scan_next_attr;
|
||||||
|
|
||||||
isc_tr_handle local_trans =
|
isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
|
||||||
tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
|
|
||||||
|
|
||||||
burp_prc* procedure = (burp_prc*) BURP_alloc_zero (sizeof(burp_prc));
|
burp_prc* procedure = (burp_prc*) BURP_alloc_zero (sizeof(burp_prc));
|
||||||
procedure->prc_next = tdgbl->procedures;
|
procedure->prc_next = tdgbl->procedures;
|
||||||
@ -4739,8 +4707,8 @@ bool get_procedure(BurpGlobals* tdgbl)
|
|||||||
{
|
{
|
||||||
case att_procedure_name:
|
case att_procedure_name:
|
||||||
l = GET_TEXT(X.RDB$PROCEDURE_NAME);
|
l = GET_TEXT(X.RDB$PROCEDURE_NAME);
|
||||||
procedure->prc_name_length = l;
|
procedure->prc_name_length = l;
|
||||||
strcpy (procedure->prc_name, X.RDB$PROCEDURE_NAME);
|
strcpy (procedure->prc_name, X.RDB$PROCEDURE_NAME);
|
||||||
MISC_terminate (X.RDB$PROCEDURE_NAME, temp, l, sizeof(temp));
|
MISC_terminate (X.RDB$PROCEDURE_NAME, temp, l, sizeof(temp));
|
||||||
BURP_verbose (195, temp);
|
BURP_verbose (195, temp);
|
||||||
// msg 195 restoring stored procedure %s
|
// msg 195 restoring stored procedure %s
|
||||||
@ -4850,8 +4818,8 @@ bool get_procedure(BurpGlobals* tdgbl)
|
|||||||
{
|
{
|
||||||
case att_procedure_name:
|
case att_procedure_name:
|
||||||
l = GET_TEXT(X.RDB$PROCEDURE_NAME);
|
l = GET_TEXT(X.RDB$PROCEDURE_NAME);
|
||||||
procedure->prc_name_length = l;
|
procedure->prc_name_length = l;
|
||||||
strcpy (procedure->prc_name, X.RDB$PROCEDURE_NAME);
|
strcpy (procedure->prc_name, X.RDB$PROCEDURE_NAME);
|
||||||
MISC_terminate (X.RDB$PROCEDURE_NAME, temp, l, sizeof(temp));
|
MISC_terminate (X.RDB$PROCEDURE_NAME, temp, l, sizeof(temp));
|
||||||
BURP_verbose (195, temp);
|
BURP_verbose (195, temp);
|
||||||
// msg 195 restoring stored procedure %s
|
// msg 195 restoring stored procedure %s
|
||||||
@ -4951,8 +4919,7 @@ bool get_procedure_prm (BurpGlobals* tdgbl, GDS_NAME procptr)
|
|||||||
TEXT temp[GDS_NAME_LEN];
|
TEXT temp[GDS_NAME_LEN];
|
||||||
scan_attr_t scan_next_attr;
|
scan_attr_t scan_next_attr;
|
||||||
|
|
||||||
isc_tr_handle local_trans =
|
isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
|
||||||
tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
|
|
||||||
|
|
||||||
if (tdgbl->RESTORE_ods >= DB_VERSION_DDL11_1)
|
if (tdgbl->RESTORE_ods >= DB_VERSION_DDL11_1)
|
||||||
{
|
{
|
||||||
@ -4960,7 +4927,7 @@ bool get_procedure_prm (BurpGlobals* tdgbl, GDS_NAME procptr)
|
|||||||
REQUEST_HANDLE tdgbl->handles_get_procedure_prm_req_handle1)
|
REQUEST_HANDLE tdgbl->handles_get_procedure_prm_req_handle1)
|
||||||
X IN RDB$PROCEDURE_PARAMETERS
|
X IN RDB$PROCEDURE_PARAMETERS
|
||||||
|
|
||||||
strcpy (X.RDB$PROCEDURE_NAME, procptr);
|
strcpy(X.RDB$PROCEDURE_NAME, procptr);
|
||||||
|
|
||||||
X.RDB$DESCRIPTION.NULL = TRUE;
|
X.RDB$DESCRIPTION.NULL = TRUE;
|
||||||
X.RDB$DEFAULT_VALUE.NULL = TRUE;
|
X.RDB$DEFAULT_VALUE.NULL = TRUE;
|
||||||
@ -6265,8 +6232,7 @@ bool get_trigger(BurpGlobals* tdgbl)
|
|||||||
BASED_ON RDB$TRIGGERS.RDB$TRIGGER_NAME name;
|
BASED_ON RDB$TRIGGERS.RDB$TRIGGER_NAME name;
|
||||||
scan_attr_t scan_next_attr;
|
scan_attr_t scan_next_attr;
|
||||||
|
|
||||||
isc_tr_handle local_trans =
|
isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
|
||||||
tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
|
|
||||||
|
|
||||||
if (tdgbl->RESTORE_ods >= DB_VERSION_DDL11_1)
|
if (tdgbl->RESTORE_ods >= DB_VERSION_DDL11_1)
|
||||||
{
|
{
|
||||||
@ -6548,8 +6514,7 @@ bool get_trigger_message(BurpGlobals* tdgbl)
|
|||||||
if (flag)
|
if (flag)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
isc_tr_handle local_trans =
|
isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
|
||||||
tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
|
|
||||||
|
|
||||||
STORE (TRANSACTION_HANDLE local_trans
|
STORE (TRANSACTION_HANDLE local_trans
|
||||||
REQUEST_HANDLE tdgbl->handles_get_trigger_message_req_handle2)
|
REQUEST_HANDLE tdgbl->handles_get_trigger_message_req_handle2)
|
||||||
@ -6885,8 +6850,7 @@ bool get_view(BurpGlobals* tdgbl,
|
|||||||
|
|
||||||
// If there is a global transaction then use it
|
// If there is a global transaction then use it
|
||||||
|
|
||||||
isc_tr_handle local_trans =
|
isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
|
||||||
tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
|
|
||||||
|
|
||||||
STORE (TRANSACTION_HANDLE local_trans
|
STORE (TRANSACTION_HANDLE local_trans
|
||||||
REQUEST_HANDLE tdgbl->handles_get_view_req_handle1)
|
REQUEST_HANDLE tdgbl->handles_get_view_req_handle1)
|
||||||
|
@ -120,27 +120,22 @@ const size_t b_fil_len = sizeof(b_fil);
|
|||||||
******************************************************
|
******************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int conv_ntoc(SLONG, TEXT *);
|
static int conv_ntoc(SLONG, TEXT*);
|
||||||
static int free_file_list(b_fil*);
|
static int free_file_list(b_fil*);
|
||||||
static int final_flush_io_buff(const UCHAR*, SLONG, FILE_DESC);
|
static int final_flush_io_buff(const UCHAR*, SLONG, FILE_DESC);
|
||||||
static int final_read_and_write(FILE_DESC, FILE_DESC,
|
static int final_read_and_write(FILE_DESC, FILE_DESC, const TEXT*, SLONG, UCHAR**, bool*);
|
||||||
const TEXT*, SLONG, UCHAR **, bool*);
|
static int flush_io_buff(const UCHAR*, SLONG, FILE_DESC, SINT64, SLONG*, bool*);
|
||||||
static int flush_io_buff(const UCHAR*, SLONG,
|
static int get_file_name(const SCHAR*, SINT64, b_fil**);
|
||||||
FILE_DESC, SINT64, SLONG*, bool*);
|
static int get_file_size(const SCHAR*, const SCHAR *, SINT64*);
|
||||||
static int get_file_name(const SCHAR *, SINT64, b_fil**);
|
static int get_function_option(const SCHAR*, gsplit_option*, const SCHAR*, const in_sw_tab_t* const);
|
||||||
static int get_file_size(const SCHAR *, const SCHAR *, SINT64*);
|
|
||||||
static int get_function_option(const SCHAR *, gsplit_option*, const SCHAR *,
|
|
||||||
const in_sw_tab_t* const);
|
|
||||||
static int gen_multy_bakup_files(b_fil*, FILE_DESC, SLONG);
|
static int gen_multy_bakup_files(b_fil*, FILE_DESC, SLONG);
|
||||||
static int set_hdr_str(TEXT *, const TEXT *, SLONG, SLONG);
|
static int set_hdr_str(TEXT*, const TEXT*, SLONG, SLONG);
|
||||||
static int join_multy_bakup_files(b_fil*);
|
static int join_multy_bakup_files(b_fil*);
|
||||||
static int print_clo(const TEXT *);
|
static int print_clo(const TEXT*);
|
||||||
static int read_and_write(FILE_DESC, FILE_DESC,
|
static int read_and_write(FILE_DESC, FILE_DESC, const TEXT*, SLONG,
|
||||||
const TEXT*, SLONG,
|
SINT64, UCHAR**, bool*, SINT64*, SLONG*);
|
||||||
SINT64, UCHAR **, bool*, SINT64*, SLONG *);
|
static int read_and_write_for_join(FILE_DESC, const TEXT*, UCHAR**, SLONG, SLONG*);
|
||||||
static int read_and_write_for_join(FILE_DESC, const TEXT*,
|
static int write_header(const b_fil*, header_rec, FILE_DESC, TEXT*);
|
||||||
UCHAR **, SLONG, SLONG *);
|
|
||||||
static int write_header(const b_fil*, header_rec, FILE_DESC, TEXT *);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -153,14 +148,11 @@ static int write_header(const b_fil*, header_rec, FILE_DESC, TEXT *);
|
|||||||
|
|
||||||
int main( int argc, char *argv[])
|
int main( int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SLONG ret_cd, file_num = 0;
|
|
||||||
|
|
||||||
const SCHAR *prog_name = argv[0];
|
const SCHAR *prog_name = argv[0];
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
fprintf(stderr, "%s: No Command Line Option Specified\n",
|
fprintf(stderr, "%s: No Command Line Option Specified\n", argv[0]);
|
||||||
argv[0]);
|
print_clo(prog_name);
|
||||||
ret_cd = print_clo(prog_name);
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,8 +172,7 @@ int main( int argc, char *argv[])
|
|||||||
*******************************
|
*******************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (in_sw_tab_t* in_sw_tab = spit_in_sw_table; in_sw_tab->in_sw_name;
|
for (in_sw_tab_t* in_sw_tab = spit_in_sw_table; in_sw_tab->in_sw_name; in_sw_tab++)
|
||||||
in_sw_tab++)
|
|
||||||
{
|
{
|
||||||
in_sw_tab->in_sw_state = false;
|
in_sw_tab->in_sw_state = false;
|
||||||
}
|
}
|
||||||
@ -191,6 +182,7 @@ int main( int argc, char *argv[])
|
|||||||
***********************************
|
***********************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
SLONG ret_cd, file_num = 0;
|
||||||
bool file_nm_sw = false;
|
bool file_nm_sw = false;
|
||||||
const SCHAR* string = NULL;
|
const SCHAR* string = NULL;
|
||||||
|
|
||||||
@ -201,8 +193,7 @@ int main( int argc, char *argv[])
|
|||||||
string = *argv;
|
string = *argv;
|
||||||
if (*string == '-') {
|
if (*string == '-') {
|
||||||
argv++;
|
argv++;
|
||||||
ret_cd = get_function_option(prog_name, &sw_replace,
|
ret_cd = get_function_option(prog_name, &sw_replace, string, spit_in_sw_table);
|
||||||
string, spit_in_sw_table);
|
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
ret_cd = free_file_list(file_list);
|
ret_cd = free_file_list(file_list);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
@ -213,28 +204,24 @@ int main( int argc, char *argv[])
|
|||||||
switch (sw_replace)
|
switch (sw_replace)
|
||||||
{
|
{
|
||||||
case IN_SW_SPIT_SP:
|
case IN_SW_SPIT_SP:
|
||||||
if (!file_nm_sw) { // process file name
|
if (!file_nm_sw)
|
||||||
|
{ // process file name
|
||||||
file_size = 0;
|
file_size = 0;
|
||||||
file_num = file_num + 1;
|
file_num = file_num + 1;
|
||||||
|
|
||||||
if (file_num > MAX_NUM_OF_FILES) {
|
if (file_num > MAX_NUM_OF_FILES) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s: maximum of files is %d\n", prog_name, MAX_NUM_OF_FILES);
|
||||||
"%s: maximum of files is %d\n",
|
print_clo(prog_name);
|
||||||
prog_name, MAX_NUM_OF_FILES);
|
free_file_list(file_list);
|
||||||
ret_cd = print_clo(prog_name);
|
|
||||||
ret_cd = free_file_list(file_list);
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(string) > MAX_FILE_NM_LEN) {
|
if (strlen(string) > MAX_FILE_NM_LEN) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s: file name %s is too long\n", prog_name, string);
|
||||||
"%s: file name %s is too long\n",
|
fprintf(stderr, "%s: maximum length of file name is %d bytes\n",
|
||||||
prog_name, string);
|
|
||||||
fprintf(stderr,
|
|
||||||
"%s: maximum length of file name is %d bytes\n",
|
|
||||||
prog_name, MAX_FILE_NM_LEN);
|
prog_name, MAX_FILE_NM_LEN);
|
||||||
ret_cd = print_clo(prog_name);
|
print_clo(prog_name);
|
||||||
ret_cd = free_file_list(file_list);
|
free_file_list(file_list);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,8 +275,7 @@ int main( int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "%s: invalid option '%s'\n",
|
fprintf(stderr, "%s: invalid option '%s'\n", prog_name, string);
|
||||||
prog_name, string);
|
|
||||||
ret_cd = print_clo(prog_name);
|
ret_cd = print_clo(prog_name);
|
||||||
ret_cd = free_file_list(file_list);
|
ret_cd = free_file_list(file_list);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
@ -300,23 +286,20 @@ int main( int argc, char *argv[])
|
|||||||
} // while (argv < end)
|
} // while (argv < end)
|
||||||
|
|
||||||
if (!file_list && sw_replace != IN_SW_SPIT_0) {
|
if (!file_list && sw_replace != IN_SW_SPIT_0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s: invalid option '%s', rest of parameters is missing\n", prog_name, string);
|
||||||
"%s: invalid option '%s', rest of parameters is missing\n",
|
|
||||||
prog_name, string);
|
|
||||||
ret_cd = print_clo(prog_name);
|
ret_cd = print_clo(prog_name);
|
||||||
ret_cd = free_file_list(file_list);
|
ret_cd = free_file_list(file_list);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_DESC input_file_desc;
|
FILE_DESC input_file_desc;
|
||||||
switch (sw_replace) {
|
switch (sw_replace)
|
||||||
|
{
|
||||||
case IN_SW_SPIT_SP:
|
case IN_SW_SPIT_SP:
|
||||||
input_file_desc = GBAK_STDIN_DESC;
|
input_file_desc = GBAK_STDIN_DESC;
|
||||||
ret_cd = gen_multy_bakup_files(file_list, input_file_desc, file_num);
|
ret_cd = gen_multy_bakup_files(file_list, input_file_desc, file_num);
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s: progam fails to generate multi-volumn back-up files\n", prog_name);
|
||||||
"%s: progam fails to generate multi-volumn back-up files\n",
|
|
||||||
prog_name);
|
|
||||||
ret_cd = free_file_list(file_list);
|
ret_cd = free_file_list(file_list);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
@ -325,9 +308,7 @@ int main( int argc, char *argv[])
|
|||||||
case IN_SW_SPIT_JT:
|
case IN_SW_SPIT_JT:
|
||||||
ret_cd = join_multy_bakup_files(file_list);
|
ret_cd = join_multy_bakup_files(file_list);
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s: progam fails to join multi-volumn back-up files\n", prog_name);
|
||||||
"%s: progam fails to join multi-volumn back-up files\n",
|
|
||||||
prog_name);
|
|
||||||
ret_cd = free_file_list(file_list);
|
ret_cd = free_file_list(file_list);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
@ -394,9 +375,7 @@ static int get_function_option(const SCHAR* prog_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*sw_replace != in_sw_tab->in_sw) {
|
if (*sw_replace != in_sw_tab->in_sw) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s: invalid option '%s', incompatible option\n", prog_name, string);
|
||||||
"%s: invalid option '%s', incompatible option\n",
|
|
||||||
prog_name, string);
|
|
||||||
ret_cd = print_clo(prog_name);
|
ret_cd = print_clo(prog_name);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
@ -576,22 +555,19 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL
|
|||||||
header_str[pos] = BLANK;
|
header_str[pos] = BLANK;
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
ret_cd = set_hdr_str(header_str, header_rec_name,
|
ret_cd = set_hdr_str(header_str, header_rec_name, pos, sizeof(hdr_rec.name));
|
||||||
pos, sizeof(hdr_rec.name));
|
|
||||||
size_t indx;
|
size_t indx;
|
||||||
for (indx = 0; indx < sizeof(hdr_rec.name); indx++)
|
for (indx = 0; indx < sizeof(hdr_rec.name); indx++)
|
||||||
hdr_rec.name[indx] = BLANK;
|
hdr_rec.name[indx] = BLANK;
|
||||||
|
|
||||||
pos = pos + sizeof(hdr_rec.name);
|
pos = pos + sizeof(hdr_rec.name);
|
||||||
time_t clock = time(0); // was SLONG
|
time_t clock = time(0); // was SLONG
|
||||||
ret_cd = set_hdr_str(header_str, ctime(&clock),
|
ret_cd = set_hdr_str(header_str, ctime(&clock), pos, sizeof(hdr_rec.date_time));
|
||||||
pos, sizeof(hdr_rec.date_time));
|
|
||||||
for (indx = 0; indx < sizeof(hdr_rec.date_time); indx++)
|
for (indx = 0; indx < sizeof(hdr_rec.date_time); indx++)
|
||||||
hdr_rec.date_time[indx] = BLANK;
|
hdr_rec.date_time[indx] = BLANK;
|
||||||
|
|
||||||
pos = pos + sizeof(hdr_rec.date_time);
|
pos = pos + sizeof(hdr_rec.date_time);
|
||||||
ret_cd = set_hdr_str(header_str, ", file No. ",
|
ret_cd = set_hdr_str(header_str, ", file No. ", pos, sizeof(hdr_rec.text1));
|
||||||
pos, sizeof(hdr_rec.text1));
|
|
||||||
for (indx = 0; indx < sizeof(hdr_rec.text1); indx++)
|
for (indx = 0; indx < sizeof(hdr_rec.text1); indx++)
|
||||||
hdr_rec.text1[indx] = BLANK;
|
hdr_rec.text1[indx] = BLANK;
|
||||||
|
|
||||||
@ -606,8 +582,7 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL
|
|||||||
ret_cd = conv_ntoc(file_num, num_arr);
|
ret_cd = conv_ntoc(file_num, num_arr);
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
free(io_buffer);
|
free(io_buffer);
|
||||||
fprintf(stderr,
|
fprintf(stderr, "gsplit could not convert numeric data to character data\n");
|
||||||
"gsplit could not convert numeric data to character data\n");
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +609,8 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL
|
|||||||
SINT64 byte_read = 0;
|
SINT64 byte_read = 0;
|
||||||
SINT64 file_size = 0;
|
SINT64 file_size = 0;
|
||||||
|
|
||||||
while (true) {
|
while (true)
|
||||||
|
{
|
||||||
if (fl_ptr != NULL) {
|
if (fl_ptr != NULL) {
|
||||||
byte_read = 0;
|
byte_read = 0;
|
||||||
byte_write = 0;
|
byte_write = 0;
|
||||||
@ -649,18 +625,14 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL
|
|||||||
output_fl_desc = open(file_name, mode_write, mask);
|
output_fl_desc = open(file_name, mode_write, mask);
|
||||||
if (output_fl_desc == -1) {
|
if (output_fl_desc == -1) {
|
||||||
free(io_buffer);
|
free(io_buffer);
|
||||||
fprintf(stderr, "can not open back up file %s\n",
|
fprintf(stderr, "can not open back up file %s\n", file_name);
|
||||||
file_name);
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret_cd =
|
ret_cd = write_header(fl_ptr, hdr_rec, output_fl_desc, header_str);
|
||||||
write_header(fl_ptr, hdr_rec, output_fl_desc, header_str);
|
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
free(io_buffer);
|
free(io_buffer);
|
||||||
fprintf(stderr,
|
fprintf(stderr, "could not write header record to file %s\n", file_name);
|
||||||
"could not write header record to file %s\n",
|
|
||||||
file_name);
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,11 +644,12 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL
|
|||||||
else
|
else
|
||||||
io_size = IO_BUFFER_SIZE;
|
io_size = IO_BUFFER_SIZE;
|
||||||
|
|
||||||
if (!fl_ptr) {
|
if (!fl_ptr)
|
||||||
while (!end_of_input) {
|
{
|
||||||
|
while (!end_of_input)
|
||||||
|
{
|
||||||
ret_cd = final_read_and_write(input_file_desc, output_fl_desc,
|
ret_cd = final_read_and_write(input_file_desc, output_fl_desc,
|
||||||
file_name, io_size, &io_buffer,
|
file_name, io_size, &io_buffer, &end_of_input);
|
||||||
&end_of_input);
|
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
free(io_buffer);
|
free(io_buffer);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
@ -688,13 +661,16 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
while ((file_size > byte_read) && (fl_ptr != NULL)) {
|
{
|
||||||
|
while ((file_size > byte_read) && (fl_ptr != NULL))
|
||||||
|
{
|
||||||
ret_cd = read_and_write(input_file_desc, output_fl_desc,
|
ret_cd = read_and_write(input_file_desc, output_fl_desc,
|
||||||
file_name, io_size, file_size,
|
file_name, io_size, file_size,
|
||||||
&io_buffer, &end_of_input,
|
&io_buffer, &end_of_input,
|
||||||
&byte_read, &byte_write);
|
&byte_read, &byte_write);
|
||||||
switch (ret_cd) {
|
switch (ret_cd)
|
||||||
|
{
|
||||||
case FB_FAILURE:
|
case FB_FAILURE:
|
||||||
free(io_buffer);
|
free(io_buffer);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
@ -706,42 +682,36 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL
|
|||||||
*/
|
*/
|
||||||
const UCHAR* remaining_io = io_buffer + byte_write;
|
const UCHAR* remaining_io = io_buffer + byte_write;
|
||||||
SLONG remaining_io_len = IO_BUFFER_SIZE - byte_write;
|
SLONG remaining_io_len = IO_BUFFER_SIZE - byte_write;
|
||||||
while (!flush_done && (fl_ptr != NULL)) {
|
while (!flush_done && (fl_ptr != NULL))
|
||||||
|
{
|
||||||
if (!fl_ptr->b_fil_next && fl_ptr->b_fil_size == 0)
|
if (!fl_ptr->b_fil_next && fl_ptr->b_fil_size == 0)
|
||||||
fl_ptr->b_fil_size = MIN_FILE_SIZE;
|
fl_ptr->b_fil_size = MIN_FILE_SIZE;
|
||||||
|
|
||||||
file_size = fl_ptr->b_fil_size - header_rec_len;
|
file_size = fl_ptr->b_fil_size - header_rec_len;
|
||||||
file_name = fl_ptr->b_fil_name;
|
file_name = fl_ptr->b_fil_name;
|
||||||
|
|
||||||
output_fl_desc =
|
output_fl_desc = open(file_name, mode_write, mask);
|
||||||
open(file_name, mode_write, mask);
|
|
||||||
if (output_fl_desc == -1) {
|
if (output_fl_desc == -1) {
|
||||||
free(io_buffer);
|
free(io_buffer);
|
||||||
fprintf(stderr,
|
fprintf(stderr, "can not open back up file %s\n", file_name);
|
||||||
"can not open back up file %s\n",
|
|
||||||
file_name);
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
ret_cd = write_header(fl_ptr, hdr_rec,
|
ret_cd = write_header(fl_ptr, hdr_rec, output_fl_desc, header_str);
|
||||||
output_fl_desc, header_str);
|
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
free(io_buffer);
|
free(io_buffer);
|
||||||
fprintf(stderr,
|
fprintf(stderr, "fail to write header rec to file %s\n", file_name);
|
||||||
"fail to write header rec to file %s\n",
|
|
||||||
file_name);
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_ptr = fl_ptr->b_fil_next;
|
fl_ptr = fl_ptr->b_fil_next;
|
||||||
if (!fl_ptr) {
|
if (!fl_ptr)
|
||||||
|
{
|
||||||
ret_cd = final_flush_io_buff(remaining_io,
|
ret_cd = final_flush_io_buff(remaining_io,
|
||||||
remaining_io_len,
|
remaining_io_len,
|
||||||
output_fl_desc);
|
output_fl_desc);
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "gsplit could not do backup due");
|
||||||
"gsplit could not do backup due");
|
fprintf(stderr, " to lack of space or I/O problem\n");
|
||||||
fprintf(stderr,
|
|
||||||
" to lack of space or I/O problem\n");
|
|
||||||
free(io_buffer);
|
free(io_buffer);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
@ -755,8 +725,7 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL
|
|||||||
&byte_write,
|
&byte_write,
|
||||||
&flush_done);
|
&flush_done);
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "gsplit could not do backup due");
|
||||||
"gsplit could not do backup due");
|
|
||||||
fprintf(stderr, " I/O problem\n");
|
fprintf(stderr, " I/O problem\n");
|
||||||
free(io_buffer);
|
free(io_buffer);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
@ -831,7 +800,8 @@ static int read_and_write(FILE_DESC input_file_desc,
|
|||||||
else
|
else
|
||||||
read_cnt = read(input_file_desc, *io_buffer, io_size);
|
read_cnt = read(input_file_desc, *io_buffer, io_size);
|
||||||
|
|
||||||
switch (read_cnt) {
|
switch (read_cnt)
|
||||||
|
{
|
||||||
case 0: // no more data to be read
|
case 0: // no more data to be read
|
||||||
close(output_fl_desc);
|
close(output_fl_desc);
|
||||||
*end_of_input = true;
|
*end_of_input = true;
|
||||||
@ -840,8 +810,7 @@ static int read_and_write(FILE_DESC input_file_desc,
|
|||||||
|
|
||||||
case -1: // read failed
|
case -1: // read failed
|
||||||
close(output_fl_desc);
|
close(output_fl_desc);
|
||||||
fprintf(stderr,
|
fprintf(stderr, "fail to read input from stdin, errno = %d\n", errno);
|
||||||
"fail to read input from stdin, errno = %d\n", errno);
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
|
|
||||||
default: // read ok
|
default: // read ok
|
||||||
@ -851,7 +820,8 @@ static int read_and_write(FILE_DESC input_file_desc,
|
|||||||
|
|
||||||
const SLONG write_cnt = write(output_fl_desc, *io_buffer, read_cnt);
|
const SLONG write_cnt = write(output_fl_desc, *io_buffer, read_cnt);
|
||||||
|
|
||||||
switch (write_cnt) {
|
switch (write_cnt)
|
||||||
|
{
|
||||||
case -1: // write failed
|
case -1: // write failed
|
||||||
close(output_fl_desc);
|
close(output_fl_desc);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
@ -892,7 +862,8 @@ static int final_read_and_write(FILE_DESC input_file_desc,
|
|||||||
|
|
||||||
const SLONG read_cnt = read(input_file_desc, *io_buffer, io_size);
|
const SLONG read_cnt = read(input_file_desc, *io_buffer, io_size);
|
||||||
|
|
||||||
switch (read_cnt) {
|
switch (read_cnt)
|
||||||
|
{
|
||||||
case 0: // no more data to be read
|
case 0: // no more data to be read
|
||||||
close(output_fl_desc);
|
close(output_fl_desc);
|
||||||
*end_of_input = true;
|
*end_of_input = true;
|
||||||
@ -900,8 +871,7 @@ static int final_read_and_write(FILE_DESC input_file_desc,
|
|||||||
|
|
||||||
case -1: // read failed
|
case -1: // read failed
|
||||||
close(output_fl_desc);
|
close(output_fl_desc);
|
||||||
fprintf(stderr,
|
fprintf(stderr, "problem when reading input file, errno = %d\n", errno);
|
||||||
"problem when reading input file, errno = %d\n", errno);
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
|
|
||||||
default: // read ok
|
default: // read ok
|
||||||
@ -910,7 +880,8 @@ static int final_read_and_write(FILE_DESC input_file_desc,
|
|||||||
|
|
||||||
const SLONG write_cnt = write(output_fl_desc, *io_buffer, read_cnt);
|
const SLONG write_cnt = write(output_fl_desc, *io_buffer, read_cnt);
|
||||||
|
|
||||||
switch (write_cnt) {
|
switch (write_cnt)
|
||||||
|
{
|
||||||
case -1: // write failed
|
case -1: // write failed
|
||||||
close(output_fl_desc);
|
close(output_fl_desc);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
@ -919,9 +890,7 @@ static int final_read_and_write(FILE_DESC input_file_desc,
|
|||||||
if (write_cnt == read_cnt) // write ok
|
if (write_cnt == read_cnt) // write ok
|
||||||
return FB_SUCCESS;
|
return FB_SUCCESS;
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr, "There is no enough space to write to back up file %s\n", file_name);
|
||||||
"There is no enough space to write to back up file %s\n",
|
|
||||||
file_name);
|
|
||||||
close(output_fl_desc);
|
close(output_fl_desc);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
@ -968,9 +937,7 @@ static int join_multy_bakup_files( b_fil* file_list)
|
|||||||
next_fl = fl_ptr->b_fil_next;
|
next_fl = fl_ptr->b_fil_next;
|
||||||
const TEXT* file_name = fl_ptr->b_fil_name;
|
const TEXT* file_name = fl_ptr->b_fil_name;
|
||||||
|
|
||||||
SLONG ret_cd =
|
SLONG ret_cd = read_and_write_for_join(output_fl_desc, file_name, &io_buffer, cnt, &total_int);
|
||||||
read_and_write_for_join(output_fl_desc, file_name, &io_buffer,
|
|
||||||
cnt, &total_int);
|
|
||||||
|
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
free(io_buffer);
|
free(io_buffer);
|
||||||
@ -1017,9 +984,7 @@ static int read_and_write_for_join(FILE_DESC output_fl_desc,
|
|||||||
int read_cnt = read(input_fl_desc, *io_buffer, header_rec_len);
|
int read_cnt = read(input_fl_desc, *io_buffer, header_rec_len);
|
||||||
if (read_cnt != static_cast<int>(header_rec_len)) {
|
if (read_cnt != static_cast<int>(header_rec_len)) {
|
||||||
close(input_fl_desc);
|
close(input_fl_desc);
|
||||||
fprintf(stderr,
|
fprintf(stderr, "progam fails to read gsplit header record in back-up file%s\n", file_name);
|
||||||
"progam fails to read gsplit header record in back-up file%s\n",
|
|
||||||
file_name);
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1028,13 +993,11 @@ static int read_and_write_for_join(FILE_DESC output_fl_desc,
|
|||||||
if (ret_cd != 0) {
|
if (ret_cd != 0) {
|
||||||
close(input_fl_desc);
|
close(input_fl_desc);
|
||||||
fprintf(stderr, "gsplit: expected GSPLIT description record\n");
|
fprintf(stderr, "gsplit: expected GSPLIT description record\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr, "gsplit: Exiting before completion due to errors\n");
|
||||||
"gsplit: Exiting before completion due to errors\n");
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SLONG skip_to_num = sizeof(hdr_rec.name) + sizeof(hdr_rec.date_time) +
|
SLONG skip_to_num = sizeof(hdr_rec.name) + sizeof(hdr_rec.date_time) + sizeof(hdr_rec.text1);
|
||||||
sizeof(hdr_rec.text1);
|
|
||||||
SLONG skip_to_total = skip_to_num + sizeof(hdr_rec.num) + sizeof(hdr_rec.text2);
|
SLONG skip_to_total = skip_to_num + sizeof(hdr_rec.num) + sizeof(hdr_rec.text2);
|
||||||
|
|
||||||
char_ptr1 = reinterpret_cast<char*>(*io_buffer + skip_to_num);
|
char_ptr1 = reinterpret_cast<char*>(*io_buffer + skip_to_num);
|
||||||
@ -1057,18 +1020,18 @@ static int read_and_write_for_join(FILE_DESC output_fl_desc,
|
|||||||
|
|
||||||
if ((num_int != cnt) || (num_int > *total_int)) {
|
if ((num_int != cnt) || (num_int > *total_int)) {
|
||||||
close(input_fl_desc);
|
close(input_fl_desc);
|
||||||
fprintf(stderr,
|
fprintf(stderr, "gsplit: join backup file is out of sequence\n");
|
||||||
"gsplit: join backup file is out of sequence\n");
|
fprintf(stderr, "gsplit: Exiting before completion due to errors\n");
|
||||||
fprintf(stderr,
|
|
||||||
"gsplit: Exiting before completion due to errors\n");
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
read_cnt = read(input_fl_desc, *io_buffer, IO_BUFFER_SIZE);
|
read_cnt = read(input_fl_desc, *io_buffer, IO_BUFFER_SIZE);
|
||||||
|
|
||||||
|
|
||||||
while (true) {
|
while (true)
|
||||||
switch (read_cnt) {
|
{
|
||||||
|
switch (read_cnt)
|
||||||
|
{
|
||||||
case 0: // no more data to be read
|
case 0: // no more data to be read
|
||||||
close(input_fl_desc);
|
close(input_fl_desc);
|
||||||
return FB_SUCCESS;
|
return FB_SUCCESS;
|
||||||
@ -1083,7 +1046,8 @@ static int read_and_write_for_join(FILE_DESC output_fl_desc,
|
|||||||
|
|
||||||
SLONG write_cnt = write(output_fl_desc, *io_buffer, read_cnt);
|
SLONG write_cnt = write(output_fl_desc, *io_buffer, read_cnt);
|
||||||
|
|
||||||
switch (write_cnt) {
|
switch (write_cnt)
|
||||||
|
{
|
||||||
case -1: // write failed
|
case -1: // write failed
|
||||||
close(input_fl_desc);
|
close(input_fl_desc);
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
@ -1164,13 +1128,11 @@ static int write_header(const b_fil* fl_ptr,
|
|||||||
|
|
||||||
SLONG ret_cd = conv_ntoc(fl_ptr->b_fil_number, num_arr);
|
SLONG ret_cd = conv_ntoc(fl_ptr->b_fil_number, num_arr);
|
||||||
if (ret_cd == FB_FAILURE) {
|
if (ret_cd == FB_FAILURE) {
|
||||||
printf
|
printf("gsplit could not convert numeric data to character data\n");
|
||||||
("gsplit could not convert numeric data to character data\n");
|
|
||||||
return FB_FAILURE;
|
return FB_FAILURE;
|
||||||
}
|
}
|
||||||
num_arr[sizeof(num_arr) - 1] = TERMINAL;
|
num_arr[sizeof(num_arr) - 1] = TERMINAL;
|
||||||
SLONG pos = sizeof(hdr_rec.name) + sizeof(hdr_rec.date_time) +
|
SLONG pos = sizeof(hdr_rec.name) + sizeof(hdr_rec.date_time) + sizeof(hdr_rec.text1);
|
||||||
sizeof(hdr_rec.text1);
|
|
||||||
ret_cd = set_hdr_str(header_str, num_arr, pos, sizeof(hdr_rec.num));
|
ret_cd = set_hdr_str(header_str, num_arr, pos, sizeof(hdr_rec.num));
|
||||||
|
|
||||||
const TEXT* file_name = fl_ptr->b_fil_name;
|
const TEXT* file_name = fl_ptr->b_fil_name;
|
||||||
@ -1235,12 +1197,11 @@ static int flush_io_buff(const UCHAR* remaining_io,
|
|||||||
write_cnt = write(output_fl_desc, remaining_io, remaining_io_len);
|
write_cnt = write(output_fl_desc, remaining_io, remaining_io_len);
|
||||||
}
|
}
|
||||||
else { /* file_size <= remaining_io_len */
|
else { /* file_size <= remaining_io_len */
|
||||||
|
write_cnt = write(output_fl_desc, remaining_io, (unsigned int) file_size);
|
||||||
write_cnt =
|
|
||||||
write(output_fl_desc, remaining_io, (unsigned int) file_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (write_cnt) {
|
switch (write_cnt)
|
||||||
|
{
|
||||||
case -1: // write failed
|
case -1: // write failed
|
||||||
close(output_fl_desc);
|
close(output_fl_desc);
|
||||||
*flush_done = false;
|
*flush_done = false;
|
||||||
@ -1250,7 +1211,6 @@ static int flush_io_buff(const UCHAR* remaining_io,
|
|||||||
if (write_cnt == remaining_io_len) // write ok
|
if (write_cnt == remaining_io_len) // write ok
|
||||||
*flush_done = true;
|
*flush_done = true;
|
||||||
else { // could not write out all remaining data
|
else { // could not write out all remaining data
|
||||||
|
|
||||||
close(output_fl_desc);
|
close(output_fl_desc);
|
||||||
*flush_done = false;
|
*flush_done = false;
|
||||||
}
|
}
|
||||||
@ -1313,11 +1273,8 @@ static int print_clo(const TEXT* prog_name)
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" gsplit -S[PLIT_BK_FILE] <file> <size>{k|m|g} [... <file> [<size>{k|m|g}]] or\n");
|
" gsplit -S[PLIT_BK_FILE] <file> <size>{k|m|g} [... <file> [<size>{k|m|g}]] or\n");
|
||||||
fprintf(stderr, " gsplit -J[OINT_BK_FILE] <file> [... <file>]\n");
|
fprintf(stderr, " gsplit -J[OINT_BK_FILE] <file> [... <file>]\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s: option can be abbreviated to the unparenthesized characters\n", prog_name);
|
||||||
"%s: option can be abbreviated to the unparenthesized characters\n",
|
fprintf(stderr, "%s: Exiting before completion due to errors\n", prog_name);
|
||||||
prog_name);
|
|
||||||
fprintf(stderr,
|
|
||||||
"%s: Exiting before completion due to errors\n", prog_name);
|
|
||||||
|
|
||||||
return FB_SUCCESS;
|
return FB_SUCCESS;
|
||||||
|
|
||||||
@ -1342,7 +1299,8 @@ static int set_hdr_str(TEXT header_str[], const TEXT* in_str, SLONG pos, SLONG l
|
|||||||
const SLONG end = pos + len;
|
const SLONG end = pos + len;
|
||||||
|
|
||||||
for (SLONG indx = pos; indx < end; indx++) {
|
for (SLONG indx = pos; indx < end; indx++) {
|
||||||
switch (*t_str) {
|
switch (*t_str)
|
||||||
|
{
|
||||||
case NEW_LINE:
|
case NEW_LINE:
|
||||||
case TERMINAL:
|
case TERMINAL:
|
||||||
header_str[indx] = ' ';
|
header_str[indx] = ' ';
|
||||||
|
@ -82,8 +82,7 @@ bool ConfigFile::stripComments(string& s) const
|
|||||||
if (!inString) // we finished a quoted string
|
if (!inString) // we finished a quoted string
|
||||||
{
|
{
|
||||||
// We don't want trash after closing the quoted string, except comments
|
// We don't want trash after closing the quoted string, except comments
|
||||||
const string::size_type startPos =
|
const string::size_type startPos = s.find_first_not_of(" \t\r", iter + 1 - s.begin());
|
||||||
s.find_first_not_of(" \t\r", iter + 1 - s.begin());
|
|
||||||
if (startPos == string::npos || s[startPos] == '#')
|
if (startPos == string::npos || s[startPos] == '#')
|
||||||
{
|
{
|
||||||
s = s.substr(0, iter + 1 - s.begin());
|
s = s.substr(0, iter + 1 - s.begin());
|
||||||
@ -231,8 +230,8 @@ void ConfigFile::loadConfig()
|
|||||||
#ifdef EXCEPTION_ON_NO_CONF
|
#ifdef EXCEPTION_ON_NO_CONF
|
||||||
if (fExceptionOnError)
|
if (fExceptionOnError)
|
||||||
{
|
{
|
||||||
Firebird::string Msg = "Missing configuration file: " +
|
const Firebird::string Msg =
|
||||||
configFile.ToString() + ", exiting";
|
"Missing configuration file: " + configFile.ToString() + ", exiting";
|
||||||
Firebird::Syslog::Record(Firebird::Syslog::Error, Msg.c_str());
|
Firebird::Syslog::Record(Firebird::Syslog::Error, Msg.c_str());
|
||||||
Firebird::fatal_exception::raise(Msg.c_str());
|
Firebird::fatal_exception::raise(Msg.c_str());
|
||||||
}
|
}
|
||||||
@ -255,11 +254,11 @@ void ConfigFile::loadConfig()
|
|||||||
|
|
||||||
if (!goodLine || inputLine.find('=') == string::npos)
|
if (!goodLine || inputLine.find('=') == string::npos)
|
||||||
{
|
{
|
||||||
Firebird::string Msg = (configFile + ": illegal line \"" +
|
const Firebird::string Msg =
|
||||||
inputLine + "\"").ToString();
|
(configFile + ": illegal line \"" + inputLine + "\"").ToString();
|
||||||
Firebird::Syslog::Record(fExceptionOnError ?
|
Firebird::Syslog::Record(fExceptionOnError ?
|
||||||
Firebird::Syslog::Error :
|
Firebird::Syslog::Error : Firebird::Syslog::Warning,
|
||||||
Firebird::Syslog::Warning, Msg.c_str());
|
Msg.c_str());
|
||||||
#ifdef EXCEPTION_ON_NO_CONF
|
#ifdef EXCEPTION_ON_NO_CONF
|
||||||
BadLinesCount++;
|
BadLinesCount++;
|
||||||
#endif
|
#endif
|
||||||
|
@ -508,8 +508,7 @@ static void string_to_datetime(const dsc* desc,
|
|||||||
TEXT buffer[100]; // arbitrarily large
|
TEXT buffer[100]; // arbitrarily large
|
||||||
|
|
||||||
const char* p = NULL;
|
const char* p = NULL;
|
||||||
const USHORT length =
|
const USHORT length = CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err);
|
||||||
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err);
|
|
||||||
|
|
||||||
const char* const end = p + length;
|
const char* const end = p + length;
|
||||||
|
|
||||||
@ -945,8 +944,7 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err)
|
|||||||
case dtype_text:
|
case dtype_text:
|
||||||
{
|
{
|
||||||
USHORT length =
|
USHORT length =
|
||||||
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer,
|
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err);
|
||||||
sizeof(buffer), err);
|
|
||||||
scale -= CVT_decompose(p, length, dtype_long, &value, err);
|
scale -= CVT_decompose(p, length, dtype_long, &value, err);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1053,9 +1051,7 @@ double CVT_get_double(const dsc* desc, ErrorFunction err)
|
|||||||
const char* p;
|
const char* p;
|
||||||
|
|
||||||
const USHORT length =
|
const USHORT length =
|
||||||
CVT_make_string(desc, ttype_ascii,
|
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err);
|
||||||
&p,
|
|
||||||
(vary*) buffer, sizeof(buffer), err);
|
|
||||||
value = 0.0;
|
value = 0.0;
|
||||||
int scale = 0;
|
int scale = 0;
|
||||||
SSHORT sign = 0;
|
SSHORT sign = 0;
|
||||||
@ -1297,8 +1293,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case dtype_timestamp:
|
case dtype_timestamp:
|
||||||
*((GDS_DATE *) to->dsc_address) =
|
*((GDS_DATE *) to->dsc_address) = ((GDS_TIMESTAMP *) from->dsc_address)->timestamp_date;
|
||||||
((GDS_TIMESTAMP *) from->dsc_address)->timestamp_date;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1328,8 +1323,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case dtype_timestamp:
|
case dtype_timestamp:
|
||||||
*((GDS_TIME *) to->dsc_address) =
|
*((GDS_TIME *) to->dsc_address) = ((GDS_TIMESTAMP *) from->dsc_address)->timestamp_time;
|
||||||
((GDS_TIMESTAMP *) from->dsc_address)->timestamp_time;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1383,8 +1377,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
|
|||||||
{ // scope
|
{ // scope
|
||||||
USHORT strtype_unused;
|
USHORT strtype_unused;
|
||||||
UCHAR *ptr;
|
UCHAR *ptr;
|
||||||
length = l =
|
length = l = CVT_get_string_ptr(from, &strtype_unused, &ptr, NULL, 0, cb->err);
|
||||||
CVT_get_string_ptr(from, &strtype_unused, &ptr, NULL, 0, cb->err);
|
|
||||||
q = ptr;
|
q = ptr;
|
||||||
} // end scope
|
} // end scope
|
||||||
|
|
||||||
@ -1434,8 +1427,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case dtype_varying:
|
case dtype_varying:
|
||||||
length =
|
length = MIN(length, (SLONG) (to->dsc_length - sizeof(USHORT)));
|
||||||
MIN(length, (SLONG) (to->dsc_length - sizeof(USHORT)));
|
|
||||||
cb->validateData(toCharset, length, q, cb->err);
|
cb->validateData(toCharset, length, q, cb->err);
|
||||||
toLength = length;
|
toLength = length;
|
||||||
|
|
||||||
@ -2213,8 +2205,7 @@ SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, ErrorFunction err)
|
|||||||
case dtype_text:
|
case dtype_text:
|
||||||
{
|
{
|
||||||
USHORT length =
|
USHORT length =
|
||||||
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer,
|
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err);
|
||||||
sizeof(buffer), err);
|
|
||||||
scale -= CVT_decompose(p, length, dtype_quad, &value.high, err);
|
scale -= CVT_decompose(p, length, dtype_quad, &value.high, err);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2309,8 +2300,7 @@ SINT64 CVT_get_int64(const dsc* desc, SSHORT scale, ErrorFunction err)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case dtype_quad:
|
case dtype_quad:
|
||||||
value = (((SINT64) ((SLONG *) p)[HIGH_WORD]) << 32) +
|
value = (((SINT64) ((SLONG *) p)[HIGH_WORD]) << 32) + (((ULONG *) p)[LOW_WORD]);
|
||||||
(((ULONG *) p)[LOW_WORD]);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case dtype_real:
|
case dtype_real:
|
||||||
@ -2357,8 +2347,7 @@ SINT64 CVT_get_int64(const dsc* desc, SSHORT scale, ErrorFunction err)
|
|||||||
case dtype_text:
|
case dtype_text:
|
||||||
{
|
{
|
||||||
USHORT length =
|
USHORT length =
|
||||||
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer,
|
CVT_make_string(desc, ttype_ascii, &p, (vary*) buffer, sizeof(buffer), err);
|
||||||
sizeof(buffer), err);
|
|
||||||
scale -= CVT_decompose(p, length, dtype_int64, (SLONG *) & value, err);
|
scale -= CVT_decompose(p, length, dtype_int64, (SLONG *) & value, err);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -100,7 +100,7 @@ typedef struct dudley_ctx {
|
|||||||
struct sym* ctx_name;
|
struct sym* ctx_name;
|
||||||
struct dudley_rel* ctx_relation;
|
struct dudley_rel* ctx_relation;
|
||||||
struct dudley_fld* ctx_field;
|
struct dudley_fld* ctx_field;
|
||||||
USHORT ctx_view_rse;
|
bool ctx_view_rse;
|
||||||
USHORT ctx_context_id;
|
USHORT ctx_context_id;
|
||||||
} *DUDLEY_CTX;
|
} *DUDLEY_CTX;
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ typedef struct dudley_fld {
|
|||||||
SSHORT fld_position; /* field position */
|
SSHORT fld_position; /* field position */
|
||||||
SSHORT fld_segment_length;
|
SSHORT fld_segment_length;
|
||||||
SSHORT fld_sub_type;
|
SSHORT fld_sub_type;
|
||||||
SSHORT fld_has_sub_type;
|
bool fld_has_sub_type;
|
||||||
SSHORT fld_dimension; /* size of multi-dim. array */
|
SSHORT fld_dimension; /* size of multi-dim. array */
|
||||||
SSHORT fld_system; /* 0 if field is user defined */
|
SSHORT fld_system; /* 0 if field is user defined */
|
||||||
USHORT fld_flags; /* misc trash */
|
USHORT fld_flags; /* misc trash */
|
||||||
@ -236,7 +236,7 @@ typedef struct funcarg {
|
|||||||
SSHORT funcarg_length; /* argument length in bytes */
|
SSHORT funcarg_length; /* argument length in bytes */
|
||||||
SSHORT funcarg_return_arg; /* argument is the designated return arg */
|
SSHORT funcarg_return_arg; /* argument is the designated return arg */
|
||||||
SSHORT funcarg_sub_type; /* sub_type of text */
|
SSHORT funcarg_sub_type; /* sub_type of text */
|
||||||
SSHORT funcarg_has_sub_type; /* null field for sub_type field */
|
bool funcarg_has_sub_type; /* null field for sub_type field */
|
||||||
funcarg* funcarg_next; /* next field in function */
|
funcarg* funcarg_next; /* next field in function */
|
||||||
} *FUNCARG;
|
} *FUNCARG;
|
||||||
|
|
||||||
|
@ -1239,7 +1239,7 @@ static void add_global_field( DUDLEY_FLD field)
|
|||||||
if (DTYPE_IS_TEXT(make_dtype(desc.dsc_dtype))) {
|
if (DTYPE_IS_TEXT(make_dtype(desc.dsc_dtype))) {
|
||||||
field->fld_scale = 0;
|
field->fld_scale = 0;
|
||||||
field->fld_sub_type = desc.dsc_ttype();
|
field->fld_sub_type = desc.dsc_ttype();
|
||||||
field->fld_has_sub_type = TRUE;
|
field->fld_has_sub_type = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
field->fld_sub_type = 0;
|
field->fld_sub_type = 0;
|
||||||
@ -1746,10 +1746,8 @@ static void add_user_privilege( USERPRIV upriv)
|
|||||||
store_userpriv(upriv, grantor, priv, usr, upf);
|
store_userpriv(upriv, grantor, priv, usr, upf);
|
||||||
else
|
else
|
||||||
/* update is the only privilege with a possible field list */
|
/* update is the only privilege with a possible field list */
|
||||||
for (upf = upriv->userpriv_upflist; upf;
|
for (upf = upriv->userpriv_upflist; upf; upf =upf->upfe_next)
|
||||||
upf =
|
store_userpriv(upriv, grantor, priv, usr, upf);
|
||||||
upf->upfe_next) store_userpriv(upriv, grantor, priv,
|
|
||||||
usr, upf);
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2683,10 +2681,8 @@ static void drop_user_privilege( USERPRIV upriv)
|
|||||||
erase_userpriv(upriv, priv, usr, upf);
|
erase_userpriv(upriv, priv, usr, upf);
|
||||||
else
|
else
|
||||||
/* update is the only privilege with a possible field list */
|
/* update is the only privilege with a possible field list */
|
||||||
for (upf = upriv->userpriv_upflist; upf;
|
for (upf = upriv->userpriv_upflist; upf; upf = upf->upfe_next)
|
||||||
upf =
|
erase_userpriv(upriv, priv, usr, upf);
|
||||||
upf->upfe_next) erase_userpriv(upriv, priv, usr,
|
|
||||||
upf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't call erase_userpriv if we just finished update */
|
/* don't call erase_userpriv if we just finished update */
|
||||||
@ -2850,10 +2846,8 @@ static void get_relations( DBB databaseL)
|
|||||||
field->fld_next = relation->rel_fields;
|
field->fld_next = relation->rel_fields;
|
||||||
relation->rel_fields = field;
|
relation->rel_fields = field;
|
||||||
field->fld_position = RFR.RDB$FIELD_POSITION;
|
field->fld_position = RFR.RDB$FIELD_POSITION;
|
||||||
relation->rel_field_position =
|
relation->rel_field_position = MAX(RFR.RDB$FIELD_POSITION, relation->rel_field_position);
|
||||||
MAX(RFR.RDB$FIELD_POSITION, relation->rel_field_position);
|
field->fld_source = HSH_typed_lookup(RFR.RDB$FIELD_SOURCE, (USHORT) 0, SYM_global);
|
||||||
field->fld_source =
|
|
||||||
HSH_typed_lookup(RFR.RDB$FIELD_SOURCE, (USHORT) 0, SYM_global);
|
|
||||||
END_FOR;
|
END_FOR;
|
||||||
END_FOR;
|
END_FOR;
|
||||||
}
|
}
|
||||||
@ -2971,16 +2965,13 @@ static void get_triggers( DBB databaseL)
|
|||||||
T.RDB$SYSTEM_FLAG = 0
|
T.RDB$SYSTEM_FLAG = 0
|
||||||
|
|
||||||
trigger = (DUDLEY_TRG) DDL_alloc(sizeof(dudley_trg));
|
trigger = (DUDLEY_TRG) DDL_alloc(sizeof(dudley_trg));
|
||||||
trigger->trg_name = symbol =
|
trigger->trg_name = symbol = get_symbol(SYM_trigger, T.RDB$TRIGGER_NAME, (DUDLEY_CTX) trigger);
|
||||||
get_symbol(SYM_trigger, T.RDB$TRIGGER_NAME, (DUDLEY_CTX) trigger);
|
|
||||||
HSH_insert(symbol);
|
HSH_insert(symbol);
|
||||||
rel_name =
|
rel_name = HSH_typed_lookup(T.RDB$RELATION_NAME, (USHORT) 0, SYM_relation);
|
||||||
HSH_typed_lookup(T.RDB$RELATION_NAME, (USHORT) 0, SYM_relation);
|
|
||||||
if (rel_name && rel_name->sym_object)
|
if (rel_name && rel_name->sym_object)
|
||||||
trigger->trg_relation = (DUDLEY_REL) rel_name->sym_object;
|
trigger->trg_relation = (DUDLEY_REL) rel_name->sym_object;
|
||||||
else
|
else
|
||||||
trigger->trg_relation =
|
trigger->trg_relation = (DUDLEY_REL) get_symbol(SYM_relation, T.RDB$RELATION_NAME, NULL);
|
||||||
(DUDLEY_REL) get_symbol(SYM_relation, T.RDB$RELATION_NAME, NULL);
|
|
||||||
trigger->trg_type = (TRG_T) T.RDB$TRIGGER_TYPE;
|
trigger->trg_type = (TRG_T) T.RDB$TRIGGER_TYPE;
|
||||||
trigger->trg_inactive = T.RDB$TRIGGER_INACTIVE;
|
trigger->trg_inactive = T.RDB$TRIGGER_INACTIVE;
|
||||||
trigger->trg_sequence = T.RDB$TRIGGER_SEQUENCE;
|
trigger->trg_sequence = T.RDB$TRIGGER_SEQUENCE;
|
||||||
@ -3005,8 +2996,7 @@ static void get_udfs( DBB dbb)
|
|||||||
FUN.RDB$RETURN_ARGUMENT EQ ARG.RDB$ARGUMENT_POSITION
|
FUN.RDB$RETURN_ARGUMENT EQ ARG.RDB$ARGUMENT_POSITION
|
||||||
FUNC function = (FUNC) DDL_alloc(sizeof(func));
|
FUNC function = (FUNC) DDL_alloc(sizeof(func));
|
||||||
function->func_database = dbb;
|
function->func_database = dbb;
|
||||||
SYM symbol =
|
SYM symbol = get_symbol(SYM_function, FUN.RDB$FUNCTION_NAME, (DUDLEY_CTX) function);
|
||||||
get_symbol(SYM_function, FUN.RDB$FUNCTION_NAME, (DUDLEY_CTX) function);
|
|
||||||
function->func_name = symbol;
|
function->func_name = symbol;
|
||||||
HSH_insert(symbol);
|
HSH_insert(symbol);
|
||||||
FUNCARG arg = (FUNCARG) DDL_alloc(sizeof(funcarg));
|
FUNCARG arg = (FUNCARG) DDL_alloc(sizeof(funcarg));
|
||||||
@ -3150,8 +3140,7 @@ static void make_desc( DUDLEY_NOD node, DSC * desc)
|
|||||||
desc->dsc_dtype = blr_long;
|
desc->dsc_dtype = blr_long;
|
||||||
desc->dsc_length = sizeof(SLONG);
|
desc->dsc_length = sizeof(SLONG);
|
||||||
desc->dsc_sub_type = 0;
|
desc->dsc_sub_type = 0;
|
||||||
desc->dsc_scale = C_NUMERIC_SCALE(desc1) +
|
desc->dsc_scale = C_NUMERIC_SCALE(desc1) + C_NUMERIC_SCALE(desc2);
|
||||||
C_NUMERIC_SCALE(desc2);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
desc->dsc_dtype = blr_double;
|
desc->dsc_dtype = blr_double;
|
||||||
@ -3798,8 +3787,7 @@ static void set_generator( DUDLEY_NOD node)
|
|||||||
new_val = *number;
|
new_val = *number;
|
||||||
*number = 0;
|
*number = 0;
|
||||||
|
|
||||||
current_blr.str_current = current_blr.str_start =
|
current_blr.str_current = current_blr.str_start = reinterpret_cast<UCHAR*>(gds__alloc(1028));
|
||||||
reinterpret_cast<UCHAR *>(gds__alloc(1028));
|
|
||||||
if (!current_blr.str_current) {
|
if (!current_blr.str_current) {
|
||||||
DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */
|
DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */
|
||||||
}
|
}
|
||||||
@ -3825,8 +3813,7 @@ static void set_generator( DUDLEY_NOD node)
|
|||||||
want to change the generator by */
|
want to change the generator by */
|
||||||
|
|
||||||
*number = new_val - gen_value;
|
*number = new_val - gen_value;
|
||||||
new_blr.str_current = new_blr.str_start =
|
new_blr.str_current = new_blr.str_start = reinterpret_cast<UCHAR*>(gds__alloc(1028));
|
||||||
reinterpret_cast<UCHAR*>(gds__alloc(1028));
|
|
||||||
if (!new_blr.str_current) {
|
if (!new_blr.str_current) {
|
||||||
DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */
|
DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */
|
||||||
}
|
}
|
||||||
@ -3918,8 +3905,7 @@ static void store_blr( DUDLEY_NOD node, ISC_QUAD* blob_id, DUDLEY_REL relation)
|
|||||||
ISC_STATUS_ARRAY status_vector;
|
ISC_STATUS_ARRAY status_vector;
|
||||||
FB_API_HANDLE handle;
|
FB_API_HANDLE handle;
|
||||||
|
|
||||||
blr.str_current = blr.str_start =
|
blr.str_current = blr.str_start = reinterpret_cast<UCHAR*>(gds__alloc(4096));
|
||||||
reinterpret_cast<UCHAR*>(gds__alloc(4096));
|
|
||||||
if (!blr.str_current)
|
if (!blr.str_current)
|
||||||
DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */
|
DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */
|
||||||
blr.str_length = 4096;
|
blr.str_length = 4096;
|
||||||
|
@ -268,8 +268,7 @@ static void expand_global_field( DUDLEY_FLD field)
|
|||||||
context->ctx_field = field;
|
context->ctx_field = field;
|
||||||
|
|
||||||
field->fld_computed = resolve(field->fld_computed, request_context, 0);
|
field->fld_computed = resolve(field->fld_computed, request_context, 0);
|
||||||
field->fld_validation =
|
field->fld_validation = resolve(field->fld_validation, request_context, 0);
|
||||||
resolve(field->fld_validation, request_context, 0);
|
|
||||||
|
|
||||||
context->ctx_field = 0;
|
context->ctx_field = 0;
|
||||||
}
|
}
|
||||||
@ -320,7 +319,7 @@ static void expand_relation( DUDLEY_REL relation)
|
|||||||
rse = relation->rel_rse;
|
rse = relation->rel_rse;
|
||||||
contexts = (dudley_lls*) rse->nod_arg[s_rse_contexts];
|
contexts = (dudley_lls*) rse->nod_arg[s_rse_contexts];
|
||||||
my_context = lookup_context(NULL, contexts);
|
my_context = lookup_context(NULL, contexts);
|
||||||
my_context->ctx_view_rse = TRUE;
|
my_context->ctx_view_rse = true;
|
||||||
|
|
||||||
/* drop view context from context stack & build the request stack */
|
/* drop view context from context stack & build the request stack */
|
||||||
|
|
||||||
@ -339,7 +338,7 @@ static void expand_relation( DUDLEY_REL relation)
|
|||||||
/* Put view context back on stack for global field resolution to follow */
|
/* Put view context back on stack for global field resolution to follow */
|
||||||
|
|
||||||
LLS_PUSH((DUDLEY_NOD) my_context, &request_context);
|
LLS_PUSH((DUDLEY_NOD) my_context, &request_context);
|
||||||
my_context->ctx_view_rse = FALSE;
|
my_context->ctx_view_rse = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -747,8 +746,7 @@ static DUDLEY_NOD resolve( DUDLEY_NOD node, dudley_lls* right, dudley_lls* left)
|
|||||||
node->nod_arg[s_stt_default] = resolve(sub, right, 0);
|
node->nod_arg[s_stt_default] = resolve(sub, right, 0);
|
||||||
resolve_rse(node->nod_arg[s_stt_rse], &right);
|
resolve_rse(node->nod_arg[s_stt_rse], &right);
|
||||||
if (node->nod_arg[s_stt_value])
|
if (node->nod_arg[s_stt_value])
|
||||||
node->nod_arg[s_stt_value] =
|
node->nod_arg[s_stt_value] = resolve(node->nod_arg[s_stt_value], right, 0);
|
||||||
resolve(node->nod_arg[s_stt_value], right, 0);
|
|
||||||
return node;
|
return node;
|
||||||
|
|
||||||
case nod_unique:
|
case nod_unique:
|
||||||
@ -794,8 +792,7 @@ static DUDLEY_NOD resolve( DUDLEY_NOD node, dudley_lls* right, dudley_lls* left)
|
|||||||
context->ctx_context_id = ++context_id;
|
context->ctx_context_id = ++context_id;
|
||||||
context->ctx_relation = old_context->ctx_relation;
|
context->ctx_relation = old_context->ctx_relation;
|
||||||
LLS_PUSH((DUDLEY_NOD) context, &left);
|
LLS_PUSH((DUDLEY_NOD) context, &left);
|
||||||
node->nod_arg[s_mod_action] =
|
node->nod_arg[s_mod_action] = resolve(node->nod_arg[s_mod_action], right, left);
|
||||||
resolve(node->nod_arg[s_mod_action], right, left);
|
|
||||||
return node;
|
return node;
|
||||||
|
|
||||||
case nod_index:
|
case nod_index:
|
||||||
|
@ -394,8 +394,7 @@ TOK LEX_token(void)
|
|||||||
|
|
||||||
token->tok_length = p - token->tok_string;
|
token->tok_length = p - token->tok_string;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
token->tok_symbol = symbol =
|
token->tok_symbol = symbol = HSH_lookup(token->tok_string, token->tok_length);
|
||||||
HSH_lookup(token->tok_string, token->tok_length);
|
|
||||||
if (symbol && symbol->sym_type == SYM_keyword)
|
if (symbol && symbol->sym_type == SYM_keyword)
|
||||||
token->tok_keyword = (enum kwwords) symbol->sym_keyword;
|
token->tok_keyword = (enum kwwords) symbol->sym_keyword;
|
||||||
else
|
else
|
||||||
|
@ -2548,8 +2548,7 @@ static void modify_relation(void)
|
|||||||
field->fld_dtype = global->fld_dtype;
|
field->fld_dtype = global->fld_dtype;
|
||||||
field->fld_length = global->fld_length;
|
field->fld_length = global->fld_length;
|
||||||
field->fld_scale = global->fld_scale;
|
field->fld_scale = global->fld_scale;
|
||||||
field->fld_segment_length =
|
field->fld_segment_length = global->fld_segment_length;
|
||||||
global->fld_segment_length;
|
|
||||||
field->fld_sub_type = global->fld_sub_type;
|
field->fld_sub_type = global->fld_sub_type;
|
||||||
field->fld_has_sub_type = global->fld_has_sub_type;
|
field->fld_has_sub_type = global->fld_has_sub_type;
|
||||||
}
|
}
|
||||||
@ -3500,7 +3499,7 @@ static void parse_field_subtype( DUDLEY_FLD field)
|
|||||||
else
|
else
|
||||||
field->fld_sub_type = PARSE_number();
|
field->fld_sub_type = PARSE_number();
|
||||||
|
|
||||||
field->fld_has_sub_type = TRUE;
|
field->fld_has_sub_type = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4134,7 +4133,7 @@ static void validate_field( DUDLEY_FLD field)
|
|||||||
if ((field->fld_dtype) && !(field->fld_computed))
|
if ((field->fld_dtype) && !(field->fld_computed))
|
||||||
fb_msg_format(0, DDL_MSG_FAC, 223, sizeof(option), option, dummy);
|
fb_msg_format(0, DDL_MSG_FAC, 223, sizeof(option), option, dummy);
|
||||||
/* msg 223: data type */
|
/* msg 223: data type */
|
||||||
if ((field->fld_has_sub_type) && !(field->fld_computed))
|
if (field->fld_has_sub_type && !(field->fld_computed))
|
||||||
fb_msg_format(0, DDL_MSG_FAC, 224, sizeof(option), option, dummy);
|
fb_msg_format(0, DDL_MSG_FAC, 224, sizeof(option), option, dummy);
|
||||||
/* msg 224: sub type */
|
/* msg 224: sub type */
|
||||||
if ((field->fld_segment_length) && !(field->fld_computed))
|
if ((field->fld_segment_length) && !(field->fld_computed))
|
||||||
@ -4151,8 +4150,7 @@ static void validate_field( DUDLEY_FLD field)
|
|||||||
if (field->fld_flags & fld_modify)
|
if (field->fld_flags & fld_modify)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((field->fld_has_sub_type) &&
|
if (field->fld_has_sub_type && (field->fld_dtype != blr_blob) &&
|
||||||
(field->fld_dtype != blr_blob) &&
|
|
||||||
(field->fld_dtype != blr_text) && (field->fld_dtype != blr_varying))
|
(field->fld_dtype != blr_text) && (field->fld_dtype != blr_varying))
|
||||||
{
|
{
|
||||||
PARSE_error(228, 0, 0); /* msg 228: subtypes are valid only for blobs and text */
|
PARSE_error(228, 0, 0); /* msg 228: subtypes are valid only for blobs and text */
|
||||||
|
@ -123,8 +123,7 @@ void TRN_translate(void)
|
|||||||
/* Start by reversing the set of actions */
|
/* Start by reversing the set of actions */
|
||||||
str d;
|
str d;
|
||||||
str* dyn = &d;
|
str* dyn = &d;
|
||||||
dyn->str_current = dyn->str_start =
|
dyn->str_current = dyn->str_start = reinterpret_cast<UCHAR*>(gds__alloc(8192));
|
||||||
reinterpret_cast<UCHAR*>(gds__alloc(8192));
|
|
||||||
if (!dyn->str_current)
|
if (!dyn->str_current)
|
||||||
DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */
|
DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */
|
||||||
dyn->str_length = 8192;
|
dyn->str_length = 8192;
|
||||||
|
@ -296,17 +296,13 @@ static ISC_ULONG CvtCobolToInt(const ISC_UCHAR *s, ISC_USHORT len, char type)
|
|||||||
|
|
||||||
switch (len) {
|
switch (len) {
|
||||||
case 2:
|
case 2:
|
||||||
temp = (*(s) << 8) +
|
temp = (*(s) << 8) + *(s + 1);
|
||||||
*(s + 1);
|
|
||||||
// If source is negative and signed, extend sign to dest
|
// If source is negative and signed, extend sign to dest
|
||||||
if ((*(s + 1) & 0x80) && (type == 11))
|
if ((*(s + 1) & 0x80) && (type == 11))
|
||||||
temp |= 0xffff0000;
|
temp |= 0xffff0000;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
temp = (*(s) << 24) +
|
temp = (*(s) << 24) + (*(s + 1) << 16) + (*(s + 2) << 8) + *(s + 3);
|
||||||
(*(s + 1) << 16) +
|
|
||||||
(*(s + 2) << 8) +
|
|
||||||
*(s + 3);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
temp = 0;
|
temp = 0;
|
||||||
|
@ -144,7 +144,8 @@ int PRETTY_print_cdb( UCHAR* blr, FPTR_PRINT_CALLBACK routine, void* user_arg, S
|
|||||||
print_line(control, offset);
|
print_line(control, offset);
|
||||||
|
|
||||||
SSHORT parameter;
|
SSHORT parameter;
|
||||||
while (parameter = BLR_BYTE) {
|
while (parameter = BLR_BYTE)
|
||||||
|
{
|
||||||
const char* p;
|
const char* p;
|
||||||
if (parameter > FB_NELEM(cdb_table) || !(p = cdb_table[parameter]))
|
if (parameter > FB_NELEM(cdb_table) || !(p = cdb_table[parameter]))
|
||||||
{
|
{
|
||||||
@ -317,7 +318,8 @@ static int print_blr_dtype(ctl* control, bool print_object)
|
|||||||
// Special case blob (261) to keep down the size of the
|
// Special case blob (261) to keep down the size of the
|
||||||
// jump table
|
// jump table
|
||||||
|
|
||||||
switch (dtype) {
|
switch (dtype)
|
||||||
|
{
|
||||||
case blr_short:
|
case blr_short:
|
||||||
string = "short";
|
string = "short";
|
||||||
length = 2;
|
length = 2;
|
||||||
@ -413,7 +415,8 @@ static int print_blr_dtype(ctl* control, bool print_object)
|
|||||||
// than letting it be random.
|
// than letting it be random.
|
||||||
SSHORT offset = 0;
|
SSHORT offset = 0;
|
||||||
|
|
||||||
switch (dtype) {
|
switch (dtype)
|
||||||
|
{
|
||||||
case blr_text:
|
case blr_text:
|
||||||
length = print_word(control, offset);
|
length = print_word(control, offset);
|
||||||
break;
|
break;
|
||||||
@ -509,9 +512,8 @@ static int print_byte( ctl* control, SSHORT offset)
|
|||||||
static int print_char( ctl* control, SSHORT offset)
|
static int print_char( ctl* control, SSHORT offset)
|
||||||
{
|
{
|
||||||
const UCHAR c = BLR_BYTE;
|
const UCHAR c = BLR_BYTE;
|
||||||
const bool printable = (c >= 'a' && c <= 'z') ||
|
const bool printable = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
|
||||||
(c >= 'A' && c <= 'Z') ||
|
(c >= '0' && c <= '9') || c == '$' || c == '_';
|
||||||
(c >= '0' && c <= '9' || c == '$' || c == '_');
|
|
||||||
|
|
||||||
sprintf(control->ctl_ptr, printable ? "'%c'," : control->ctl_language ? "chr(%d)," : "%d,", c);
|
sprintf(control->ctl_ptr, printable ? "'%c'," : control->ctl_language ? "chr(%d)," : "%d,", c);
|
||||||
ADVANCE_PTR(control->ctl_ptr);
|
ADVANCE_PTR(control->ctl_ptr);
|
||||||
@ -529,7 +531,7 @@ static int print_char( ctl* control, SSHORT offset)
|
|||||||
|
|
||||||
static int print_dyn_verb( ctl* control, SSHORT level)
|
static int print_dyn_verb( ctl* control, SSHORT level)
|
||||||
{
|
{
|
||||||
SSHORT offset = control->ctl_blr - control->ctl_blr_start;
|
const SSHORT offset = control->ctl_blr - control->ctl_blr_start;
|
||||||
const UCHAR dyn_operator = BLR_BYTE;
|
const UCHAR dyn_operator = BLR_BYTE;
|
||||||
|
|
||||||
const char* p;
|
const char* p;
|
||||||
|
@ -58,7 +58,7 @@ const int HDR_BUFLEN = 512;
|
|||||||
static HINSTANCE hAppInstance = NULL; // Handle to the app. instance
|
static HINSTANCE hAppInstance = NULL; // Handle to the app. instance
|
||||||
char szSysDbaPasswd[PASSWORD_LEN]; // Pointer to hold the password
|
char szSysDbaPasswd[PASSWORD_LEN]; // Pointer to hold the password
|
||||||
HBRUSH hIBGrayBrush = NULL; // Handle to a gray brush
|
HBRUSH hIBGrayBrush = NULL; // Handle to a gray brush
|
||||||
static BOOL bServerApp = FALSE; // Flag indicating if Server application
|
static bool bServerApp = false; // Flag indicating if Server application
|
||||||
static char szService[SERVICE_LEN]; // To store the service path
|
static char szService[SERVICE_LEN]; // To store the service path
|
||||||
|
|
||||||
// Window procedure
|
// Window procedure
|
||||||
@ -125,7 +125,7 @@ void AddConfigPages(HWND hPropSheet, HINSTANCE hInst)
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
hIBGrayBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
|
hIBGrayBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
|
||||||
hAppInstance = hInst;
|
hAppInstance = hInst;
|
||||||
bServerApp = TRUE;
|
bServerApp = true;
|
||||||
szService[0] = '\0';
|
szService[0] = '\0';
|
||||||
szSysDbaPasswd[0] = '\0';
|
szSysDbaPasswd[0] = '\0';
|
||||||
|
|
||||||
|
@ -273,10 +273,8 @@ bool CFBDialog::ValidateInstalledServices()
|
|||||||
// If Guardian installed but not Server service
|
// If Guardian installed but not Server service
|
||||||
// then return false;
|
// then return false;
|
||||||
{
|
{
|
||||||
fb_status.UseService =
|
fb_status.UseService = CheckServiceInstalled(GetServiceName(REMOTE_SERVICE));
|
||||||
CheckServiceInstalled(GetServiceName(REMOTE_SERVICE));
|
fb_status.UseGuardian = CheckServiceInstalled(GetServiceName(ISCGUARD_SERVICE));
|
||||||
fb_status.UseGuardian =
|
|
||||||
CheckServiceInstalled(GetServiceName(ISCGUARD_SERVICE));
|
|
||||||
|
|
||||||
return (!fb_status.UseService && fb_status.UseGuardian) ? false : true;
|
return (!fb_status.UseService && fb_status.UseGuardian) ? false : true;
|
||||||
}
|
}
|
||||||
@ -377,8 +375,7 @@ void CFBDialog::ViewRegistryEntries()
|
|||||||
|
|
||||||
fb_status.AutoStart = false;
|
fb_status.AutoStart = false;
|
||||||
|
|
||||||
fb_status.UseService =
|
fb_status.UseService = CheckServiceInstalled(GetServiceName(REMOTE_SERVICE));
|
||||||
CheckServiceInstalled(GetServiceName(REMOTE_SERVICE));
|
|
||||||
|
|
||||||
if ( fb_status.UseService )
|
if ( fb_status.UseService )
|
||||||
{
|
{
|
||||||
|
@ -849,8 +849,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
|||||||
/* free linked lists */
|
/* free linked lists */
|
||||||
while (tddba->head_of_files_list != 0) {
|
while (tddba->head_of_files_list != 0) {
|
||||||
open_files* tmp1 = tddba->head_of_files_list;
|
open_files* tmp1 = tddba->head_of_files_list;
|
||||||
tddba->head_of_files_list =
|
tddba->head_of_files_list = tddba->head_of_files_list->open_files_next;
|
||||||
tddba->head_of_files_list->open_files_next;
|
|
||||||
delete tmp1;
|
delete tmp1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -977,15 +976,13 @@ static bool analyze_data_page( dba_rel* relation, const data_page* page, bool sw
|
|||||||
USHORT space = page->dpg_count * sizeof(data_page::dpg_repeat);
|
USHORT space = page->dpg_count * sizeof(data_page::dpg_repeat);
|
||||||
|
|
||||||
const data_page::dpg_repeat* tail = page->dpg_rpt;
|
const data_page::dpg_repeat* tail = page->dpg_rpt;
|
||||||
for (const data_page::dpg_repeat* const end = tail + page->dpg_count; tail < end;
|
for (const data_page::dpg_repeat* const end = tail + page->dpg_count; tail < end; tail++)
|
||||||
tail++)
|
|
||||||
{
|
{
|
||||||
if (tail->dpg_offset && tail->dpg_length)
|
if (tail->dpg_offset && tail->dpg_length)
|
||||||
{
|
{
|
||||||
space += tail->dpg_length;
|
space += tail->dpg_length;
|
||||||
if (sw_record) {
|
if (sw_record) {
|
||||||
const rhdf* header =
|
const rhdf* header = (const rhdf*) ((SCHAR *) page + tail->dpg_offset);
|
||||||
(const rhdf*) ((SCHAR *) page + tail->dpg_offset);
|
|
||||||
if (!(header->rhdf_flags &
|
if (!(header->rhdf_flags &
|
||||||
(rhd_blob | rhd_chain | rhd_fragment)))
|
(rhd_blob | rhd_chain | rhd_fragment)))
|
||||||
{
|
{
|
||||||
@ -993,15 +990,13 @@ static bool analyze_data_page( dba_rel* relation, const data_page* page, bool sw
|
|||||||
relation->rel_record_space += tail->dpg_length;
|
relation->rel_record_space += tail->dpg_length;
|
||||||
if (header->rhdf_flags & rhd_incomplete) {
|
if (header->rhdf_flags & rhd_incomplete) {
|
||||||
relation->rel_record_space -= RHDF_SIZE;
|
relation->rel_record_space -= RHDF_SIZE;
|
||||||
relation->rel_record_space +=
|
relation->rel_record_space += analyze_fragments(relation, header);
|
||||||
analyze_fragments(relation, header);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
relation->rel_record_space -= RHD_SIZE;
|
relation->rel_record_space -= RHD_SIZE;
|
||||||
|
|
||||||
if (header->rhdf_b_page)
|
if (header->rhdf_b_page)
|
||||||
relation->rel_version_space +=
|
relation->rel_version_space += analyze_versions(relation, header);
|
||||||
analyze_versions(relation, header);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1069,8 +1064,7 @@ static void analyze_index( dba_rel* relation, dba_idx* index)
|
|||||||
**************************************/
|
**************************************/
|
||||||
tdba* tddba = tdba::getSpecific();
|
tdba* tddba = tdba::getSpecific();
|
||||||
|
|
||||||
const index_root_page* index_root =
|
const index_root_page* index_root = (const index_root_page*) db_read(relation->rel_index_root);
|
||||||
(const index_root_page*) db_read(relation->rel_index_root);
|
|
||||||
|
|
||||||
SLONG page;
|
SLONG page;
|
||||||
if (index_root->irt_count <= index->idx_id ||
|
if (index_root->irt_count <= index->idx_id ||
|
||||||
@ -1299,15 +1293,13 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
|
|||||||
|
|
||||||
if (tddba->files) {
|
if (tddba->files) {
|
||||||
for (fil = tddba->files; fil->fil_next; fil = fil->fil_next);
|
for (fil = tddba->files; fil->fil_next; fil = fil->fil_next);
|
||||||
fil->fil_next =
|
fil->fil_next = (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1);
|
||||||
(dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1);
|
|
||||||
fil->fil_next->fil_min_page = fil->fil_max_page + 1;
|
fil->fil_next->fil_min_page = fil->fil_max_page + 1;
|
||||||
fil = fil->fil_next;
|
fil = fil->fil_next;
|
||||||
}
|
}
|
||||||
else { /* empty list */
|
else { /* empty list */
|
||||||
|
|
||||||
fil = tddba->files =
|
fil = tddba->files = (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1);
|
||||||
(dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1);
|
|
||||||
fil->fil_min_page = 0L;
|
fil->fil_min_page = 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1380,11 +1372,9 @@ static const pag* db_read( SLONG page_number)
|
|||||||
page_number -= fil->fil_min_page - fil->fil_fudge;
|
page_number -= fil->fil_min_page - fil->fil_fudge;
|
||||||
|
|
||||||
LARGE_INTEGER liOffset;
|
LARGE_INTEGER liOffset;
|
||||||
liOffset.QuadPart =
|
liOffset.QuadPart = UInt32x32To64((DWORD) page_number, (DWORD) tddba->page_size);
|
||||||
UInt32x32To64((DWORD) page_number, (DWORD) tddba->page_size);
|
if (SetFilePointer(fil->fil_desc, (LONG) liOffset.LowPart, &liOffset.HighPart, FILE_BEGIN) ==
|
||||||
if (SetFilePointer
|
(DWORD) -1)
|
||||||
(fil->fil_desc, (LONG) liOffset.LowPart, &liOffset.HighPart,
|
|
||||||
FILE_BEGIN) == (DWORD) -1)
|
|
||||||
{
|
{
|
||||||
int lastError = GetLastError();
|
int lastError = GetLastError();
|
||||||
if (lastError != NO_ERROR)
|
if (lastError != NO_ERROR)
|
||||||
@ -1476,15 +1466,13 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
|
|||||||
dba_fil* fil;
|
dba_fil* fil;
|
||||||
if (tddba->files) {
|
if (tddba->files) {
|
||||||
for (fil = tddba->files; fil->fil_next; fil = fil->fil_next);
|
for (fil = tddba->files; fil->fil_next; fil = fil->fil_next);
|
||||||
fil->fil_next =
|
fil->fil_next = (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1);
|
||||||
(dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1);
|
|
||||||
fil->fil_next->fil_min_page = fil->fil_max_page + 1;
|
fil->fil_next->fil_min_page = fil->fil_max_page + 1;
|
||||||
fil = fil->fil_next;
|
fil = fil->fil_next;
|
||||||
}
|
}
|
||||||
else { /* empty list */
|
else { /* empty list */
|
||||||
|
|
||||||
fil = tddba->files =
|
fil = tddba->files = (dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1);
|
||||||
(dba_fil*) alloc(sizeof(dba_fil) + strlen(file_name) + 1);
|
|
||||||
fil->fil_min_page = 0L;
|
fil->fil_min_page = 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -855,8 +855,7 @@ static SSHORT parse_cmd_line( int argc, TEXT** argv, bool zapPasswd)
|
|||||||
ibmgr_data.suboperation = SOP_NONE;
|
ibmgr_data.suboperation = SOP_NONE;
|
||||||
ibmgr_data.par_entered = 0;
|
ibmgr_data.par_entered = 0;
|
||||||
|
|
||||||
SSHORT ret =
|
SSHORT ret = get_switches(argc, argv, ibmgr_in_sw_table, &ibmgr_data, &quitflag, zapPasswd);
|
||||||
get_switches(argc, argv, ibmgr_in_sw_table, &ibmgr_data, &quitflag, zapPasswd);
|
|
||||||
if (ret != FB_SUCCESS) {
|
if (ret != FB_SUCCESS) {
|
||||||
if (ret == ERR_SYNTAX) {
|
if (ret == ERR_SYNTAX) {
|
||||||
SRVRMGR_msg_get(MSG_SYNTAX, msg);
|
SRVRMGR_msg_get(MSG_SYNTAX, msg);
|
||||||
@ -864,7 +863,8 @@ static SSHORT parse_cmd_line( int argc, TEXT** argv, bool zapPasswd)
|
|||||||
}
|
}
|
||||||
return ACT_NONE;
|
return ACT_NONE;
|
||||||
}
|
}
|
||||||
switch (ibmgr_data.operation) {
|
switch (ibmgr_data.operation)
|
||||||
|
{
|
||||||
case OP_SHUT:
|
case OP_SHUT:
|
||||||
if (strcmp(ibmgr_data.user, SYSDBA_USER_NAME)) {
|
if (strcmp(ibmgr_data.user, SYSDBA_USER_NAME)) {
|
||||||
SRVRMGR_msg_get(MSG_NOPERM, msg);
|
SRVRMGR_msg_get(MSG_NOPERM, msg);
|
||||||
@ -886,9 +886,9 @@ static SSHORT parse_cmd_line( int argc, TEXT** argv, bool zapPasswd)
|
|||||||
|
|
||||||
case OP_START:
|
case OP_START:
|
||||||
if ((strcmp(ibmgr_data.real_user, "root") &&
|
if ((strcmp(ibmgr_data.real_user, "root") &&
|
||||||
strcmp(ibmgr_data.real_user, FIREBIRD_USER_NAME) &&
|
strcmp(ibmgr_data.real_user, FIREBIRD_USER_NAME) &&
|
||||||
strcmp(ibmgr_data.real_user, INTERBASE_USER_NAME) &&
|
strcmp(ibmgr_data.real_user, INTERBASE_USER_NAME) &&
|
||||||
strcmp(ibmgr_data.real_user, INTERBASE_USER_SHORT)) ||
|
strcmp(ibmgr_data.real_user, INTERBASE_USER_SHORT)) ||
|
||||||
strcmp(ibmgr_data.user, SYSDBA_USER_NAME))
|
strcmp(ibmgr_data.user, SYSDBA_USER_NAME))
|
||||||
{
|
{
|
||||||
SRVRMGR_msg_get(MSG_NOPERM, msg);
|
SRVRMGR_msg_get(MSG_NOPERM, msg);
|
||||||
|
@ -209,8 +209,7 @@ USHORT CLIENT_install(const TEXT * rootdir, USHORT client, bool sw_force,
|
|||||||
if (kernel32 != 0)
|
if (kernel32 != 0)
|
||||||
{
|
{
|
||||||
typedef BOOL __stdcall proto_ntmove(LPCSTR, LPCSTR, DWORD);
|
typedef BOOL __stdcall proto_ntmove(LPCSTR, LPCSTR, DWORD);
|
||||||
proto_ntmove* ntmove =
|
proto_ntmove* ntmove = (proto_ntmove*)GetProcAddress(kernel32, "MoveFileExA");
|
||||||
(proto_ntmove*)GetProcAddress(kernel32, "MoveFileExA");
|
|
||||||
if (ntmove != 0)
|
if (ntmove != 0)
|
||||||
{
|
{
|
||||||
// We are definitely running on a system supporting the
|
// We are definitely running on a system supporting the
|
||||||
|
@ -101,8 +101,7 @@ USHORT SERVICES_install(SC_HANDLE manager,
|
|||||||
display_name,
|
display_name,
|
||||||
SERVICE_CHANGE_CONFIG,
|
SERVICE_CHANGE_CONFIG,
|
||||||
dwServiceType,
|
dwServiceType,
|
||||||
(sw_startup ==
|
(sw_startup == STARTUP_DEMAND) ? SERVICE_DEMAND_START :
|
||||||
STARTUP_DEMAND) ? SERVICE_DEMAND_START :
|
|
||||||
SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
|
SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
|
||||||
path_name, NULL, NULL, dependencies,
|
path_name, NULL, NULL, dependencies,
|
||||||
nt_user_name, nt_user_password);
|
nt_user_name, nt_user_password);
|
||||||
|
@ -208,16 +208,14 @@ int main( int argc, char *argv[])
|
|||||||
gdbb->tdbb_database = &dbb_struct;
|
gdbb->tdbb_database = &dbb_struct;
|
||||||
gdbb->tdbb_transaction = &dull;
|
gdbb->tdbb_transaction = &dull;
|
||||||
dull.tra_number = header->hdr_next_transaction;
|
dull.tra_number = header->hdr_next_transaction;
|
||||||
gdbb->tdbb_database->dbb_max_records = (rbdb->rbdb_page_size
|
gdbb->tdbb_database->dbb_max_records = (rbdb->rbdb_page_size - sizeof(struct data_page)) /
|
||||||
- sizeof(struct data_page)) /
|
|
||||||
(sizeof(data_page::dpg_repeat) + OFFSETA(RHD, rhd_data));
|
(sizeof(data_page::dpg_repeat) + OFFSETA(RHD, rhd_data));
|
||||||
gdbb->tdbb_database->dbb_pcontrol = &dim;
|
gdbb->tdbb_database->dbb_pcontrol = &dim;
|
||||||
gdbb->tdbb_database->dbb_dp_per_pp = (rbdb->rbdb_page_size
|
gdbb->tdbb_database->dbb_dp_per_pp =
|
||||||
- OFFSETA(pointer_page*, ppg_page)) * 8 / 34;
|
(rbdb->rbdb_page_size - OFFSETA(pointer_page*, ppg_page)) * 8 / 34;
|
||||||
gdbb->tdbb_database->dbb_pcontrol->pgc_bytes = rbdb->rbdb_page_size
|
gdbb->tdbb_database->dbb_pcontrol->pgc_bytes =
|
||||||
- OFFSETA(page_inv_page*, pip_bits);
|
rbdb->rbdb_page_size - OFFSETA(page_inv_page*, pip_bits);
|
||||||
gdbb->tdbb_database->dbb_pcontrol->pgc_ppp =
|
gdbb->tdbb_database->dbb_pcontrol->pgc_ppp = gdbb->tdbb_database->dbb_pcontrol->pgc_bytes * 8;
|
||||||
gdbb->tdbb_database->dbb_pcontrol->pgc_bytes * 8;
|
|
||||||
gdbb->tdbb_database->dbb_pcontrol->pgc_tpt =
|
gdbb->tdbb_database->dbb_pcontrol->pgc_tpt =
|
||||||
(rbdb->rbdb_page_size - OFFSETA(tx_inv_page*, tip_transactions)) * 4;
|
(rbdb->rbdb_page_size - OFFSETA(tx_inv_page*, tip_transactions)) * 4;
|
||||||
gdbb->tdbb_database->dbb_pcontrol->pgc_pip = 1;
|
gdbb->tdbb_database->dbb_pcontrol->pgc_pip = 1;
|
||||||
@ -843,20 +841,20 @@ static void get_switch( TEXT** argv, SWC token)
|
|||||||
token->swc_string = *argv;
|
token->swc_string = *argv;
|
||||||
|
|
||||||
if (*token->swc_string == '-') {
|
if (*token->swc_string == '-') {
|
||||||
token->swc_switch = TRUE;
|
token->swc_switch = true;
|
||||||
token->swc_string++;
|
token->swc_string++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
token->swc_switch = FALSE;
|
token->swc_switch = false;
|
||||||
|
|
||||||
const int temp = strlen(token->swc_string) - 1;
|
const int temp = strlen(token->swc_string) - 1;
|
||||||
|
|
||||||
if (token->swc_string[temp] == ',') {
|
if (token->swc_string[temp] == ',') {
|
||||||
token->swc_string[temp] = '\0';
|
token->swc_string[temp] = '\0';
|
||||||
token->swc_comma = TRUE;
|
token->swc_comma = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
token->swc_comma = FALSE;
|
token->swc_comma = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ typedef struct rbdb {
|
|||||||
} *RBDB;
|
} *RBDB;
|
||||||
|
|
||||||
typedef struct swc {
|
typedef struct swc {
|
||||||
SCHAR swc_switch;
|
bool swc_switch;
|
||||||
SCHAR swc_comma;
|
bool swc_comma;
|
||||||
TEXT *swc_string;
|
TEXT *swc_string;
|
||||||
} *SWC;
|
} *SWC;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user