mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 23:23:04 +01:00
Style.
This commit is contained in:
parent
c72ff4b58f
commit
0a94d6fee8
200
src/jrd/blb.cpp
200
src/jrd/blb.cpp
@ -220,8 +220,7 @@ void BLB_close(thread_db* tdbb, Jrd::blb* blob)
|
||||
TempSpace* const tempSpace = transaction->getBlobSpace();
|
||||
|
||||
blob->blb_temp_offset = tempSpace->allocateSpace(blob->blb_temp_size);
|
||||
tempSpace->write(blob->blb_temp_offset,
|
||||
blob->getBuffer(), blob->blb_temp_size);
|
||||
tempSpace->write(blob->blb_temp_offset, blob->getBuffer(), blob->blb_temp_size);
|
||||
}
|
||||
}
|
||||
else if (blob->blb_level >= 1 &&
|
||||
@ -366,8 +365,7 @@ blb* BLB_create2(thread_db* tdbb,
|
||||
// in case of big stacks garbage collection speed may become
|
||||
// real problem. Stacks should be sorted before run?
|
||||
// 2006.03.17 hvlad: it is sorted now
|
||||
void BLB_garbage_collect(
|
||||
thread_db* tdbb,
|
||||
void BLB_garbage_collect(thread_db* tdbb,
|
||||
RecordStack& going,
|
||||
RecordStack& staying,
|
||||
SLONG prior_page, jrd_rel* relation)
|
||||
@ -411,8 +409,7 @@ void BLB_garbage_collect(
|
||||
for (USHORT id = 0; id < format->fmt_count; id++)
|
||||
{
|
||||
DSC desc;
|
||||
if (DTYPE_IS_BLOB(format->fmt_desc[id].dsc_dtype) &&
|
||||
EVL_field(0, rec, id, &desc))
|
||||
if (DTYPE_IS_BLOB(format->fmt_desc[id].dsc_dtype) && EVL_field(0, rec, id, &desc))
|
||||
{
|
||||
const bid* blob = (bid*) desc.dsc_address;
|
||||
if (!blob->isEmpty())
|
||||
@ -451,8 +448,7 @@ void BLB_garbage_collect(
|
||||
for (USHORT id = 0; id < format->fmt_count; id++)
|
||||
{
|
||||
DSC desc;
|
||||
if (DTYPE_IS_BLOB(format->fmt_desc[id].dsc_dtype) &&
|
||||
EVL_field(0, rec, id, &desc))
|
||||
if (DTYPE_IS_BLOB(format->fmt_desc[id].dsc_dtype) && EVL_field(0, rec, id, &desc))
|
||||
{
|
||||
const bid* blob = (bid*) desc.dsc_address;
|
||||
if (!blob->isEmpty())
|
||||
@ -846,14 +842,10 @@ SLONG BLB_get_slice(thread_db* tdbb,
|
||||
to fetch only stuff we really care about */
|
||||
|
||||
if (info.sdl_info_dimensions) {
|
||||
const SLONG from =
|
||||
SDL_compute_subscript(tdbb->tdbb_status_vector, desc,
|
||||
info.sdl_info_dimensions,
|
||||
info.sdl_info_lower);
|
||||
const SLONG to =
|
||||
SDL_compute_subscript(tdbb->tdbb_status_vector, desc,
|
||||
info.sdl_info_dimensions,
|
||||
info.sdl_info_upper);
|
||||
const SLONG from = SDL_compute_subscript(tdbb->tdbb_status_vector, desc,
|
||||
info.sdl_info_dimensions, info.sdl_info_lower);
|
||||
const SLONG to = SDL_compute_subscript(tdbb->tdbb_status_vector, desc,
|
||||
info.sdl_info_dimensions, info.sdl_info_upper);
|
||||
if (from != -1 && to != -1) {
|
||||
if (from) {
|
||||
offset = from * desc->iad_element_length;
|
||||
@ -875,13 +867,8 @@ SLONG BLB_get_slice(thread_db* tdbb,
|
||||
arg.slice_high_water = data + length;
|
||||
arg.slice_base = data + offset;
|
||||
|
||||
ISC_STATUS status = SDL_walk(tdbb->tdbb_status_vector,
|
||||
sdl,
|
||||
data,
|
||||
desc,
|
||||
variables,
|
||||
slice_callback,
|
||||
&arg);
|
||||
ISC_STATUS status = SDL_walk(tdbb->tdbb_status_vector, sdl,
|
||||
data, desc, variables, slice_callback, &arg);
|
||||
|
||||
if (status) {
|
||||
ERR_punt();
|
||||
@ -952,8 +939,7 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
|
||||
if (to_desc->dsc_dtype == dtype_array)
|
||||
{
|
||||
// only array->array conversions are allowed
|
||||
if (from_desc->dsc_dtype != dtype_array &&
|
||||
from_desc->dsc_dtype != dtype_quad)
|
||||
if (from_desc->dsc_dtype != dtype_array && from_desc->dsc_dtype != dtype_quad)
|
||||
{
|
||||
ERR_post(Arg::Gds(isc_array_convert_error));
|
||||
}
|
||||
@ -985,8 +971,8 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
|
||||
case nod_field:
|
||||
// We should not materialize the blob if the destination field
|
||||
// stream (nod_union, for example) doesn't have a relation.
|
||||
simpleMove = tdbb->getRequest()->
|
||||
req_rpb[(IPTR)field->nod_arg[e_fld_stream]].rpb_relation == NULL;
|
||||
simpleMove =
|
||||
tdbb->getRequest()->req_rpb[(IPTR)field->nod_arg[e_fld_stream]].rpb_relation == NULL;
|
||||
break;
|
||||
case nod_argument:
|
||||
case nod_variable:
|
||||
@ -1004,12 +990,11 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
|
||||
return;
|
||||
|
||||
const bool needFilter =
|
||||
(from_desc->dsc_sub_type != isc_blob_untyped &&
|
||||
to_desc->dsc_sub_type != isc_blob_untyped &&
|
||||
(from_desc->dsc_sub_type != to_desc->dsc_sub_type ||
|
||||
(from_desc->dsc_sub_type == isc_blob_text &&
|
||||
from_desc->dsc_scale != to_desc->dsc_scale &&
|
||||
to_desc->dsc_scale != CS_NONE && to_desc->dsc_scale != CS_BINARY)));
|
||||
(from_desc->dsc_sub_type != isc_blob_untyped && to_desc->dsc_sub_type != isc_blob_untyped &&
|
||||
(from_desc->dsc_sub_type != to_desc->dsc_sub_type ||
|
||||
(from_desc->dsc_sub_type == isc_blob_text &&
|
||||
from_desc->dsc_scale != to_desc->dsc_scale &&
|
||||
to_desc->dsc_scale != CS_NONE && to_desc->dsc_scale != CS_BINARY)));
|
||||
|
||||
if (!needFilter && to_desc->isBlob() &&
|
||||
(from_desc->getCharSet() == CS_NONE || from_desc->getCharSet() == CS_BINARY))
|
||||
@ -1093,11 +1078,10 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
|
||||
if (source->bid_internal.bid_relation_id || needFilter)
|
||||
{
|
||||
blob = copy_blob(tdbb, source, destination,
|
||||
bpb.getCount(), bpb.begin(), relPages->rel_pg_space_id);
|
||||
bpb.getCount(), bpb.begin(), relPages->rel_pg_space_id);
|
||||
}
|
||||
else if ((to_desc->dsc_dtype == dtype_array) &&
|
||||
(array = find_array(transaction, source)) &&
|
||||
(blob = store_array(tdbb, transaction, source)))
|
||||
else if ((to_desc->dsc_dtype == dtype_array) && (array = find_array(transaction, source)) &&
|
||||
(blob = store_array(tdbb, transaction, source)))
|
||||
{
|
||||
materialized_blob = true;
|
||||
}
|
||||
@ -1132,8 +1116,7 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
|
||||
ERR_post(Arg::Gds(isc_bad_segstr_id));
|
||||
}
|
||||
|
||||
if (blob->blb_level &&
|
||||
(blob->blb_pg_space_id != relPages->rel_pg_space_id))
|
||||
if (blob->blb_level && (blob->blb_pg_space_id != relPages->rel_pg_space_id))
|
||||
{
|
||||
const ULONG oldTempID = blob->blb_temp_id;
|
||||
blb* newBlob = copy_blob(tdbb, source, destination,
|
||||
@ -1376,8 +1359,7 @@ blb* BLB_open2(thread_db* tdbb,
|
||||
|
||||
UCharBuffer new_bpb;
|
||||
|
||||
if (external_call &&
|
||||
ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_original) >= ODS_11_1)
|
||||
if (external_call && ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_original) >= ODS_11_1)
|
||||
{
|
||||
if (!from_type_specified)
|
||||
from = blob->blb_sub_type;
|
||||
@ -1422,14 +1404,8 @@ blb* BLB_open2(thread_db* tdbb,
|
||||
if (filter_required)
|
||||
{
|
||||
BlobControl* control = 0;
|
||||
BLF_open_blob(tdbb,
|
||||
transaction,
|
||||
&control,
|
||||
blob_id,
|
||||
bpb_length,
|
||||
bpb,
|
||||
reinterpret_cast<FPTR_BFILTER_CALLBACK>(blob_filter),
|
||||
filter);
|
||||
BLF_open_blob(tdbb, transaction, &control, blob_id, bpb_length, bpb,
|
||||
reinterpret_cast<FPTR_BFILTER_CALLBACK>(blob_filter), filter);
|
||||
blob->blb_filter = control;
|
||||
blob->blb_max_segment = control->ctl_max_segment;
|
||||
blob->blb_count = control->ctl_number_segments;
|
||||
@ -1462,7 +1438,7 @@ void BLB_put_data(thread_db* tdbb, blb* blob, const UCHAR* buffer, SLONG length)
|
||||
// ASF: the comment below was copied from BLB_get_data
|
||||
// I have no idea why this limit is 32768 instead of 32767
|
||||
// 1994-August-12 David Schnepper
|
||||
USHORT n = (USHORT) MIN(length, (SLONG) 32768);
|
||||
const USHORT n = (USHORT) MIN(length, (SLONG) 32768);
|
||||
BLB_put_segment(tdbb, blob, p, n);
|
||||
p += n;
|
||||
length -= n;
|
||||
@ -1677,8 +1653,7 @@ void BLB_put_slice( thread_db* tdbb,
|
||||
{
|
||||
for (array = transaction->tra_arrays; array; array = array->arr_next)
|
||||
{
|
||||
if (array->arr_blob &&
|
||||
array->arr_blob->blb_blob_id == *blob_id)
|
||||
if (array->arr_blob && array->arr_blob->blb_blob_id == *blob_id)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -1694,10 +1669,8 @@ void BLB_put_slice( thread_db* tdbb,
|
||||
Ods::InternalArrayDesc* p_ads = reinterpret_cast<Ods::InternalArrayDesc*>(temp);
|
||||
blb* blob = BLB_get_array(tdbb, transaction, blob_id, p_ads);
|
||||
array = alloc_array(transaction, p_ads);
|
||||
array->arr_effective_length =
|
||||
blob->blb_length - array->arr_desc.iad_length;
|
||||
BLB_get_data(tdbb, blob, array->arr_data,
|
||||
array->arr_desc.iad_total_length);
|
||||
array->arr_effective_length = blob->blb_length - array->arr_desc.iad_length;
|
||||
BLB_get_data(tdbb, blob, array->arr_data, array->arr_desc.iad_total_length);
|
||||
arg.slice_high_water = array->arr_data + array->arr_effective_length;
|
||||
array->arr_blob = allocate_blob(tdbb, transaction);
|
||||
(array->arr_blob)->blb_blob_id = *blob_id;
|
||||
@ -1730,13 +1703,8 @@ void BLB_put_slice( thread_db* tdbb,
|
||||
SLONG variables[64];
|
||||
memcpy(variables, param, MIN(sizeof(variables), param_length));
|
||||
|
||||
if (SDL_walk(tdbb->tdbb_status_vector,
|
||||
sdl,
|
||||
array->arr_data,
|
||||
&array_desc->arr_desc,
|
||||
variables,
|
||||
slice_callback,
|
||||
&arg))
|
||||
if (SDL_walk(tdbb->tdbb_status_vector, sdl, array->arr_data, &array_desc->arr_desc,
|
||||
variables, slice_callback, &arg))
|
||||
{
|
||||
ERR_punt();
|
||||
}
|
||||
@ -1769,8 +1737,7 @@ void BLB_release_array(ArrayField* array)
|
||||
jrd_tra* transaction = array->arr_transaction;
|
||||
if (transaction)
|
||||
{
|
||||
for (ArrayField** ptr = &transaction->tra_arrays; *ptr;
|
||||
ptr = &(*ptr)->arr_next)
|
||||
for (ArrayField** ptr = &transaction->tra_arrays; *ptr; ptr = &(*ptr)->arr_next)
|
||||
{
|
||||
if (*ptr == array) {
|
||||
*ptr = array->arr_next;
|
||||
@ -1811,13 +1778,10 @@ void BLB_scalar(thread_db* tdbb,
|
||||
// We need DOUBLE_ALIGNed buffer, that's why some tricks
|
||||
HalfStaticArray<double, 64> temp;
|
||||
dsc desc = array_desc->iad_rpt[0].iad_desc;
|
||||
desc.dsc_address = reinterpret_cast<UCHAR*>
|
||||
(temp.getBuffer((desc.dsc_length / sizeof(double)) +
|
||||
(desc.dsc_length % sizeof(double) ? 1 : 0)));
|
||||
desc.dsc_address = reinterpret_cast<UCHAR*>(temp.getBuffer((desc.dsc_length / sizeof(double)) +
|
||||
(desc.dsc_length % sizeof(double) ? 1 : 0)));
|
||||
|
||||
const SLONG number =
|
||||
SDL_compute_subscript(tdbb->tdbb_status_vector, array_desc, count,
|
||||
subscripts);
|
||||
const SLONG number = SDL_compute_subscript(tdbb->tdbb_status_vector, array_desc, count, subscripts);
|
||||
if (number < 0) {
|
||||
BLB_close(tdbb, blob);
|
||||
ERR_punt();
|
||||
@ -1923,10 +1887,10 @@ static blb* allocate_blob(thread_db* tdbb, jrd_tra* transaction)
|
||||
}
|
||||
|
||||
|
||||
static ISC_STATUS blob_filter( USHORT action,
|
||||
BlobControl* control,
|
||||
SSHORT mode,
|
||||
SLONG offset)
|
||||
static ISC_STATUS blob_filter(USHORT action,
|
||||
BlobControl* control,
|
||||
SSHORT mode,
|
||||
SLONG offset)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1967,8 +1931,7 @@ static ISC_STATUS blob_filter( USHORT action,
|
||||
case isc_blob_filter_get_segment:
|
||||
blob = control->source_handle;
|
||||
control->ctl_segment_length =
|
||||
BLB_get_segment(tdbb, blob, control->ctl_buffer,
|
||||
control->ctl_buffer_length);
|
||||
BLB_get_segment(tdbb, blob, control->ctl_buffer, control->ctl_buffer_length);
|
||||
if (blob->blb_flags & BLB_eof) {
|
||||
return isc_segstr_eof;
|
||||
}
|
||||
@ -1978,14 +1941,12 @@ static ISC_STATUS blob_filter( USHORT action,
|
||||
return FB_SUCCESS;
|
||||
|
||||
case isc_blob_filter_create:
|
||||
control->source_handle =
|
||||
BLB_create2(tdbb, transaction, blob_id, 0, NULL);
|
||||
control->source_handle = BLB_create2(tdbb, transaction, blob_id, 0, NULL);
|
||||
return FB_SUCCESS;
|
||||
|
||||
case isc_blob_filter_put_segment:
|
||||
blob = control->source_handle;
|
||||
BLB_put_segment(tdbb, blob, control->ctl_buffer,
|
||||
control->ctl_buffer_length);
|
||||
BLB_put_segment(tdbb, blob, control->ctl_buffer, control->ctl_buffer_length);
|
||||
return FB_SUCCESS;
|
||||
|
||||
case isc_blob_filter_close:
|
||||
@ -2042,8 +2003,7 @@ static blb* copy_blob(thread_db* tdbb, const bid* source, bid* destination,
|
||||
UCHAR* buff = buffer.getBuffer(input->blb_max_segment);
|
||||
|
||||
while (true) {
|
||||
const USHORT length =
|
||||
BLB_get_segment(tdbb, input, buff, input->blb_max_segment);
|
||||
const USHORT length = BLB_get_segment(tdbb, input, buff, input->blb_max_segment);
|
||||
if (input->blb_flags & BLB_eof) {
|
||||
break;
|
||||
}
|
||||
@ -2125,8 +2085,7 @@ static void delete_blob(thread_db* tdbb, blb* blob, ULONG prior_page)
|
||||
PAG_release_page(tdbb, page1, prior);
|
||||
page = (blob_page*) buffer;
|
||||
const SLONG* ptr2 = page->blp_page;
|
||||
for (const SLONG* const end2 = ptr2 + blob->blb_pointers;
|
||||
ptr2 < end2; ptr2++)
|
||||
for (const SLONG* const end2 = ptr2 + blob->blb_pointers; ptr2 < end2; ptr2++)
|
||||
{
|
||||
if (*ptr2) {
|
||||
PAG_release_page(tdbb, PageNumber(pageSpaceID, *ptr2), page1);
|
||||
@ -2148,7 +2107,7 @@ static void delete_blob_id(
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Delete an existing blob for purposed of garbage collection.
|
||||
* Delete an existing blob for purpose of garbage collection.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
@ -2168,9 +2127,7 @@ static void delete_blob_id(
|
||||
blb* blob = allocate_blob(tdbb, dbb->dbb_sys_trans);
|
||||
blob->blb_relation = relation;
|
||||
blob->blb_pg_space_id = relation->getPages(tdbb)->rel_pg_space_id;
|
||||
prior_page =
|
||||
DPM_get_blob(tdbb, blob, blob_id->get_permanent_number(), true,
|
||||
prior_page);
|
||||
prior_page = DPM_get_blob(tdbb, blob, blob_id->get_permanent_number(), true, prior_page);
|
||||
|
||||
if (!(blob->blb_flags & BLB_damaged))
|
||||
delete_blob(tdbb, blob, prior_page);
|
||||
@ -2275,11 +2232,9 @@ static blob_page* get_next_page(thread_db* tdbb, blb* blob, WIN * window)
|
||||
if (!(blob->blb_sequence % dbb->dbb_prefetch_sequence)) {
|
||||
USHORT sequence = blob->blb_sequence;
|
||||
USHORT i = 0;
|
||||
while (i < dbb->dbb_prefetch_pages &&
|
||||
sequence <= blob->blb_max_sequence)
|
||||
while (i < dbb->dbb_prefetch_pages && sequence <= blob->blb_max_sequence)
|
||||
{
|
||||
pages[i++] =
|
||||
(*vector)[sequence++];
|
||||
pages[i++] = (*vector)[sequence++];
|
||||
}
|
||||
|
||||
CCH_PREFETCH(tdbb, pages, i);
|
||||
@ -2289,8 +2244,7 @@ static blob_page* get_next_page(thread_db* tdbb, blb* blob, WIN * window)
|
||||
page = (blob_page*) CCH_FETCH(tdbb, window, LCK_read, pag_blob);
|
||||
}
|
||||
else {
|
||||
window->win_page =
|
||||
(*vector)[blob->blb_sequence / blob->blb_pointers];
|
||||
window->win_page = (*vector)[blob->blb_sequence / blob->blb_pointers];
|
||||
page = (blob_page*) CCH_FETCH(tdbb, window, LCK_read, pag_blob);
|
||||
#ifdef SUPERSERVER_V2
|
||||
/* Perform prefetch of blob level 2 data pages. */
|
||||
@ -2300,9 +2254,8 @@ static blob_page* get_next_page(thread_db* tdbb, blb* blob, WIN * window)
|
||||
{
|
||||
ULONG abs_sequence = blob->blb_sequence;
|
||||
USHORT i = 0;
|
||||
while (i < dbb->dbb_prefetch_pages &&
|
||||
sequence < blob->blb_pointers &&
|
||||
abs_sequence <= blob->blb_max_sequence)
|
||||
while (i < dbb->dbb_prefetch_pages && sequence < blob->blb_pointers &&
|
||||
abs_sequence <= blob->blb_max_sequence)
|
||||
{
|
||||
pages[i++] = page->blp_page[sequence++];
|
||||
abs_sequence++;
|
||||
@ -2311,12 +2264,9 @@ static blob_page* get_next_page(thread_db* tdbb, blb* blob, WIN * window)
|
||||
CCH_PREFETCH(tdbb, pages, i);
|
||||
}
|
||||
#endif
|
||||
page = (blob_page*)CCH_HANDOFF(tdbb,
|
||||
window,
|
||||
page->blp_page[blob->blb_sequence %
|
||||
blob->blb_pointers],
|
||||
LCK_read,
|
||||
pag_blob);
|
||||
page = (blob_page*) CCH_HANDOFF(tdbb, window,
|
||||
page->blp_page[blob->blb_sequence % blob->blb_pointers],
|
||||
LCK_read, pag_blob);
|
||||
}
|
||||
|
||||
if (page->blp_sequence != (SLONG) blob->blb_sequence)
|
||||
@ -2453,7 +2403,7 @@ static void move_from_string(thread_db* tdbb, const dsc* from_desc, dsc* to_desc
|
||||
**************************************/
|
||||
SET_TDBB (tdbb);
|
||||
|
||||
UCHAR charSet = INTL_GET_CHARSET(from_desc);
|
||||
const UCHAR charSet = INTL_GET_CHARSET(from_desc);
|
||||
blb* blob = 0;
|
||||
UCHAR *fromstr = 0;
|
||||
bid temp_bid;
|
||||
@ -2463,7 +2413,7 @@ static void move_from_string(thread_db* tdbb, const dsc* from_desc, dsc* to_desc
|
||||
|
||||
MoveBuffer buffer;
|
||||
int length = MOV_make_string2(tdbb, from_desc, charSet, &fromstr, buffer);
|
||||
UCHAR toCharSet = to_desc->getCharSet();
|
||||
const UCHAR toCharSet = to_desc->getCharSet();
|
||||
|
||||
if ((charSet == CS_NONE || charSet == CS_BINARY || charSet == toCharSet) &&
|
||||
toCharSet != CS_NONE && toCharSet != CS_BINARY)
|
||||
@ -2502,7 +2452,8 @@ static void move_from_string(thread_db* tdbb, const dsc* from_desc, dsc* to_desc
|
||||
// variables. - 2007-03-24
|
||||
|
||||
jrd_tra* transaction = tdbb->getRequest()->req_transaction;
|
||||
if (transaction->tra_blobs->locate(blob_temp_id)) {
|
||||
if (transaction->tra_blobs->locate(blob_temp_id))
|
||||
{
|
||||
BlobIndex* current = &transaction->tra_blobs->current();
|
||||
if (current->bli_materialized) {
|
||||
// Delete BLOB from request owned blob list
|
||||
@ -2573,15 +2524,14 @@ static void move_to_string(thread_db* tdbb, dsc* fromDesc, dsc* toDesc)
|
||||
CharSet* toCharSet = INTL_charset_lookup(tdbb, INTL_GET_CHARSET(&blobAsText));
|
||||
|
||||
HalfStaticArray<UCHAR, BUFFER_SMALL> buffer;
|
||||
buffer.getBuffer((blob->blb_length / fromCharSet->minBytesPerChar()) *
|
||||
toCharSet->maxBytesPerChar());
|
||||
ULONG len = BLB_get_data(tdbb, blob, buffer.begin(), buffer.getCapacity(), true);
|
||||
buffer.getBuffer((blob->blb_length / fromCharSet->minBytesPerChar()) * toCharSet->maxBytesPerChar());
|
||||
const ULONG len = BLB_get_data(tdbb, blob, buffer.begin(), buffer.getCapacity(), true);
|
||||
|
||||
if (len > MAX_COLUMN_SIZE - sizeof(USHORT))
|
||||
ERR_post(Arg::Gds(isc_arith_except) << Arg::Gds(isc_blob_truncation));
|
||||
|
||||
blobAsText.dsc_address = buffer.begin();
|
||||
blobAsText.dsc_length = (USHORT)len;
|
||||
blobAsText.dsc_length = (USHORT) len;
|
||||
|
||||
MOV_move(tdbb, &blobAsText, toDesc);
|
||||
}
|
||||
@ -2641,8 +2591,7 @@ static void release_blob(blb* blob, const bool purge_flag)
|
||||
|
||||
if ((blob->blb_flags & BLB_temporary) && blob->blb_temp_size > 0)
|
||||
{
|
||||
blob->blb_transaction->getBlobSpace()->releaseSpace(
|
||||
blob->blb_temp_offset, blob->blb_temp_size);
|
||||
blob->blb_transaction->getBlobSpace()->releaseSpace(blob->blb_temp_offset, blob->blb_temp_size);
|
||||
}
|
||||
|
||||
delete blob;
|
||||
@ -2665,8 +2614,7 @@ static void slice_callback(array_slice* arg, ULONG count, DSC* descriptors)
|
||||
|
||||
dsc* array_desc = descriptors;
|
||||
dsc* slice_desc = &arg->slice_desc;
|
||||
BLOB_PTR* const next =
|
||||
slice_desc->dsc_address + arg->slice_element_length;
|
||||
BLOB_PTR* const next = slice_desc->dsc_address + arg->slice_element_length;
|
||||
|
||||
if (next > arg->slice_end)
|
||||
ERR_post(Arg::Gds(isc_out_of_bounds));
|
||||
@ -2696,8 +2644,7 @@ static void slice_callback(array_slice* arg, ULONG count, DSC* descriptors)
|
||||
|
||||
if (array_desc->dsc_dtype == dtype_varying &&
|
||||
(U_IPTR) array_desc->dsc_address !=
|
||||
FB_ALIGN((U_IPTR) array_desc->dsc_address,
|
||||
(MIN(sizeof(USHORT), FB_ALIGNMENT))))
|
||||
FB_ALIGN((U_IPTR) array_desc->dsc_address, (MIN(sizeof(USHORT), FB_ALIGNMENT))))
|
||||
{
|
||||
/* Note: cannot remove this JRD_get_thread_data without api change
|
||||
to slice callback routines */
|
||||
@ -2706,11 +2653,8 @@ static void slice_callback(array_slice* arg, ULONG count, DSC* descriptors)
|
||||
HalfStaticArray<char, 1024> tmp_buffer;
|
||||
const USHORT tmp_len = array_desc->dsc_length;
|
||||
const char* p;
|
||||
const USHORT len = MOV_make_string(slice_desc,
|
||||
INTL_TEXT_TYPE(*array_desc),
|
||||
&p,
|
||||
reinterpret_cast<vary*>(tmp_buffer.getBuffer(tmp_len)),
|
||||
tmp_len);
|
||||
const USHORT len = MOV_make_string(slice_desc, INTL_TEXT_TYPE(*array_desc), &p,
|
||||
reinterpret_cast<vary*>(tmp_buffer.getBuffer(tmp_len)), tmp_len);
|
||||
memcpy(array_desc->dsc_address, &len, sizeof(USHORT));
|
||||
memcpy(array_desc->dsc_address + sizeof(USHORT), p, (int) len);
|
||||
}
|
||||
@ -2718,8 +2662,7 @@ static void slice_callback(array_slice* arg, ULONG count, DSC* descriptors)
|
||||
{
|
||||
MOV_move(tdbb, slice_desc, array_desc);
|
||||
}
|
||||
const BLOB_PTR* const end =
|
||||
array_desc->dsc_address + array_desc->dsc_length;
|
||||
const BLOB_PTR* const end = array_desc->dsc_address + array_desc->dsc_length;
|
||||
if (end > arg->slice_high_water)
|
||||
arg->slice_high_water = end;
|
||||
}
|
||||
@ -2737,8 +2680,7 @@ static void slice_callback(array_slice* arg, ULONG count, DSC* descriptors)
|
||||
|
||||
if (array_desc->dsc_dtype == dtype_varying &&
|
||||
(U_IPTR) array_desc->dsc_address !=
|
||||
FB_ALIGN((U_IPTR) array_desc->dsc_address,
|
||||
(MIN(sizeof(USHORT), FB_ALIGNMENT))))
|
||||
FB_ALIGN((U_IPTR) array_desc->dsc_address, (MIN(sizeof(USHORT), FB_ALIGNMENT))))
|
||||
{
|
||||
// temp_desc will vanish at the end of the block, but it's used
|
||||
// only as a way to transfer blocks of memory.
|
||||
@ -2748,8 +2690,7 @@ static void slice_callback(array_slice* arg, ULONG count, DSC* descriptors)
|
||||
temp_desc.dsc_scale = array_desc->dsc_scale;
|
||||
temp_desc.dsc_flags = array_desc->dsc_flags;
|
||||
memcpy(&temp_desc.dsc_length, array_desc->dsc_address, sizeof(USHORT));
|
||||
temp_desc.dsc_address =
|
||||
array_desc->dsc_address + sizeof(USHORT);
|
||||
temp_desc.dsc_address = array_desc->dsc_address + sizeof(USHORT);
|
||||
MOV_move(tdbb, &temp_desc, slice_desc);
|
||||
}
|
||||
else
|
||||
@ -2794,8 +2735,7 @@ static blb* store_array(thread_db* tdbb, jrd_tra* transaction, bid* blob_id)
|
||||
|
||||
/* Write out array descriptor */
|
||||
|
||||
BLB_put_segment(tdbb, blob,
|
||||
reinterpret_cast<const UCHAR*>(&array->arr_desc),
|
||||
BLB_put_segment(tdbb, blob, reinterpret_cast<const UCHAR*>(&array->arr_desc),
|
||||
array->arr_desc.iad_length);
|
||||
|
||||
/* Write out actual array */
|
||||
|
109
src/jrd/dyn.epp
109
src/jrd/dyn.epp
@ -193,8 +193,7 @@ void DYN_error(bool status_flag,
|
||||
|
||||
if (number)
|
||||
{
|
||||
fb_msg_format(NULL, DYN_MSG_FAC, number,
|
||||
sizeof(error_buffer), error_buffer, sarg);
|
||||
fb_msg_format(NULL, DYN_MSG_FAC, number, sizeof(error_buffer), error_buffer, sarg);
|
||||
|
||||
ISC_STATUS_ARRAY temp_status;
|
||||
fb_utils::init_status(temp_status);
|
||||
@ -306,8 +305,8 @@ bool DYN_is_it_sql_role(Global* gbl,
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
X IN RDB$ROLES WITH
|
||||
X.RDB$ROLE_NAME EQ input_name.c_str()
|
||||
if (!DYN_REQUEST(drq_get_role_nm))
|
||||
DYN_REQUEST(drq_get_role_nm) = request;
|
||||
if (!DYN_REQUEST(drq_get_role_nm))
|
||||
DYN_REQUEST(drq_get_role_nm) = request;
|
||||
|
||||
found = true;
|
||||
output_name = X.RDB$OWNER_NAME;
|
||||
@ -589,8 +588,7 @@ void DYN_execute(Global* gbl,
|
||||
break;
|
||||
|
||||
case isc_dyn_def_idx:
|
||||
DYN_define_index(gbl, ptr, relation_name, verb, NULL, NULL, NULL,
|
||||
NULL);
|
||||
DYN_define_index(gbl, ptr, relation_name, verb, NULL, NULL, NULL, NULL);
|
||||
break;
|
||||
|
||||
case isc_dyn_mod_idx:
|
||||
@ -1194,8 +1192,7 @@ static void grant( Global* gbl, const UCHAR** ptr)
|
||||
try {
|
||||
|
||||
request = CMP_find_request(tdbb,
|
||||
(USHORT)(field.length() > 0 ? drq_l_grant1 : drq_l_grant2),
|
||||
DYN_REQUESTS);
|
||||
(USHORT)(field.length() > 0 ? drq_l_grant1 : drq_l_grant2), DYN_REQUESTS);
|
||||
for (const TEXT* pr = privileges; *pr; pr++)
|
||||
{
|
||||
bool duplicate = false;
|
||||
@ -1213,9 +1210,9 @@ static void grant( Global* gbl, const UCHAR** ptr)
|
||||
PRIV.RDB$USER_TYPE = user_type AND
|
||||
PRIV.RDB$GRANTOR EQ grantor.c_str() AND
|
||||
PRIV.RDB$FIELD_NAME EQ field.c_str()
|
||||
if (!DYN_REQUEST(drq_l_grant1)) {
|
||||
DYN_REQUEST(drq_l_grant1) = request;
|
||||
}
|
||||
if (!DYN_REQUEST(drq_l_grant1)) {
|
||||
DYN_REQUEST(drq_l_grant1) = request;
|
||||
}
|
||||
|
||||
if ((PRIV.RDB$GRANT_OPTION.NULL) ||
|
||||
(PRIV.RDB$GRANT_OPTION) ||
|
||||
@ -1245,8 +1242,8 @@ static void grant( Global* gbl, const UCHAR** ptr)
|
||||
PRIV.RDB$USER_TYPE = user_type AND
|
||||
PRIV.RDB$GRANTOR EQ grantor.c_str() AND
|
||||
PRIV.RDB$FIELD_NAME MISSING
|
||||
if (!DYN_REQUEST(drq_l_grant2))
|
||||
DYN_REQUEST(drq_l_grant2) = request;
|
||||
if (!DYN_REQUEST(drq_l_grant2))
|
||||
DYN_REQUEST(drq_l_grant2) = request;
|
||||
|
||||
if ((PRIV.RDB$GRANT_OPTION.NULL) ||
|
||||
(PRIV.RDB$GRANT_OPTION) ||
|
||||
@ -1325,8 +1322,7 @@ static void grant( Global* gbl, const UCHAR** ptr)
|
||||
}
|
||||
|
||||
id = drq_s_grant;
|
||||
store_privilege(gbl, object, user, field, pr, user_type, obj_type,
|
||||
options, grantor);
|
||||
store_privilege(gbl, object, user, field, pr, user_type, obj_type, options, grantor);
|
||||
} // for (...)
|
||||
|
||||
} // try
|
||||
@ -1467,7 +1463,7 @@ static bool grantor_can_grant(Global* gbl,
|
||||
REL IN RDB$RELATIONS WITH
|
||||
REL.RDB$RELATION_NAME = relation_name.c_str() AND
|
||||
REL.RDB$OWNER_NAME = UPPERCASE(grantor)
|
||||
if (!DYN_REQUEST(drq_gcg2))
|
||||
if (!DYN_REQUEST(drq_gcg2))
|
||||
DYN_REQUEST(drq_gcg2) = request;
|
||||
grantor_is_owner = true;
|
||||
END_FOR;
|
||||
@ -1499,7 +1495,8 @@ static bool grantor_can_grant(Global* gbl,
|
||||
PRV.RDB$USER_TYPE = obj_user AND
|
||||
PRV.RDB$RELATION_NAME = relation_name.c_str() AND
|
||||
PRV.RDB$OBJECT_TYPE = obj_relation AND
|
||||
PRV.RDB$PRIVILEGE = privilege if (!DYN_REQUEST(drq_gcg1))
|
||||
PRV.RDB$PRIVILEGE = privilege
|
||||
if (!DYN_REQUEST(drq_gcg1))
|
||||
DYN_REQUEST(drq_gcg1) = request;
|
||||
|
||||
if (PRV.RDB$FIELD_NAME.NULL) {
|
||||
@ -1531,9 +1528,7 @@ static bool grantor_can_grant(Global* gbl,
|
||||
{
|
||||
DYN_error(false,
|
||||
(USHORT)(top_level ? 167 : 168),
|
||||
SafeArg() << privilege <<
|
||||
field_name.c_str() <<
|
||||
relation_name.c_str());
|
||||
SafeArg() << privilege << field_name.c_str() << relation_name.c_str());
|
||||
/* no grant option for privilege .. on column .. of [base] table/view .. */
|
||||
return false;
|
||||
}
|
||||
@ -1544,9 +1539,7 @@ static bool grantor_can_grant(Global* gbl,
|
||||
{
|
||||
DYN_error(false,
|
||||
(USHORT)(top_level ? 169 : 170),
|
||||
SafeArg() << privilege <<
|
||||
relation_name.c_str() <<
|
||||
field_name.c_str());
|
||||
SafeArg() << privilege << relation_name.c_str() << field_name.c_str());
|
||||
/* no grant option for privilege .. on [base] table/view .. (for column ..) */
|
||||
return false;
|
||||
}
|
||||
@ -1555,9 +1548,7 @@ static bool grantor_can_grant(Global* gbl,
|
||||
{
|
||||
DYN_error(false,
|
||||
(USHORT)(top_level ? 171 : 172),
|
||||
SafeArg() << privilege <<
|
||||
relation_name.c_str() <<
|
||||
field_name.c_str());
|
||||
SafeArg() << privilege << relation_name.c_str() << field_name.c_str());
|
||||
/* no .. privilege with grant option on [base] table/view .. (for column ..) */
|
||||
return false;
|
||||
}
|
||||
@ -1602,27 +1593,22 @@ static bool grantor_can_grant(Global* gbl,
|
||||
G_FLD.RDB$BASE_FIELD NOT MISSING AND
|
||||
G_VIEW.RDB$VIEW_NAME EQ G_FLD.RDB$RELATION_NAME AND
|
||||
G_VIEW.RDB$VIEW_CONTEXT EQ G_FLD.RDB$VIEW_CONTEXT
|
||||
if (!DYN_REQUEST(drq_gcg3)) {
|
||||
DYN_REQUEST(drq_gcg3) = request;
|
||||
}
|
||||
if (!DYN_REQUEST(drq_gcg3)) {
|
||||
DYN_REQUEST(drq_gcg3) = request;
|
||||
}
|
||||
|
||||
if (field_name.length())
|
||||
{
|
||||
if (field_name == G_FLD.RDB$FIELD_NAME)
|
||||
if (!grantor_can_grant
|
||||
(gbl, grantor, privilege, G_VIEW.RDB$RELATION_NAME,
|
||||
G_FLD.RDB$BASE_FIELD, false))
|
||||
if (!grantor_can_grant(gbl, grantor, privilege, G_VIEW.RDB$RELATION_NAME,
|
||||
G_FLD.RDB$BASE_FIELD, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!grantor_can_grant(gbl,
|
||||
grantor,
|
||||
privilege,
|
||||
G_VIEW.RDB$RELATION_NAME,
|
||||
G_FLD.RDB$BASE_FIELD,
|
||||
false))
|
||||
if (!grantor_can_grant(gbl, grantor, privilege, G_VIEW.RDB$RELATION_NAME,
|
||||
G_FLD.RDB$BASE_FIELD, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1701,9 +1687,9 @@ static bool grantor_can_grant_role(thread_db* tdbb,
|
||||
PRV.RDB$RELATION_NAME EQ role_name.c_str() AND
|
||||
PRV.RDB$OBJECT_TYPE = obj_sql_role AND
|
||||
PRV.RDB$PRIVILEGE EQ "M"
|
||||
if (!DYN_REQUEST(drq_get_role_au)) {
|
||||
DYN_REQUEST(drq_get_role_au) = request;
|
||||
}
|
||||
if (!DYN_REQUEST(drq_get_role_au)) {
|
||||
DYN_REQUEST(drq_get_role_au) = request;
|
||||
}
|
||||
|
||||
if (PRV.RDB$GRANT_OPTION == 2)
|
||||
grantable = true;
|
||||
@ -1937,8 +1923,8 @@ static void revoke_permission(Global* gbl, const UCHAR** ptr)
|
||||
PRIV.RDB$USER = user.c_str() AND
|
||||
PRIV.RDB$USER_TYPE = user_type AND
|
||||
PRIV.RDB$FIELD_NAME EQ field.c_str()
|
||||
if (!DYN_REQUEST(drq_e_grant1))
|
||||
DYN_REQUEST(drq_e_grant1) = request;
|
||||
if (!DYN_REQUEST(drq_e_grant1))
|
||||
DYN_REQUEST(drq_e_grant1) = request;
|
||||
|
||||
if (revoking_as_user_name == PRIV.RDB$GRANTOR)
|
||||
{
|
||||
@ -1963,8 +1949,8 @@ static void revoke_permission(Global* gbl, const UCHAR** ptr)
|
||||
PRIV.RDB$OBJECT_TYPE = obj_type AND
|
||||
PRIV.RDB$USER EQ user.c_str() AND
|
||||
PRIV.RDB$USER_TYPE = user_type
|
||||
if (!DYN_REQUEST(drq_e_grant2))
|
||||
DYN_REQUEST(drq_e_grant2) = request;
|
||||
if (!DYN_REQUEST(drq_e_grant2))
|
||||
DYN_REQUEST(drq_e_grant2) = request;
|
||||
|
||||
/* revoking a permission at the table level implies
|
||||
revoking the perm. on all columns. So for all fields
|
||||
@ -2011,9 +1997,8 @@ static void revoke_permission(Global* gbl, const UCHAR** ptr)
|
||||
|
||||
if (!grant_erased)
|
||||
{
|
||||
ERR_post_warning(Arg::Warning(isc_dyn_miss_priv_warning) << Arg::Str(privilege_name(temp[0])) <<
|
||||
Arg::Str(object) <<
|
||||
Arg::Str(user));
|
||||
ERR_post_warning(Arg::Warning(isc_dyn_miss_priv_warning) <<
|
||||
Arg::Str(privilege_name(temp[0])) << Arg::Str(object) << Arg::Str(user));
|
||||
// msg 247: Warning: @1 on @2 is not granted to @3.
|
||||
}
|
||||
}
|
||||
@ -2024,8 +2009,7 @@ static void revoke_permission(Global* gbl, const UCHAR** ptr)
|
||||
/* we need to rundown as we have to set the env.
|
||||
But in case the error is from store_priveledge we have already
|
||||
unwound the request so passing that as null */
|
||||
DYN_rundown_request(((id == drq_s_grant) ? NULL : request),
|
||||
-1);
|
||||
DYN_rundown_request(((id == drq_s_grant) ? NULL : request), -1);
|
||||
if (id == drq_e_grant1)
|
||||
{
|
||||
DYN_error_punt(true, 111);
|
||||
@ -2122,18 +2106,18 @@ static void revoke_all(Global* gbl, const UCHAR** ptr)
|
||||
PRIV.RDB$USER = user.c_str() AND
|
||||
PRIV.RDB$USER_TYPE = user_type
|
||||
|
||||
if (!DYN_REQUEST(drq_e_grant1))
|
||||
DYN_REQUEST(drq_e_grant1) = request;
|
||||
if (!DYN_REQUEST(drq_e_grant1))
|
||||
DYN_REQUEST(drq_e_grant1) = request;
|
||||
|
||||
if (revoking_user->locksmith() || revoking_as_user_name == PRIV.RDB$GRANTOR)
|
||||
{
|
||||
ERASE PRIV;
|
||||
grant_erased = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bad_grantor = true;
|
||||
}
|
||||
if (revoking_user->locksmith() || revoking_as_user_name == PRIV.RDB$GRANTOR)
|
||||
{
|
||||
ERASE PRIV;
|
||||
grant_erased = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bad_grantor = true;
|
||||
}
|
||||
END_FOR;
|
||||
if (!DYN_REQUEST(drq_e_grant3)) {
|
||||
DYN_REQUEST(drq_e_grant3) = request;
|
||||
@ -2195,8 +2179,7 @@ static void set_field_class_name(Global* gbl,
|
||||
while (!unique)
|
||||
{
|
||||
sprintf(RFR.RDB$SECURITY_CLASS, "%s%" SQUADFORMAT, "SQL$GRANT",
|
||||
DPM_gen_id(tdbb,
|
||||
MET_lookup_generator(tdbb, "RDB$SECURITY_CLASS"), false, (SINT64) 1));
|
||||
DPM_gen_id(tdbb, MET_lookup_generator(tdbb, "RDB$SECURITY_CLASS"), false, 1));
|
||||
|
||||
unique = true;
|
||||
request2 = CMP_find_request(tdbb, drq_s_u_class, DYN_REQUESTS);
|
||||
|
@ -90,7 +90,8 @@ void DYN_error(bool, USHORT, const MsgFormat::SafeArg& sarg = MsgFormat::SafeArg
|
||||
void DYN_error_punt(bool, USHORT, const MsgFormat::SafeArg& arg);
|
||||
void DYN_error_punt(bool, USHORT, const char* str);
|
||||
void DYN_error_punt(bool, USHORT);
|
||||
void DYN_execute(Jrd::Global*, const UCHAR**, const Firebird::MetaName*, Firebird::MetaName*, Firebird::MetaName*, Firebird::MetaName*, Firebird::MetaName*);
|
||||
void DYN_execute(Jrd::Global*, const UCHAR**, const Firebird::MetaName*, Firebird::MetaName*,
|
||||
Firebird::MetaName*, Firebird::MetaName*, Firebird::MetaName*);
|
||||
SLONG DYN_get_number(const UCHAR**);
|
||||
USHORT DYN_get_string(const TEXT**, Firebird::MetaName&, size_t, bool);
|
||||
USHORT DYN_get_string(const TEXT**, Firebird::PathName&, size_t, bool);
|
||||
|
@ -192,7 +192,7 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr)
|
||||
{
|
||||
X.RDB$CHARACTER_SET_ID.NULL = FALSE;
|
||||
X.RDB$CHARACTER_SET_ID = DYN_get_number(ptr);
|
||||
|
||||
|
||||
cs = INTL_charset_lookup(tdbb, X.RDB$CHARACTER_SET_ID);
|
||||
|
||||
jrd_req* request2 = CMP_find_request(tdbb, drq_l_charset, DYN_REQUESTS);
|
||||
@ -334,7 +334,7 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
const Firebird::string s = Firebird::IntlUtil::generateSpecificAttributes(cs, map);
|
||||
Firebird::string newSpecificAttributes;
|
||||
|
||||
|
||||
if (!IntlManager::setupCollationAttributes(
|
||||
info.baseCollationName.c_str(), info.charsetName.c_str(), s,
|
||||
newSpecificAttributes))
|
||||
@ -349,7 +349,7 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
info.attributes = (info.attributes | attributes_on) & (~attributes_off);
|
||||
X.RDB$COLLATION_ATTRIBUTES = info.attributes;
|
||||
|
||||
|
||||
if (info.specificAttributes.getCount() != 0)
|
||||
{
|
||||
X.RDB$SPECIFIC_ATTRIBUTES.NULL = FALSE;
|
||||
@ -361,8 +361,10 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr)
|
||||
bpb[6] = X.RDB$CHARACTER_SET_ID; // from charset
|
||||
bpb[12] = CS_METADATA; // to charset
|
||||
|
||||
blb* blob = BLB_create2(tdbb, gbl->gbl_transaction, &X.RDB$SPECIFIC_ATTRIBUTES, sizeof(bpb), bpb);
|
||||
BLB_put_segment(tdbb, blob, info.specificAttributes.begin(), info.specificAttributes.getCount());
|
||||
blb* blob = BLB_create2(tdbb, gbl->gbl_transaction, &X.RDB$SPECIFIC_ATTRIBUTES,
|
||||
sizeof(bpb), bpb);
|
||||
BLB_put_segment(tdbb, blob, info.specificAttributes.begin(),
|
||||
info.specificAttributes.getCount());
|
||||
BLB_close(tdbb, blob);
|
||||
}
|
||||
|
||||
@ -477,15 +479,14 @@ void DYN_define_constraint(Global* gbl,
|
||||
if (verb != isc_dyn_def_trigger && verb != isc_dyn_fld_not_null) {
|
||||
referred_index_name = "";
|
||||
DYN_define_index(gbl, ptr, relation_name, verb, &index_name,
|
||||
&referred_index_name, &constraint_name,
|
||||
&ri_action);
|
||||
&referred_index_name, &constraint_name, &ri_action);
|
||||
strcpy(CRT.RDB$INDEX_NAME, index_name.c_str());
|
||||
CRT.RDB$INDEX_NAME.NULL = FALSE;
|
||||
|
||||
SSHORT old_id = id;
|
||||
id = drq_l_rel_info;
|
||||
check_foreign_key_temp_scope(tdbb, gbl,
|
||||
relation_name->c_str(), referred_index_name.c_str());
|
||||
check_foreign_key_temp_scope(tdbb, gbl,
|
||||
relation_name->c_str(), referred_index_name.c_str());
|
||||
id = old_id;
|
||||
|
||||
/* check that we have references permissions on the table and
|
||||
@ -538,17 +539,14 @@ void DYN_define_constraint(Global* gbl,
|
||||
|
||||
DYN_rundown_request(request, local_id);
|
||||
|
||||
DYN_error_punt(true,
|
||||
number,
|
||||
number == 124 ? constraint_name.c_str() : NULL);
|
||||
DYN_error_punt(true, number, number == 124 ? constraint_name.c_str() : NULL);
|
||||
}
|
||||
|
||||
if (verb == isc_dyn_def_trigger)
|
||||
{
|
||||
do {
|
||||
DYN_define_trigger(gbl, ptr, relation_name, &trigger_name, false);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, constraint_name,
|
||||
trigger_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, constraint_name, trigger_name);
|
||||
} while ((verb = *(*ptr)++) == isc_dyn_def_trigger);
|
||||
|
||||
if (verb != isc_dyn_end) {
|
||||
@ -560,8 +558,7 @@ void DYN_define_constraint(Global* gbl,
|
||||
if (verb == isc_dyn_fld_not_null)
|
||||
{
|
||||
fb_assert(field_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, constraint_name,
|
||||
*field_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, constraint_name, *field_name);
|
||||
|
||||
if (*(*ptr)++ != isc_dyn_end) {
|
||||
DYN_unsupported_verb();
|
||||
@ -717,8 +714,7 @@ void DYN_define_constraint(Global* gbl,
|
||||
if (!DYN_REQUEST(drq_l_intg_con))
|
||||
DYN_REQUEST(drq_l_intg_con) = request;
|
||||
|
||||
fb_utils::exact_name_limit(CRT.RDB$CONSTRAINT_NAME,
|
||||
sizeof(CRT.RDB$CONSTRAINT_NAME));
|
||||
fb_utils::exact_name_limit(CRT.RDB$CONSTRAINT_NAME, sizeof(CRT.RDB$CONSTRAINT_NAME));
|
||||
strcpy(REF.RDB$CONST_NAME_UQ, CRT.RDB$CONSTRAINT_NAME);
|
||||
strcpy(REF.RDB$CONSTRAINT_NAME, constraint_name.c_str());
|
||||
|
||||
@ -794,9 +790,7 @@ void DYN_define_constraint(Global* gbl,
|
||||
|
||||
DYN_rundown_request(request, local_id);
|
||||
|
||||
DYN_error_punt(true,
|
||||
number,
|
||||
number == 124 ? constraint_name.c_str() : NULL);
|
||||
DYN_error_punt(true, number, number == 124 ? constraint_name.c_str() : NULL);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -867,8 +861,7 @@ void DYN_define_dimension(Global* gbl,
|
||||
|
||||
default:
|
||||
--(*ptr);
|
||||
DYN_execute(gbl, ptr, relation_name, field_name,
|
||||
NULL, NULL, NULL);
|
||||
DYN_execute(gbl, ptr, relation_name, field_name, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -948,8 +941,7 @@ void DYN_define_exception( Global* gbl, const UCHAR** ptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
SINT64 xcp_id =
|
||||
DYN_UTIL_gen_unique_id(tdbb, gbl, drq_g_nxt_xcp_id, "RDB$EXCEPTIONS");
|
||||
SINT64 xcp_id = DYN_UTIL_gen_unique_id(tdbb, gbl, drq_g_nxt_xcp_id, "RDB$EXCEPTIONS");
|
||||
|
||||
xcp_id %= (MAX_SSHORT + 1);
|
||||
|
||||
@ -1060,12 +1052,12 @@ void DYN_define_file(Global* gbl,
|
||||
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
FIRST 1 X IN RDB$FILES WITH X.RDB$FILE_NAME EQ temp_f.c_str()
|
||||
if (!DYN_REQUEST(drq_l_files))
|
||||
DYN_REQUEST(drq_l_files) = request;
|
||||
if (!DYN_REQUEST(drq_l_files))
|
||||
DYN_REQUEST(drq_l_files) = request;
|
||||
|
||||
DYN_error_punt(false, 166);
|
||||
DYN_error_punt(false, 166);
|
||||
END_FOR;
|
||||
|
||||
|
||||
if (!DYN_REQUEST(drq_l_files))
|
||||
DYN_REQUEST(drq_l_files) = request;
|
||||
|
||||
@ -1590,8 +1582,7 @@ void DYN_define_generator( Global* gbl, const UCHAR** ptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
SINT64 gen_id =
|
||||
DYN_UTIL_gen_unique_id(tdbb, gbl, drq_g_nxt_gen_id, "RDB$GENERATORS");
|
||||
SINT64 gen_id = DYN_UTIL_gen_unique_id(tdbb, gbl, drq_g_nxt_gen_id, "RDB$GENERATORS");
|
||||
|
||||
gen_id %= (MAX_SSHORT + 1);
|
||||
|
||||
@ -1719,7 +1710,7 @@ void DYN_define_global_field(Global* gbl,
|
||||
FLD.RDB$CHARACTER_SET_ID.NULL = TRUE;
|
||||
FLD.RDB$COLLATION_ID.NULL = TRUE;
|
||||
FLD.RDB$FIELD_PRECISION.NULL = TRUE;
|
||||
|
||||
|
||||
bool has_dimensions = false;
|
||||
bool has_default = false;
|
||||
|
||||
@ -1892,9 +1883,8 @@ void DYN_define_global_field(Global* gbl,
|
||||
default:
|
||||
--(*ptr);
|
||||
MetaTmp(FLD.RDB$FIELD_NAME)
|
||||
DYN_execute(gbl, ptr, relation_name,
|
||||
field_name ? field_name : &tmp,
|
||||
NULL, NULL, NULL);
|
||||
DYN_execute(gbl, ptr, relation_name, field_name ? field_name : &tmp,
|
||||
NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2008,14 +1998,14 @@ void DYN_define_index(Global* gbl,
|
||||
SSHORT old_id = id;
|
||||
request = CMP_find_request(tdbb, drq_l_view_idx, DYN_REQUESTS);
|
||||
id = drq_l_view_idx;
|
||||
|
||||
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
VREL IN RDB$RELATIONS
|
||||
WITH VREL.RDB$RELATION_NAME EQ IDX.RDB$RELATION_NAME
|
||||
|
||||
|
||||
if (!DYN_REQUEST(drq_l_view_idx))
|
||||
DYN_REQUEST(drq_l_view_idx) = request;
|
||||
|
||||
|
||||
if (!VREL.RDB$VIEW_BLR.NULL)
|
||||
DYN_error_punt(false, 181);
|
||||
/* msg 181: "attempt to index a view" */
|
||||
@ -2035,7 +2025,7 @@ void DYN_define_index(Global* gbl,
|
||||
old_id = id;
|
||||
request = CMP_find_request(tdbb, drq_l_lfield, DYN_REQUESTS);
|
||||
id = drq_l_lfield;
|
||||
|
||||
|
||||
ULONG referred_cols = 0;
|
||||
|
||||
while ((verb = *(*ptr)++) != isc_dyn_end)
|
||||
@ -2065,12 +2055,11 @@ void DYN_define_index(Global* gbl,
|
||||
{
|
||||
if (seg_list[iter] == str)
|
||||
{
|
||||
DYN_error_punt(false, 240, SafeArg() << str.c_str() <<
|
||||
IDX.RDB$INDEX_NAME);
|
||||
// msg 240 "Field %s cannot be used twice in index %s"
|
||||
DYN_error_punt(false, 240, SafeArg() << str.c_str() << IDX.RDB$INDEX_NAME);
|
||||
// msg 240 "Field %s cannot be used twice in index %s"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
seg_count++;
|
||||
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
@ -2137,8 +2126,7 @@ void DYN_define_index(Global* gbl,
|
||||
}
|
||||
if (key_length)
|
||||
{
|
||||
key_length += ((length + STUFF_COUNT - 1) /
|
||||
(unsigned) STUFF_COUNT) *
|
||||
key_length += ((length + STUFF_COUNT - 1) / (unsigned) STUFF_COUNT) *
|
||||
(STUFF_COUNT + 1);
|
||||
}
|
||||
else
|
||||
@ -2194,11 +2182,9 @@ void DYN_define_index(Global* gbl,
|
||||
(*ri_actionP) |= FOR_KEY_DEL_CASCADE;
|
||||
if ((verb = *(*ptr)++) == isc_dyn_def_trigger)
|
||||
{
|
||||
DYN_define_trigger(gbl, ptr, relation_name,
|
||||
&trigger_name, true);
|
||||
DYN_define_trigger(gbl, ptr, relation_name, &trigger_name, true);
|
||||
fb_assert(cnst_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name,
|
||||
trigger_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name, trigger_name);
|
||||
}
|
||||
else
|
||||
DYN_unsupported_verb();
|
||||
@ -2207,11 +2193,9 @@ void DYN_define_index(Global* gbl,
|
||||
(*ri_actionP) |= FOR_KEY_DEL_NULL;
|
||||
if ((verb = *(*ptr)++) == isc_dyn_def_trigger)
|
||||
{
|
||||
DYN_define_trigger(gbl, ptr, relation_name,
|
||||
&trigger_name, true);
|
||||
DYN_define_trigger(gbl, ptr, relation_name, &trigger_name, true);
|
||||
fb_assert(cnst_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name,
|
||||
trigger_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name, trigger_name);
|
||||
}
|
||||
else
|
||||
DYN_unsupported_verb();
|
||||
@ -2220,11 +2204,9 @@ void DYN_define_index(Global* gbl,
|
||||
(*ri_actionP) |= FOR_KEY_DEL_DEFAULT;
|
||||
if ((verb = *(*ptr)++) == isc_dyn_def_trigger)
|
||||
{
|
||||
DYN_define_trigger(gbl, ptr, relation_name,
|
||||
&trigger_name, true);
|
||||
DYN_define_trigger(gbl, ptr, relation_name, &trigger_name, true);
|
||||
fb_assert(cnst_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name,
|
||||
trigger_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name, trigger_name);
|
||||
}
|
||||
else
|
||||
DYN_unsupported_verb();
|
||||
@ -2246,11 +2228,9 @@ void DYN_define_index(Global* gbl,
|
||||
(*ri_actionP) |= FOR_KEY_UPD_CASCADE;
|
||||
if ((verb = *(*ptr)++) == isc_dyn_def_trigger)
|
||||
{
|
||||
DYN_define_trigger(gbl, ptr, relation_name,
|
||||
&trigger_name, true);
|
||||
DYN_define_trigger(gbl, ptr, relation_name, &trigger_name, true);
|
||||
fb_assert(cnst_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name,
|
||||
trigger_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name, trigger_name);
|
||||
}
|
||||
else
|
||||
DYN_unsupported_verb();
|
||||
@ -2259,11 +2239,9 @@ void DYN_define_index(Global* gbl,
|
||||
(*ri_actionP) |= FOR_KEY_UPD_NULL;
|
||||
if ((verb = *(*ptr)++) == isc_dyn_def_trigger)
|
||||
{
|
||||
DYN_define_trigger(gbl, ptr, relation_name,
|
||||
&trigger_name, true);
|
||||
DYN_define_trigger(gbl, ptr, relation_name, &trigger_name, true);
|
||||
fb_assert(cnst_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name,
|
||||
trigger_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name, trigger_name);
|
||||
}
|
||||
else
|
||||
DYN_unsupported_verb();
|
||||
@ -2272,11 +2250,9 @@ void DYN_define_index(Global* gbl,
|
||||
(*ri_actionP) |= FOR_KEY_UPD_DEFAULT;
|
||||
if ((verb = *(*ptr)++) == isc_dyn_def_trigger)
|
||||
{
|
||||
DYN_define_trigger(gbl, ptr, relation_name,
|
||||
&trigger_name, true);
|
||||
DYN_define_trigger(gbl, ptr, relation_name, &trigger_name, true);
|
||||
fb_assert(cnst_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name,
|
||||
trigger_name);
|
||||
DYN_UTIL_store_check_constraints(tdbb, gbl, *cnst_name, trigger_name);
|
||||
}
|
||||
else
|
||||
DYN_unsupported_verb();
|
||||
@ -2413,7 +2389,7 @@ void DYN_define_index(Global* gbl,
|
||||
found = true;
|
||||
isView = !X.RDB$VIEW_BLR.NULL;
|
||||
END_FOR
|
||||
|
||||
|
||||
CMP_release(tdbb, request2);
|
||||
|
||||
if (isView)
|
||||
@ -2602,9 +2578,9 @@ void DYN_define_local_field(Global* gbl,
|
||||
RFR.RDB$DEFAULT_SOURCE.NULL = TRUE;
|
||||
RFR.RDB$EDIT_STRING.NULL = TRUE;
|
||||
RFR.RDB$COLLATION_ID.NULL = TRUE;
|
||||
|
||||
|
||||
bool has_default = false;
|
||||
|
||||
|
||||
while ((verb = *(*ptr)++) != isc_dyn_end)
|
||||
switch (verb)
|
||||
{
|
||||
@ -2756,8 +2732,7 @@ void DYN_define_local_field(Global* gbl,
|
||||
if (RFR.RDB$FIELD_POSITION.NULL == TRUE) {
|
||||
fld_pos = -1;
|
||||
fb_assert(relation_name);
|
||||
DYN_UTIL_generate_field_position(tdbb, gbl, *relation_name,
|
||||
&fld_pos);
|
||||
DYN_UTIL_generate_field_position(tdbb, gbl, *relation_name, &fld_pos);
|
||||
|
||||
if (fld_pos >= 0) {
|
||||
RFR.RDB$FIELD_POSITION = (SSHORT)++fld_pos;
|
||||
@ -2772,7 +2747,7 @@ void DYN_define_local_field(Global* gbl,
|
||||
|
||||
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
FLD IN RDB$FIELDS
|
||||
|
||||
|
||||
FLD.RDB$SYSTEM_FLAG = 0;
|
||||
FLD.RDB$SYSTEM_FLAG.NULL = FALSE;
|
||||
strcpy(FLD.RDB$FIELD_NAME, RFR.RDB$FIELD_SOURCE);
|
||||
@ -2961,7 +2936,7 @@ void DYN_define_parameter( Global* gbl, const UCHAR** ptr, Firebird::MetaName* p
|
||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_original) < ODS_11_1)
|
||||
{
|
||||
// Feature not supported on ODS version older than %d.%d
|
||||
ERR_post(Arg::Gds(isc_dsql_feature_not_supported_ods) << Arg::Num(11) <<
|
||||
ERR_post(Arg::Gds(isc_dsql_feature_not_supported_ods) << Arg::Num(11) <<
|
||||
Arg::Num(1));
|
||||
}
|
||||
|
||||
@ -3062,7 +3037,7 @@ void DYN_define_parameter( Global* gbl, const UCHAR** ptr, Firebird::MetaName* p
|
||||
case isc_dyn_prm_mechanism:
|
||||
mechanism = (prm_mech_t) DYN_get_number(ptr);
|
||||
break;
|
||||
|
||||
|
||||
case isc_dyn_rel_name:
|
||||
GET_STRING(ptr, rel_name);
|
||||
break;
|
||||
@ -3178,8 +3153,7 @@ void DYN_define_parameter( Global* gbl, const UCHAR** ptr, Firebird::MetaName* p
|
||||
else
|
||||
{
|
||||
// Feature not supported on ODS version older than %d.%d
|
||||
ERR_post(Arg::Gds(isc_dsql_feature_not_supported_ods) << Arg::Num(11) <<
|
||||
Arg::Num(1));
|
||||
ERR_post(Arg::Gds(isc_dsql_feature_not_supported_ods) << Arg::Num(11) << Arg::Num(1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3215,8 +3189,7 @@ void DYN_define_parameter( Global* gbl, const UCHAR** ptr, Firebird::MetaName* p
|
||||
request = NULL;
|
||||
id = -1;
|
||||
|
||||
ERR_post(Arg::Gds(isc_dsql_feature_not_supported_ods) << Arg::Num(11) <<
|
||||
Arg::Num(2));
|
||||
ERR_post(Arg::Gds(isc_dsql_feature_not_supported_ods) << Arg::Num(11) << Arg::Num(2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3372,7 +3345,7 @@ void DYN_define_procedure( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
P.RDB$SYSTEM_FLAG.NULL = FALSE;
|
||||
P.RDB$SYSTEM_FLAG = sys_flag;
|
||||
|
||||
|
||||
if (blr_ptr) {
|
||||
P.RDB$PROCEDURE_BLR.NULL = FALSE;
|
||||
temp_ptr = blr_ptr;
|
||||
@ -3623,7 +3596,7 @@ void DYN_define_relation( Global* gbl, const UCHAR** ptr)
|
||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_original) < ODS_11_1)
|
||||
{
|
||||
// msg 248: "Feature ''@1'' is not supported in ODS @2.@3"
|
||||
DYN_error_punt(false, 248, SafeArg() << "GLOBAL TEMPORARY TABLE" <<
|
||||
DYN_error_punt(false, 248, SafeArg() << "GLOBAL TEMPORARY TABLE" <<
|
||||
dbb->dbb_ods_version << dbb->dbb_minor_original);
|
||||
}
|
||||
switch (DYN_get_number(ptr))
|
||||
@ -3652,7 +3625,7 @@ void DYN_define_relation( Global* gbl, const UCHAR** ptr)
|
||||
id = drq_l_rel_info2;
|
||||
check_relation_temp_scope(tdbb, gbl, REL.RDB$RELATION_NAME, rel_type);
|
||||
id = old_id;
|
||||
|
||||
|
||||
if (sql_prot) {
|
||||
if (!get_who(tdbb, gbl, owner_name))
|
||||
DYN_error_punt(true, 115);
|
||||
@ -3676,8 +3649,7 @@ void DYN_define_relation( Global* gbl, const UCHAR** ptr)
|
||||
fb_utils::exact_name_limit(PREL.RDB$OWNER_NAME, sizeof(PREL.RDB$OWNER_NAME));
|
||||
if (owner_name != PREL.RDB$OWNER_NAME) {
|
||||
SecurityClass::flags_t priv;
|
||||
if (!DYN_UTIL_get_prot
|
||||
(tdbb, gbl, PREL.RDB$RELATION_NAME, "", &priv))
|
||||
if (!DYN_UTIL_get_prot(tdbb, gbl, PREL.RDB$RELATION_NAME, "", &priv))
|
||||
{
|
||||
// I think this should be the responsability of DFW
|
||||
// or the user will find ways to circumvent DYN.
|
||||
@ -4060,7 +4032,7 @@ void DYN_define_sql_field(Global* gbl,
|
||||
|
||||
bool has_dimensions = false;
|
||||
bool has_default = false;
|
||||
|
||||
|
||||
DYN_UTIL_generate_field_name(tdbb, gbl, RFR.RDB$FIELD_SOURCE);
|
||||
strcpy(FLD.RDB$FIELD_NAME, RFR.RDB$FIELD_SOURCE);
|
||||
while ((verb = *(*ptr)++) != isc_dyn_end)
|
||||
@ -4483,8 +4455,8 @@ void DYN_define_trigger(Global* gbl,
|
||||
case isc_dyn_system_flag:
|
||||
X.RDB$SYSTEM_FLAG = DYN_get_number(ptr);
|
||||
X.RDB$SYSTEM_FLAG.NULL = FALSE;
|
||||
/* fb_assert(!ignore_perm || ignore_perm
|
||||
&& X.RDB$SYSTEM_FLAG == fb_sysflag_referential_constraint); */
|
||||
/* fb_assert(!ignore_perm || ignore_perm &&
|
||||
X.RDB$SYSTEM_FLAG == fb_sysflag_referential_constraint); */
|
||||
break;
|
||||
|
||||
case isc_dyn_debug_info:
|
||||
@ -4937,7 +4909,7 @@ bool is_it_user_name(Global* gbl, const Firebird::MetaName& role_name, thread_db
|
||||
(PRIV.RDB$GRANTOR EQ role_name.c_str() AND
|
||||
PRIV.RDB$OBJECT_TYPE = obj_relation)
|
||||
|
||||
found = true;
|
||||
found = true;
|
||||
|
||||
END_FOR;
|
||||
|
||||
@ -5011,7 +4983,7 @@ static rel_t get_relation_type(thread_db* tdbb, Global* gbl,
|
||||
}
|
||||
|
||||
|
||||
static void check_foreign_key_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
static void check_foreign_key_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
const TEXT* child_rel_name, const TEXT* master_index_name)
|
||||
{
|
||||
/**********************************************************
|
||||
@ -5021,7 +4993,7 @@ static void check_foreign_key_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
**********************************************************
|
||||
*
|
||||
* Functional description
|
||||
* Check temporary table reference rules between given child
|
||||
* Check temporary table reference rules between given child
|
||||
* relation and master relation (owner of given PK\UK index)
|
||||
*
|
||||
**********************************************************/
|
||||
@ -5034,8 +5006,8 @@ static void check_foreign_key_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
RLC_M IN RDB$RELATION_CONSTRAINTS CROSS
|
||||
REL_C IN RDB$RELATIONS CROSS
|
||||
REL_M IN RDB$RELATIONS
|
||||
WITH (RLC_M.RDB$CONSTRAINT_TYPE EQ UNIQUE_CNSTRT OR
|
||||
REL_M IN RDB$RELATIONS
|
||||
WITH (RLC_M.RDB$CONSTRAINT_TYPE EQ UNIQUE_CNSTRT OR
|
||||
RLC_M.RDB$CONSTRAINT_TYPE EQ PRIMARY_KEY)
|
||||
AND RLC_M.RDB$INDEX_NAME EQ master_index_name
|
||||
AND REL_C.RDB$RELATION_NAME EQ child_rel_name
|
||||
@ -5044,21 +5016,19 @@ static void check_foreign_key_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
if (!DYN_REQUEST(drq_l_rel_info))
|
||||
DYN_REQUEST(drq_l_rel_info) = request;
|
||||
|
||||
const rel_t master_type =
|
||||
get_relation_type(tdbb, gbl, REL_M.RDB$RELATION_NAME);
|
||||
const rel_t master_type = get_relation_type(tdbb, gbl, REL_M.RDB$RELATION_NAME);
|
||||
fb_assert(master_type == rel_persistent ||
|
||||
master_type == rel_global_temp_preserve ||
|
||||
master_type == rel_global_temp_delete);
|
||||
|
||||
const rel_t child_type =
|
||||
get_relation_type(tdbb, gbl, REL_C.RDB$RELATION_NAME);
|
||||
const rel_t child_type = get_relation_type(tdbb, gbl, REL_C.RDB$RELATION_NAME);
|
||||
fb_assert(child_type == rel_persistent ||
|
||||
child_type == rel_global_temp_preserve ||
|
||||
child_type == rel_global_temp_delete);
|
||||
|
||||
bErr = (master_type != child_type) &&
|
||||
!( (master_type == rel_global_temp_preserve) &&
|
||||
(child_type == rel_global_temp_delete) );
|
||||
!( (master_type == rel_global_temp_preserve) &&
|
||||
(child_type == rel_global_temp_delete) );
|
||||
|
||||
if (bErr)
|
||||
{
|
||||
@ -5080,7 +5050,7 @@ static void check_foreign_key_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
}
|
||||
|
||||
|
||||
static void check_relation_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
static void check_relation_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
const TEXT* child_rel_name, const rel_t child_type)
|
||||
{
|
||||
/****************************************************
|
||||
@ -5111,7 +5081,7 @@ static void check_relation_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
RLC_C IN RDB$RELATION_CONSTRAINTS CROSS
|
||||
IND_C IN RDB$INDICES CROSS
|
||||
IND_M IN RDB$INDICES CROSS
|
||||
REL_M IN RDB$RELATIONS
|
||||
REL_M IN RDB$RELATIONS
|
||||
WITH RLC_C.RDB$CONSTRAINT_TYPE EQ FOREIGN_KEY
|
||||
AND RLC_C.RDB$RELATION_NAME EQ child_rel_name
|
||||
AND IND_C.RDB$INDEX_NAME EQ RLC_C.RDB$INDEX_NAME
|
||||
@ -5121,14 +5091,13 @@ static void check_relation_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
if (!DYN_REQUEST(drq_l_rel_info2))
|
||||
DYN_REQUEST(drq_l_rel_info2) = request;
|
||||
|
||||
const rel_t master_type =
|
||||
get_relation_type(tdbb, gbl, REL_M.RDB$RELATION_NAME);
|
||||
const rel_t master_type = get_relation_type(tdbb, gbl, REL_M.RDB$RELATION_NAME);
|
||||
fb_assert(master_type == rel_persistent ||
|
||||
master_type == rel_global_temp_preserve ||
|
||||
master_type == rel_global_temp_delete);
|
||||
|
||||
bErr = (master_type != child_type) &&
|
||||
!( (master_type == rel_global_temp_preserve) &&
|
||||
!( (master_type == rel_global_temp_preserve) &&
|
||||
(child_type == rel_global_temp_delete) );
|
||||
|
||||
if (bErr)
|
||||
@ -5150,7 +5119,7 @@ static void check_relation_temp_scope(thread_db* tdbb, Global* gbl,
|
||||
}
|
||||
|
||||
|
||||
static void make_relation_scope_name(const TEXT* rel_name,
|
||||
static void make_relation_scope_name(const TEXT* rel_name,
|
||||
const rel_t rel_type, Firebird::string& str)
|
||||
{
|
||||
/**************************************************
|
||||
@ -5160,7 +5129,7 @@ static void make_relation_scope_name(const TEXT* rel_name,
|
||||
**************************************************
|
||||
*
|
||||
* Functional description
|
||||
* Make string with relation name and type
|
||||
* Make string with relation name and type
|
||||
* of its temporary scope
|
||||
*
|
||||
**************************************************/
|
||||
|
@ -68,7 +68,7 @@ DATABASE DB = STATIC "ODS.RDB";
|
||||
|
||||
static bool delete_constraint_records(Global*, const Firebird::MetaName&, const Firebird::MetaName&);
|
||||
static bool delete_dimension_records(Global*, const Firebird::MetaName&);
|
||||
static void delete_f_key_constraint(thread_db*, Global*,
|
||||
static void delete_f_key_constraint(thread_db*, Global*,
|
||||
const Firebird::MetaName&, const Firebird::MetaName&,
|
||||
const Firebird::MetaName&, const Firebird::MetaName&);
|
||||
static void delete_gfield_for_lfield(Global*, const Firebird::MetaName&);
|
||||
@ -93,10 +93,10 @@ void DYN_delete_collation(Global* gbl, const UCHAR** ptr)
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
jrd_req* request = NULL;
|
||||
|
||||
|
||||
bool found = false;
|
||||
Firebird::MetaName collName;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
GET_STRING(ptr, collName);
|
||||
@ -258,7 +258,7 @@ void DYN_delete_constraint (Global* gbl, const UCHAR** ptr, const Firebird::Meta
|
||||
|
||||
void DYN_delete_dimensions(Global* gbl,
|
||||
const UCHAR** ptr,
|
||||
const Firebird::MetaName* relation_name,
|
||||
const Firebird::MetaName* relation_name,
|
||||
Firebird::MetaName* field_name)
|
||||
{
|
||||
/**************************************
|
||||
@ -320,7 +320,7 @@ void DYN_delete_exception( Global* gbl, const UCHAR** ptr)
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
X IN RDB$EXCEPTIONS
|
||||
WITH X.RDB$EXCEPTION_NAME EQ t.c_str()
|
||||
if (!DYN_REQUEST(drq_e_xcp))
|
||||
if (!DYN_REQUEST(drq_e_xcp))
|
||||
DYN_REQUEST(drq_e_xcp) = request;
|
||||
|
||||
found = true;
|
||||
@ -370,7 +370,7 @@ void DYN_delete_filter( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
Firebird::MetaName f;
|
||||
GET_STRING(ptr, f);
|
||||
|
||||
|
||||
try {
|
||||
|
||||
found = false;
|
||||
@ -421,7 +421,7 @@ void DYN_delete_function( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_e_func_args, DYN_REQUESTS);
|
||||
USHORT id = drq_e_func_args;
|
||||
|
||||
|
||||
bool found = false;
|
||||
Firebird::MetaName f;
|
||||
GET_STRING(ptr, f);
|
||||
@ -443,7 +443,7 @@ void DYN_delete_function( Global* gbl, const UCHAR** ptr)
|
||||
found = false;
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
X IN RDB$FUNCTIONS WITH X.RDB$FUNCTION_NAME EQ f.c_str()
|
||||
if (!DYN_REQUEST(drq_e_funcs))
|
||||
if (!DYN_REQUEST(drq_e_funcs))
|
||||
DYN_REQUEST(drq_e_funcs) = request;
|
||||
|
||||
ERASE X;
|
||||
@ -497,11 +497,11 @@ void DYN_delete_generator(Global* gbl, const UCHAR**ptr)
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
jrd_req* request = NULL;
|
||||
|
||||
|
||||
bool found = false;
|
||||
Firebird::MetaName t;
|
||||
GET_STRING(ptr, t);
|
||||
|
||||
|
||||
try {
|
||||
request = CMP_find_request(tdbb, drq_e_gens, DYN_REQUESTS);
|
||||
|
||||
@ -554,7 +554,7 @@ void DYN_delete_global_field( Global* gbl, const UCHAR** ptr)
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_l_fld_src, DYN_REQUESTS);
|
||||
|
||||
|
||||
bool found = false;
|
||||
|
||||
try {
|
||||
@ -701,7 +701,7 @@ void DYN_delete_index( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
void DYN_delete_local_field(Global* gbl,
|
||||
const UCHAR** ptr,
|
||||
const Firebird::MetaName* relation_name,
|
||||
const Firebird::MetaName* relation_name,
|
||||
Firebird::MetaName* field_name)
|
||||
{
|
||||
/**************************************
|
||||
@ -715,13 +715,13 @@ void DYN_delete_local_field(Global* gbl,
|
||||
* statement.
|
||||
*
|
||||
* The rules for dropping a regular column:
|
||||
*
|
||||
*
|
||||
* 1. the column is not referenced in any views.
|
||||
* 2. the column is not part of any user defined indexes.
|
||||
* 3. the column is not used in any SQL statements inside of store
|
||||
* procedures or triggers
|
||||
* 4. the column is not part of any check-constraints
|
||||
*
|
||||
*
|
||||
* The rules for dropping a column that was created as primary key:
|
||||
*
|
||||
* 1. the column is not defined as any foreign keys
|
||||
@ -757,7 +757,7 @@ void DYN_delete_local_field(Global* gbl,
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_l_dep_flds, DYN_REQUESTS);
|
||||
USHORT id = drq_l_dep_flds;
|
||||
|
||||
|
||||
bool found;
|
||||
|
||||
try {
|
||||
@ -783,8 +783,7 @@ void DYN_delete_local_field(Global* gbl,
|
||||
DYN_REQUEST(drq_l_dep_flds) = request;
|
||||
|
||||
DYN_rundown_request(request, -1);
|
||||
DYN_error_punt(false, 52, SafeArg() << col_nm.c_str() << tbl_nm.c_str() <<
|
||||
Y.RDB$RELATION_NAME);
|
||||
DYN_error_punt(false, 52, SafeArg() << col_nm.c_str() << tbl_nm.c_str() << Y.RDB$RELATION_NAME);
|
||||
/* msg 52: "field %s from relation %s is referenced in view %s" */
|
||||
END_FOR;
|
||||
if (!DYN_REQUEST(drq_l_dep_flds))
|
||||
@ -821,8 +820,7 @@ void DYN_delete_local_field(Global* gbl,
|
||||
constraint = REL_CONST.RDB$CONSTRAINT_NAME;
|
||||
index_name = IDX.RDB$INDEX_NAME;
|
||||
|
||||
delete_f_key_constraint(tdbb, gbl, tbl_nm, col_nm,
|
||||
constraint, index_name);
|
||||
delete_f_key_constraint(tdbb, gbl, tbl_nm, col_nm, constraint, index_name);
|
||||
}
|
||||
else {
|
||||
DYN_rundown_request(request, -1);
|
||||
@ -842,7 +840,7 @@ void DYN_delete_local_field(Global* gbl,
|
||||
** == make sure that column is not referenced in any user-defined indexes
|
||||
** ==
|
||||
** == NOTE: You still could see the system generated indices even though
|
||||
** == they were already been deleted when dropping column that was
|
||||
** == they were already been deleted when dropping column that was
|
||||
** == used as foreign key before "commit".
|
||||
** ==
|
||||
** ================================================================
|
||||
@ -861,7 +859,7 @@ void DYN_delete_local_field(Global* gbl,
|
||||
REL_CONST IN RDB$RELATION_CONSTRAINTS
|
||||
WITH REL_CONST.RDB$RELATION_NAME EQ IDX.RDB$RELATION_NAME
|
||||
AND REL_CONST.RDB$INDEX_NAME EQ IDX.RDB$INDEX_NAME
|
||||
if (!DYN_REQUEST(drq_e_l_idx))
|
||||
if (!DYN_REQUEST(drq_e_l_idx))
|
||||
DYN_REQUEST(drq_e_l_idx) = request;
|
||||
|
||||
DYN_rundown_request(request, -1);
|
||||
@ -885,8 +883,8 @@ void DYN_delete_local_field(Global* gbl,
|
||||
|
||||
ERASE RFR;
|
||||
|
||||
if (!RFR.RDB$SECURITY_CLASS.NULL
|
||||
&& !strncmp(RFR.RDB$SECURITY_CLASS, SQL_SECCLASS_PREFIX, SQL_SECCLASS_PREFIX_LEN))
|
||||
if (!RFR.RDB$SECURITY_CLASS.NULL &&
|
||||
!strncmp(RFR.RDB$SECURITY_CLASS, SQL_SECCLASS_PREFIX, SQL_SECCLASS_PREFIX_LEN))
|
||||
{
|
||||
delete_security_class2(gbl, RFR.RDB$SECURITY_CLASS);
|
||||
}
|
||||
@ -911,7 +909,7 @@ void DYN_delete_local_field(Global* gbl,
|
||||
PRIV IN RDB$USER_PRIVILEGES WITH
|
||||
PRIV.RDB$RELATION_NAME EQ tbl_nm.c_str() AND
|
||||
PRIV.RDB$FIELD_NAME EQ col_nm.c_str() AND
|
||||
PRIV.RDB$OBJECT_TYPE = obj_relation
|
||||
PRIV.RDB$OBJECT_TYPE = obj_relation
|
||||
|
||||
if (!DYN_REQUEST(drq_e_fld_prvs))
|
||||
DYN_REQUEST(drq_e_fld_prvs) = request;
|
||||
@ -948,8 +946,8 @@ void DYN_delete_local_field(Global* gbl,
|
||||
}
|
||||
|
||||
|
||||
void DYN_delete_parameter(Global* gbl,
|
||||
const UCHAR** ptr,
|
||||
void DYN_delete_parameter(Global* gbl,
|
||||
const UCHAR** ptr,
|
||||
Firebird::MetaName* proc_name)
|
||||
{
|
||||
/**************************************
|
||||
@ -977,7 +975,7 @@ void DYN_delete_parameter(Global* gbl,
|
||||
USHORT id = drq_e_prms;
|
||||
|
||||
bool found = false;
|
||||
|
||||
|
||||
try {
|
||||
|
||||
jrd_req* old_request = NULL;
|
||||
@ -1100,9 +1098,9 @@ void DYN_delete_procedure( Global* gbl, const UCHAR** ptr)
|
||||
USHORT id = drq_e_prms;
|
||||
|
||||
try {
|
||||
|
||||
|
||||
jrd_req* old_request = NULL;
|
||||
|
||||
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
PP IN RDB$PROCEDURE_PARAMETERS WITH PP.RDB$PROCEDURE_NAME EQ name.c_str()
|
||||
|
||||
@ -1224,7 +1222,7 @@ void DYN_delete_procedure( Global* gbl, const UCHAR** ptr)
|
||||
catch (const Firebird::Exception& ex) {
|
||||
Firebird::stuff_exception(tdbb->tdbb_status_vector, ex);
|
||||
DYN_rundown_request(request, -1);
|
||||
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case drq_e_prms:
|
||||
@ -1285,7 +1283,7 @@ void DYN_delete_relation( Global* gbl, const UCHAR** ptr, const Firebird::MetaNa
|
||||
jrd_req* req2 = 0;
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_e_rel_con2, DYN_REQUESTS);
|
||||
USHORT id = drq_e_rel_con2;
|
||||
|
||||
|
||||
try {
|
||||
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
@ -1368,8 +1366,8 @@ void DYN_delete_relation( Global* gbl, const UCHAR** ptr, const Firebird::MetaNa
|
||||
|
||||
ERASE RFR;
|
||||
|
||||
if (!RFR.RDB$SECURITY_CLASS.NULL
|
||||
&& !strncmp(RFR.RDB$SECURITY_CLASS, SQL_SECCLASS_PREFIX, SQL_SECCLASS_PREFIX_LEN))
|
||||
if (!RFR.RDB$SECURITY_CLASS.NULL &&
|
||||
!strncmp(RFR.RDB$SECURITY_CLASS, SQL_SECCLASS_PREFIX, SQL_SECCLASS_PREFIX_LEN))
|
||||
{
|
||||
delete_security_class2(gbl, RFR.RDB$SECURITY_CLASS);
|
||||
}
|
||||
@ -1406,8 +1404,8 @@ void DYN_delete_relation( Global* gbl, const UCHAR** ptr, const Firebird::MetaNa
|
||||
|
||||
ERASE R;
|
||||
|
||||
if (!R.RDB$SECURITY_CLASS.NULL
|
||||
&& !strncmp(R.RDB$SECURITY_CLASS, SQL_SECCLASS_PREFIX, SQL_SECCLASS_PREFIX_LEN))
|
||||
if (!R.RDB$SECURITY_CLASS.NULL &&
|
||||
!strncmp(R.RDB$SECURITY_CLASS, SQL_SECCLASS_PREFIX, SQL_SECCLASS_PREFIX_LEN))
|
||||
{
|
||||
delete_security_class2(gbl, R.RDB$SECURITY_CLASS);
|
||||
}
|
||||
@ -1453,7 +1451,7 @@ void DYN_delete_relation( Global* gbl, const UCHAR** ptr, const Firebird::MetaNa
|
||||
|
||||
if (!DYN_REQUEST(drq_e_trg_prv))
|
||||
DYN_REQUEST(drq_e_trg_prv) = req2;
|
||||
|
||||
|
||||
id = drq_e_trigger2;
|
||||
|
||||
END_FOR;
|
||||
@ -1467,7 +1465,7 @@ void DYN_delete_relation( Global* gbl, const UCHAR** ptr, const Firebird::MetaNa
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
PRIV IN RDB$USER_PRIVILEGES WITH
|
||||
PRIV.RDB$RELATION_NAME EQ relation_name.c_str() AND
|
||||
PRIV.RDB$OBJECT_TYPE = obj_relation
|
||||
PRIV.RDB$OBJECT_TYPE = obj_relation
|
||||
|
||||
if (!DYN_REQUEST(drq_e_usr_prvs))
|
||||
DYN_REQUEST(drq_e_usr_prvs) = request;
|
||||
@ -1570,7 +1568,7 @@ void DYN_delete_role( Global* gbl, const UCHAR** ptr)
|
||||
*
|
||||
* Functional description
|
||||
*
|
||||
* Execute a dynamic ddl statement that deletes a role with all its
|
||||
* Execute a dynamic ddl statement that deletes a role with all its
|
||||
* members of the role.
|
||||
*
|
||||
**************************************/
|
||||
@ -1601,12 +1599,12 @@ void DYN_delete_role( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
request = CMP_find_request(tdbb, drq_drop_role, DYN_REQUESTS);
|
||||
id = drq_drop_role;
|
||||
|
||||
|
||||
bool del_role_ok = true;
|
||||
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
XX IN RDB$ROLES WITH
|
||||
XX.RDB$ROLE_NAME EQ role_name.c_str()
|
||||
XX.RDB$ROLE_NAME EQ role_name.c_str()
|
||||
|
||||
if (!DYN_REQUEST(drq_drop_role))
|
||||
DYN_REQUEST(drq_drop_role) = request;
|
||||
@ -1793,7 +1791,7 @@ void DYN_delete_trigger( Global* gbl, const UCHAR** ptr)
|
||||
try {
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
TM IN RDB$TRIGGER_MESSAGES
|
||||
CROSS TR IN RDB$TRIGGERS
|
||||
CROSS TR IN RDB$TRIGGERS
|
||||
WITH TM.RDB$TRIGGER_NAME EQ t.c_str() AND
|
||||
TR.RDB$TRIGGER_NAME EQ TM.RDB$TRIGGER_NAME
|
||||
|
||||
@ -1813,7 +1811,7 @@ void DYN_delete_trigger( Global* gbl, const UCHAR** ptr)
|
||||
id = drq_e_trigger;
|
||||
|
||||
Firebird::MetaName r;
|
||||
|
||||
|
||||
bool found = false;
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
X IN RDB$TRIGGERS WITH X.RDB$TRIGGER_NAME EQ t.c_str()
|
||||
@ -2053,7 +2051,7 @@ static bool delete_constraint_records(Global* gbl,
|
||||
}
|
||||
|
||||
|
||||
static bool delete_dimension_records(Global* gbl,
|
||||
static bool delete_dimension_records(Global* gbl,
|
||||
const Firebird::MetaName& field_name)
|
||||
{
|
||||
/**************************************
|
||||
@ -2071,7 +2069,7 @@ static bool delete_dimension_records(Global* gbl,
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_e_dims, DYN_REQUESTS);
|
||||
|
||||
|
||||
bool found = false;
|
||||
|
||||
try {
|
||||
@ -2118,25 +2116,25 @@ static void delete_f_key_constraint(thread_db* tdbb,
|
||||
* Functional description
|
||||
* Execute a dynamic ddl statement that
|
||||
* deletes a record from RDB$RELATION_CONSTRAINTS based on a constraint_nm
|
||||
*
|
||||
*
|
||||
* On deleting from RDB$RELATION_CONSTRAINTS, 2 system triggers fire:
|
||||
*
|
||||
*
|
||||
* (A) pre delete trigger: pre_delete_constraint, will:
|
||||
*
|
||||
*
|
||||
* 1. delete a record first from RDB$REF_CONSTRAINTS where
|
||||
* RDB$REF_CONSTRAINTS.RDB$CONSTRAINT_NAME =
|
||||
* RDB$REF_CONSTRAINTS.RDB$CONSTRAINT_NAME =
|
||||
* RDB$RELATION_CONSTRAINTS.RDB$CONSTRAINT_NAME
|
||||
*
|
||||
*
|
||||
* (B) post delete trigger: post_delete_constraint will:
|
||||
*
|
||||
*
|
||||
* 1. also delete a record from RDB$INDICES where
|
||||
* RDB$INDICES.RDB$INDEX_NAME =
|
||||
* RDB$RELATION_CONSTRAINTS.RDB$INDEX_NAME
|
||||
*
|
||||
*
|
||||
* 2. also delete a record from RDB$INDEX_SEGMENTS where
|
||||
* RDB$INDEX_SEGMENTS.RDB$INDEX_NAME =
|
||||
* RDB$RELATION_CONSTRAINTS.RDB$INDEX_NAME
|
||||
*
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
@ -2219,7 +2217,7 @@ static void delete_gfield_for_lfield( Global* gbl, const Firebird::MetaName& lfi
|
||||
}
|
||||
|
||||
|
||||
static bool delete_index_segment_records(Global* gbl,
|
||||
static bool delete_index_segment_records(Global* gbl,
|
||||
const Firebird::MetaName& index_name)
|
||||
{
|
||||
/**************************************
|
||||
@ -2237,7 +2235,7 @@ static bool delete_index_segment_records(Global* gbl,
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_e_idx_segs, DYN_REQUESTS);
|
||||
|
||||
|
||||
bool found = false;
|
||||
|
||||
try {
|
||||
|
@ -90,16 +90,13 @@ const int MAX_CHARS_FLOAT = 13; /* 7 digits + 2 signs + E + decimal + 2 digit ex
|
||||
static const UCHAR alloc_info[] = { isc_info_allocation, isc_info_end };
|
||||
static void change_backup_mode(Global*, UCHAR verb);
|
||||
|
||||
static void modify_lfield_position(thread_db*, Database*, Global*,
|
||||
const MetaName&, const MetaName&, USHORT, USHORT);
|
||||
static bool check_view_dependency(thread_db*, Database*, Global*,
|
||||
const MetaName&, const MetaName&);
|
||||
static bool check_sptrig_dependency(thread_db*, Database*, Global*,
|
||||
const MetaName&, const MetaName&);
|
||||
static void modify_lfield_index(thread_db*, Database*, Global*,
|
||||
const MetaName&, const MetaName&, const MetaName&);
|
||||
static bool field_exists(thread_db*, Database*, Global*,
|
||||
const MetaName&, const MetaName&);
|
||||
static void modify_lfield_position(thread_db*, Database*, Global*, const MetaName&, const MetaName&,
|
||||
USHORT, USHORT);
|
||||
static bool check_view_dependency(thread_db*, Database*, Global*, const MetaName&, const MetaName&);
|
||||
static bool check_sptrig_dependency(thread_db*, Database*, Global*, const MetaName&, const MetaName&);
|
||||
static void modify_lfield_index(thread_db*, Database*, Global*, const MetaName&, const MetaName&,
|
||||
const MetaName&);
|
||||
static bool field_exists(thread_db*, Database*, Global*, const MetaName&, const MetaName&);
|
||||
static bool domain_exists(thread_db*, Database*, Global*, const MetaName&);
|
||||
static void get_domain_type(thread_db*, Database*, Global*, dyn_fld&);
|
||||
static ULONG check_update_fld_type(const dyn_fld&, const dyn_fld&);
|
||||
@ -267,7 +264,7 @@ void DYN_modify_database( Global* gbl, const UCHAR** ptr)
|
||||
SLONG start = gds__vax_integer(s + 3, length);
|
||||
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
DBB IN RDB$DATABASE
|
||||
DBB IN RDB$DATABASE
|
||||
|
||||
if (!DYN_REQUEST(drq_m_database))
|
||||
DYN_REQUEST(drq_m_database) = request;
|
||||
@ -293,7 +290,7 @@ void DYN_modify_database( Global* gbl, const UCHAR** ptr)
|
||||
case isc_dyn_def_file:
|
||||
DYN_define_file(gbl, ptr, (SLONG) 0, &start, 84);
|
||||
break;
|
||||
|
||||
|
||||
case isc_dyn_def_difference:
|
||||
DYN_define_difference(gbl, ptr);
|
||||
break;
|
||||
@ -626,7 +623,7 @@ void DYN_modify_generator(Global* gbl, const UCHAR** ptr)
|
||||
|
||||
void DYN_modify_global_field(Global* gbl,
|
||||
const UCHAR** ptr,
|
||||
const MetaName* relation_name,
|
||||
const MetaName* relation_name,
|
||||
MetaName* field_name)
|
||||
{
|
||||
/**************************************
|
||||
@ -645,32 +642,27 @@ void DYN_modify_global_field(Global* gbl,
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_m_gfield, DYN_REQUESTS);
|
||||
bool found = false;
|
||||
|
||||
|
||||
dyn_fld orig_dom, new_dom;
|
||||
|
||||
try {
|
||||
|
||||
bool dtype, scale, prec, subtype, charlen, collation, fldlen, nullflg,
|
||||
charset;
|
||||
dtype = scale = prec = subtype = charlen = collation = fldlen = nullflg =
|
||||
charset = false;
|
||||
bool dtype, scale, prec, subtype, charlen, collation, fldlen, nullflg, charset;
|
||||
dtype = scale = prec = subtype = charlen = collation = fldlen = nullflg = charset = false;
|
||||
|
||||
bool bqryname, bqryhdr, bedtstr, bmissingval,
|
||||
bfldvald, bfldvaldsrc, bfielddesc,
|
||||
bool bqryname, bqryhdr, bedtstr, bmissingval, bfldvald, bfldvaldsrc, bfielddesc,
|
||||
bdelvald, bdeldflt, bflddftval, bflddfltsrc;
|
||||
bqryname = bqryhdr = bedtstr = bmissingval = false;
|
||||
bfldvald = bfldvaldsrc = bfielddesc = bdelvald =
|
||||
bdeldflt = bflddftval = bflddfltsrc = false;
|
||||
|
||||
bfldvald = bfldvaldsrc = bfielddesc = bdelvald = bdeldflt = bflddftval = bflddfltsrc = false;
|
||||
|
||||
const TEXT *qryname, *edtstr;
|
||||
const UCHAR *qryhdr, *missingval, *fldvald, *fldvaldsrc, *fielddesc,
|
||||
*flddftval, *flddfltsrc;
|
||||
const UCHAR *qryhdr, *missingval, *fldvald, *fldvaldsrc, *fielddesc, *flddftval, *flddfltsrc;
|
||||
|
||||
GET_STRING(ptr, orig_dom.dyn_fld_name);
|
||||
|
||||
found = false;
|
||||
int field_adjusted_count = 0;
|
||||
|
||||
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
FLD IN RDB$FIELDS WITH FLD.RDB$FIELD_NAME EQ orig_dom.dyn_fld_name.c_str()
|
||||
|
||||
@ -785,7 +777,7 @@ void DYN_modify_global_field(Global* gbl,
|
||||
// msg 148: "Only one data type change to the domain %s allowed at a time"
|
||||
}
|
||||
switch (new_dom.dyn_dtype) {
|
||||
|
||||
|
||||
case blr_text:
|
||||
case blr_text2:
|
||||
case blr_varying:
|
||||
@ -985,8 +977,7 @@ void DYN_modify_global_field(Global* gbl,
|
||||
|
||||
default:
|
||||
--(*ptr);
|
||||
DYN_execute(gbl, ptr, relation_name, field_name,
|
||||
NULL, NULL, NULL);
|
||||
DYN_execute(gbl, ptr, relation_name, field_name, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1001,7 +992,7 @@ void DYN_modify_global_field(Global* gbl,
|
||||
new_dom.dyn_dsc.dsc_scale,
|
||||
new_dom.dyn_dsc.dsc_length,
|
||||
new_dom.dyn_dsc.dsc_sub_type,
|
||||
new_dom.dyn_charset,
|
||||
new_dom.dyn_charset,
|
||||
new_dom.dyn_collation);
|
||||
const ULONG retval = check_update_fld_type(orig_dom, new_dom);
|
||||
if (retval != FB_SUCCESS)
|
||||
@ -1018,7 +1009,7 @@ void DYN_modify_global_field(Global* gbl,
|
||||
jrd_req* old_request = request;
|
||||
request = NULL;
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
DOM IN RDB$RELATION_FIELDS
|
||||
DOM IN RDB$RELATION_FIELDS
|
||||
WITH DOM.RDB$FIELD_SOURCE EQ orig_dom.dyn_fld_name.c_str()
|
||||
modify_lfield_index(tdbb, dbb, gbl,
|
||||
DOM.RDB$RELATION_NAME,
|
||||
@ -1280,12 +1271,10 @@ void DYN_modify_local_field(Global* gbl,
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
GET_STRING(ptr, f);
|
||||
|
||||
bool sfflag, qnflag, qhflag, esflag, dflag, system_flag, scflag, nnflag,
|
||||
ntflag, npflag;
|
||||
sfflag = qnflag = qhflag = esflag = dflag = scflag = npflag = nnflag =
|
||||
ntflag = false;
|
||||
|
||||
|
||||
bool sfflag, qnflag, qhflag, esflag, dflag, system_flag, scflag, nnflag, ntflag, npflag;
|
||||
sfflag = qnflag = qhflag = esflag = dflag = scflag = npflag = nnflag = ntflag = false;
|
||||
|
||||
UCHAR verb;
|
||||
while ((verb = *(*ptr)++) != isc_dyn_end)
|
||||
switch (verb) {
|
||||
@ -1358,7 +1347,7 @@ void DYN_modify_local_field(Global* gbl,
|
||||
found = false;
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
FLD IN RDB$RELATION_FIELDS
|
||||
WITH FLD.RDB$FIELD_NAME EQ f.c_str()
|
||||
WITH FLD.RDB$FIELD_NAME EQ f.c_str()
|
||||
AND FLD.RDB$RELATION_NAME EQ r.c_str()
|
||||
|
||||
if (!DYN_REQUEST(drq_m_lfield))
|
||||
@ -1394,8 +1383,7 @@ void DYN_modify_local_field(Global* gbl,
|
||||
check_sptrig_dependency(tdbb, dbb, gbl, r, f);
|
||||
if (!field_exists(tdbb, dbb, gbl, r, new_fld)) {
|
||||
strcpy(FLD.RDB$FIELD_NAME, new_fld.c_str());
|
||||
modify_lfield_index(tdbb, dbb, gbl, r, f,
|
||||
FLD.RDB$FIELD_NAME);
|
||||
modify_lfield_index(tdbb, dbb, gbl, r, f, FLD.RDB$FIELD_NAME);
|
||||
}
|
||||
else {
|
||||
DYN_error_punt(false, 205, SafeArg() << f.c_str() << new_fld.c_str() <<
|
||||
@ -1563,7 +1551,7 @@ void DYN_modify_procedure( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
if (!DYN_REQUEST(drq_m_prcs))
|
||||
DYN_REQUEST(drq_m_prcs) = request;
|
||||
|
||||
|
||||
found = true;
|
||||
|
||||
/* Set NULL flags to TRUE only for fields which must be specified in the DYN string.
|
||||
@ -1713,7 +1701,7 @@ void DYN_modify_relation( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
if (!REL.RDB$VIEW_BLR.NULL)
|
||||
DYN_error_punt(false, 177);
|
||||
|
||||
|
||||
found = true;
|
||||
MODIFY REL USING
|
||||
UCHAR verb;
|
||||
@ -1897,7 +1885,7 @@ void DYN_modify_trigger( Global* gbl, const UCHAR** ptr)
|
||||
}
|
||||
|
||||
found = true;
|
||||
|
||||
|
||||
MODIFY X
|
||||
|
||||
if (**ptr == isc_dyn_description)
|
||||
@ -2117,7 +2105,7 @@ void DYN_modify_view( Global* gbl, const UCHAR** ptr)
|
||||
DYN_error_punt(false, 212);
|
||||
/* msg 212: "Zero length identifiers not allowed" */
|
||||
}
|
||||
|
||||
|
||||
jrd_req* request = NULL;
|
||||
bool found = false;
|
||||
|
||||
@ -2136,7 +2124,7 @@ void DYN_modify_view( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
found = true;
|
||||
bool only_description = false;
|
||||
|
||||
|
||||
MODIFY REL
|
||||
|
||||
if (**ptr == isc_dyn_description)
|
||||
@ -2164,9 +2152,8 @@ void DYN_modify_view( Global* gbl, const UCHAR** ptr)
|
||||
FOR (REQUEST_HANDLE request2 TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
VR IN RDB$VIEW_RELATIONS
|
||||
WITH VR.RDB$VIEW_NAME EQ view_name.c_str()
|
||||
{
|
||||
|
||||
ERASE VR;
|
||||
}
|
||||
END_FOR;
|
||||
|
||||
CMP_release(tdbb, request2);
|
||||
@ -2199,7 +2186,7 @@ void DYN_modify_view( Global* gbl, const UCHAR** ptr)
|
||||
GET_STRING(ptr, REL.RDB$SECURITY_CLASS);
|
||||
REL.RDB$SECURITY_CLASS.NULL = FALSE;
|
||||
break;
|
||||
|
||||
|
||||
case isc_dyn_description:
|
||||
if (DYN_put_text_blob(gbl, ptr, &REL.RDB$DESCRIPTION))
|
||||
REL.RDB$DESCRIPTION.NULL = FALSE;
|
||||
@ -2303,20 +2290,20 @@ static void change_backup_mode( Global* gbl, UCHAR verb)
|
||||
if (!DYN_REQUEST(drq_d_difference)) {
|
||||
DYN_REQUEST(drq_d_difference) = request;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (const Exception& ex) {
|
||||
stuff_exception(tdbb->tdbb_status_vector, ex);
|
||||
DYN_rundown_request(request, drq_d_difference);
|
||||
DYN_rundown_request(request, drq_d_difference);
|
||||
DYN_error_punt(true, 63);
|
||||
/* msg 63: ERASE RDB$FILE failed */
|
||||
}
|
||||
|
||||
|
||||
if (!found && verb == isc_dyn_begin_backup) {
|
||||
try {
|
||||
request = CMP_find_request(tdbb, drq_s_difference, DYN_REQUESTS);
|
||||
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
X IN RDB$FILES
|
||||
X IN RDB$FILES
|
||||
X.RDB$FILE_NAME.NULL = TRUE;
|
||||
X.RDB$FILE_FLAGS.NULL = FALSE;
|
||||
X.RDB$FILE_FLAGS = FILE_difference | FILE_backing_up;
|
||||
@ -2325,13 +2312,13 @@ static void change_backup_mode( Global* gbl, UCHAR verb)
|
||||
X.RDB$FILE_LENGTH.NULL = TRUE;
|
||||
X.RDB$SHADOW_NUMBER.NULL = TRUE;
|
||||
END_STORE;
|
||||
|
||||
|
||||
found = true;
|
||||
|
||||
if (!DYN_REQUEST(drq_s_difference))
|
||||
{
|
||||
DYN_REQUEST(drq_s_difference) = request;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const Exception& ex) {
|
||||
stuff_exception(tdbb->tdbb_status_vector, ex);
|
||||
@ -2340,7 +2327,7 @@ static void change_backup_mode( Global* gbl, UCHAR verb)
|
||||
/* msg 150: STORE RDB$FILES failed */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (invalid_state) {
|
||||
DYN_error_punt(false, verb == isc_dyn_begin_backup ? 217 : 218);
|
||||
/* msg 217: "Database is already in the physical backup mode" */
|
||||
@ -2370,20 +2357,20 @@ static void modify_lfield_position(thread_db* tdbb,
|
||||
***********************************************************
|
||||
*
|
||||
* Functional Description:
|
||||
* Alters the position of a field with respect to the
|
||||
* Alters the position of a field with respect to the
|
||||
* other fields in the relation. This will only affect
|
||||
* the order in which the fields will be returned when either
|
||||
* viewing the relation or performing select * from the relation.
|
||||
*
|
||||
* The rules of engagement are as follows:
|
||||
* if new_position > original position
|
||||
* increase RDB$FIELD_POSITION for all fields with RDB$FIELD_POSITION
|
||||
* increase RDB$FIELD_POSITION for all fields with RDB$FIELD_POSITION
|
||||
* between the new_position and existing position of the field
|
||||
* then update the position of the field being altered.
|
||||
* just update the position
|
||||
*
|
||||
* if new_position < original position
|
||||
* decrease RDB$FIELD_POSITION for all fields with RDB$FIELD_POSITION
|
||||
* decrease RDB$FIELD_POSITION for all fields with RDB$FIELD_POSITION
|
||||
* between the new_position and existing position of the field
|
||||
* then update the position of the field being altered.
|
||||
*
|
||||
@ -2412,7 +2399,7 @@ static void modify_lfield_position(thread_db* tdbb,
|
||||
*/
|
||||
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
FLD IN RDB$RELATION_FIELDS
|
||||
FLD IN RDB$RELATION_FIELDS
|
||||
WITH FLD.RDB$RELATION_NAME EQ relation_name.c_str() AND
|
||||
FLD.RDB$FIELD_POSITION >= MIN(new_position, existing_position) AND
|
||||
FLD.RDB$FIELD_POSITION <= MAX(new_position, existing_position)
|
||||
@ -2500,7 +2487,7 @@ static bool check_view_dependency(thread_db* tdbb,
|
||||
X.RDB$FIELD_SOURCE EQ Y.RDB$FIELD_SOURCE AND
|
||||
Y.RDB$RELATION_NAME EQ Z.RDB$VIEW_NAME AND
|
||||
X.RDB$RELATION_NAME EQ Z.RDB$RELATION_NAME AND
|
||||
Y.RDB$VIEW_CONTEXT EQ Z.RDB$VIEW_CONTEXT
|
||||
Y.RDB$VIEW_CONTEXT EQ Z.RDB$VIEW_CONTEXT
|
||||
retval = true;
|
||||
view_name = Z.RDB$VIEW_NAME;
|
||||
END_FOR;
|
||||
@ -2508,7 +2495,7 @@ static bool check_view_dependency(thread_db* tdbb,
|
||||
CMP_release(tdbb, request);
|
||||
|
||||
if (retval)
|
||||
DYN_error_punt(false, 206, SafeArg() << field_name.c_str() <<
|
||||
DYN_error_punt(false, 206, SafeArg() << field_name.c_str() <<
|
||||
relation_name.c_str() << view_name.c_str());
|
||||
/* msg 206: Column %s from table %s is referenced in %s. */
|
||||
|
||||
@ -2540,7 +2527,7 @@ static bool check_sptrig_dependency(thread_db* tdbb,
|
||||
FIRST 1
|
||||
DEP IN RDB$DEPENDENCIES WITH
|
||||
DEP.RDB$DEPENDED_ON_NAME EQ relation_name.c_str() AND
|
||||
DEP.RDB$FIELD_NAME EQ field_name.c_str()
|
||||
DEP.RDB$FIELD_NAME EQ field_name.c_str()
|
||||
retval = true;
|
||||
dep_name = DEP.RDB$DEPENDENT_NAME;
|
||||
END_FOR;
|
||||
@ -2626,9 +2613,9 @@ static bool field_exists(thread_db* tdbb,
|
||||
}
|
||||
|
||||
|
||||
static bool domain_exists(thread_db* tdbb,
|
||||
Database* dbb,
|
||||
Global* gbl,
|
||||
static bool domain_exists(thread_db* tdbb,
|
||||
Database* dbb,
|
||||
Global* gbl,
|
||||
const MetaName& field_name)
|
||||
{
|
||||
/***********************************************************
|
||||
@ -2663,11 +2650,11 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Execute a dynamic ddl statement
|
||||
* Execute a dynamic ddl statement
|
||||
* to modify the datatype of a field.
|
||||
*
|
||||
* If there are dependencies on the field, abort the operation
|
||||
* unless the dependency is an index. In this case, rebuild the
|
||||
* unless the dependency is an index. In this case, rebuild the
|
||||
* index once the operation has completed.
|
||||
*
|
||||
* If the original datatype of the field was a domain:
|
||||
@ -2701,7 +2688,7 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
**************************************/
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
|
||||
dyn_fld orig_fld, new_fld, dom_fld;
|
||||
|
||||
try {
|
||||
@ -2720,10 +2707,8 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
jrd_req* request = NULL;
|
||||
jrd_req* first_request = NULL;
|
||||
bool found = false;
|
||||
bool dtype, scale, prec, subtype, charlen, collation, fldlen, nullflg,
|
||||
charset;
|
||||
dtype = scale = prec = subtype = charlen = collation = fldlen = nullflg =
|
||||
charset = false;
|
||||
bool dtype, scale, prec, subtype, charlen, collation, fldlen, nullflg, charset;
|
||||
dtype = scale = prec = subtype = charlen = collation = fldlen = nullflg = charset = false;
|
||||
|
||||
int field_adjusted_count = 0;
|
||||
|
||||
@ -2777,7 +2762,7 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
orig_fld.dyn_dtype = blr_blob;
|
||||
has_dimensions = true;
|
||||
}
|
||||
|
||||
|
||||
domain_has_default = !FLD.RDB$DEFAULT_VALUE.NULL;
|
||||
domain_is_computed = !FLD.RDB$COMPUTED_BLR.NULL;
|
||||
|
||||
@ -2820,7 +2805,7 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
new_fld.dyn_charbytelen = new_fld.dyn_dsc.dsc_length;
|
||||
break;
|
||||
default:
|
||||
new_fld.dyn_charbytelen = 0; // It won't be used, anyway.
|
||||
new_fld.dyn_charbytelen = 0; // It won't be used, anyway.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -2997,11 +2982,10 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
|
||||
if (!is_view &&
|
||||
((new_fld.dyn_computed_val && !orig_computed) ||
|
||||
(!new_fld.dyn_computed_val && orig_computed)))
|
||||
(!new_fld.dyn_computed_val && orig_computed)))
|
||||
{
|
||||
// Cannot add or remove COMPUTED from column @1
|
||||
DYN_error_punt(false, 249,
|
||||
SafeArg() << orig_fld.dyn_fld_name.c_str());
|
||||
DYN_error_punt(false, 249, SafeArg() << orig_fld.dyn_fld_name.c_str());
|
||||
}
|
||||
|
||||
const bool sourceIsInternalDomain =
|
||||
@ -3015,7 +2999,7 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
{
|
||||
// a1. Internal domain -> domain.
|
||||
// a2. Domain -> domain.
|
||||
|
||||
|
||||
/* CVC: Since get_domain_type() called above already called DSC_make_descriptor,
|
||||
there's no point in calling it again, since it will increment AGAIN the length
|
||||
of varchar fields! This bug detected thanks to new check field dyn_charbytelen.
|
||||
@ -3041,6 +3025,7 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
FLD IN RDB$FIELDS
|
||||
WITH FLD.RDB$FIELD_NAME = RFR.RDB$FIELD_SOURCE
|
||||
|
||||
ERASE FLD;
|
||||
END_FOR;
|
||||
|
||||
@ -3132,7 +3117,7 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
request = NULL;
|
||||
|
||||
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
FLD IN RDB$FIELDS
|
||||
FLD IN RDB$FIELDS
|
||||
FLD.RDB$SYSTEM_FLAG = 0;
|
||||
FLD.RDB$SYSTEM_FLAG.NULL = FALSE;
|
||||
FLD.RDB$FIELD_SCALE.NULL = TRUE;
|
||||
@ -3370,7 +3355,7 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
END_MODIFY;
|
||||
first_request = request;
|
||||
}
|
||||
|
||||
|
||||
request = NULL;
|
||||
}
|
||||
} // else not a domain
|
||||
@ -3403,8 +3388,7 @@ void DYN_modify_sql_field(Global* gbl,
|
||||
}
|
||||
|
||||
// Update any indices that exist
|
||||
modify_lfield_index(tdbb, dbb, gbl, *relation_name, orig_fld.dyn_fld_name,
|
||||
orig_fld.dyn_fld_name);
|
||||
modify_lfield_index(tdbb, dbb, gbl, *relation_name, orig_fld.dyn_fld_name, orig_fld.dyn_fld_name);
|
||||
|
||||
}
|
||||
catch (const Exception& ex) {
|
||||
@ -3484,7 +3468,7 @@ void get_domain_type(thread_db* tdbb, Database* dbb, Global* gbl, dyn_fld& dom_f
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* g e t _ d o m a i n _ t y p e
|
||||
* g e t _ d o m a i n _ t y p e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
@ -3513,7 +3497,7 @@ void get_domain_type(thread_db* tdbb, Database* dbb, Global* gbl, dyn_fld& dom_f
|
||||
dom_fld.dyn_charlen = FLD.RDB$CHARACTER_LENGTH;
|
||||
dom_fld.dyn_collation = FLD.RDB$COLLATION_ID;
|
||||
dom_fld.dyn_null_flag = FLD.RDB$NULL_FLAG != 0;
|
||||
|
||||
|
||||
if (!FLD.RDB$DIMENSIONS.NULL && FLD.RDB$DIMENSIONS > 0)
|
||||
dom_fld.dyn_dtype = blr_blob;
|
||||
|
||||
@ -3576,7 +3560,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld,
|
||||
/* Cannot convert column %s from character to non-character data. */
|
||||
break;
|
||||
|
||||
/* If the original field is a character field and the new field is a character field,
|
||||
/* If the original field is a character field and the new field is a character field,
|
||||
* is there enough space in the new field? */
|
||||
case blr_text:
|
||||
case blr_varying:
|
||||
@ -3590,8 +3574,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld,
|
||||
|
||||
/* We can have this assertion since this case is for both string fields. */
|
||||
const ULONG new_len = DSC_string_length(&new_fld.dyn_dsc);
|
||||
fb_assert(new_len - maxflen ==
|
||||
new_fld.dyn_charbytelen - orig_fld.dyn_charbytelen);
|
||||
fb_assert(new_len - maxflen == new_fld.dyn_charbytelen - orig_fld.dyn_charbytelen);
|
||||
// if (new_fld.dyn_dsc.dsc_length < maxflen)
|
||||
if (new_len < maxflen)
|
||||
return isc_dyn_char_fld_too_small;
|
||||
@ -3635,7 +3618,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld,
|
||||
/* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */
|
||||
break;
|
||||
|
||||
/* If the original field is a date field and the new field is a character field,
|
||||
/* If the original field is a date field and the new field is a character field,
|
||||
* is there enough space in the new field? */
|
||||
case blr_text:
|
||||
case blr_text2:
|
||||
@ -3688,7 +3671,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld,
|
||||
switch (orig_fld.dyn_dtype) {
|
||||
case blr_short:
|
||||
return check_update_numeric_type(orig_fld, new_fld);
|
||||
|
||||
|
||||
default:
|
||||
return isc_dyn_invalid_dtype_conversion;
|
||||
/* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */
|
||||
@ -3700,7 +3683,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld,
|
||||
case blr_long:
|
||||
case blr_short:
|
||||
return check_update_numeric_type(orig_fld, new_fld);
|
||||
|
||||
|
||||
default:
|
||||
return isc_dyn_invalid_dtype_conversion;
|
||||
/* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */
|
||||
@ -3748,7 +3731,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld,
|
||||
}
|
||||
break;
|
||||
|
||||
/* If the original field is a numeric field and the new field is a character field,
|
||||
/* If the original field is a numeric field and the new field is a character field,
|
||||
* is there enough space in the new field? */
|
||||
case blr_text:
|
||||
case blr_varying:
|
||||
@ -3778,8 +3761,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld,
|
||||
}
|
||||
|
||||
|
||||
static ULONG check_update_numeric_type(const dyn_fld& orig_fld,
|
||||
const dyn_fld& new_fld)
|
||||
static ULONG check_update_numeric_type(const dyn_fld& orig_fld, const dyn_fld& new_fld)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -3802,7 +3784,7 @@ static ULONG check_update_numeric_type(const dyn_fld& orig_fld,
|
||||
// the width of the integral part.
|
||||
if (orig_fld.dyn_dsc.dsc_sub_type && new_fld.dyn_dsc.dsc_sub_type &&
|
||||
orig_fld.dyn_precision + orig_fld.dyn_dsc.dsc_scale >
|
||||
new_fld.dyn_precision + new_fld.dyn_dsc.dsc_scale)
|
||||
new_fld.dyn_precision + new_fld.dyn_dsc.dsc_scale)
|
||||
{
|
||||
return isc_dyn_scale_too_big;
|
||||
}
|
||||
@ -3824,8 +3806,8 @@ static void modify_err_punt(thread_db* tdbb,
|
||||
* Functional description
|
||||
* A generic error routine that calls DYN_error_punt
|
||||
* based on the error code returned by check_update_field_type.
|
||||
*
|
||||
* This function is called by DYN_modify_global_field and by
|
||||
*
|
||||
* This function is called by DYN_modify_global_field and by
|
||||
* DYN_modify_sql_field
|
||||
**************************************/
|
||||
|
||||
@ -3848,7 +3830,7 @@ static void modify_err_punt(thread_db* tdbb,
|
||||
DSC_string_length(&orig_fld_def.dyn_dsc));
|
||||
// msg 208: New size specified for column %s must be at least %d characters.
|
||||
break;
|
||||
|
||||
|
||||
case isc_dyn_scale_too_big:
|
||||
{
|
||||
int code = errorcode;
|
||||
@ -3862,8 +3844,7 @@ static void modify_err_punt(thread_db* tdbb,
|
||||
code = isc_dyn_precision_too_small;
|
||||
diff = new_fld_def.dyn_precision - new_fld_def.dyn_dsc.dsc_scale - diff;
|
||||
}
|
||||
DYN_error_punt(false, code,
|
||||
SafeArg() << orig_fld_def.dyn_fld_name.c_str() << diff);
|
||||
DYN_error_punt(false, code, SafeArg() << orig_fld_def.dyn_fld_name.c_str() << diff);
|
||||
// scale_too_big: New scale specified for column @1 must be at most @2.
|
||||
// precision_too_small: New precision specified for column @1 must be at least @2.
|
||||
}
|
||||
@ -3873,10 +3854,8 @@ static void modify_err_punt(thread_db* tdbb,
|
||||
{
|
||||
TEXT orig_type[25], new_type[25];
|
||||
|
||||
DSC_get_dtype_name(&orig_fld_def.dyn_dsc, orig_type,
|
||||
sizeof(orig_type));
|
||||
DSC_get_dtype_name(&new_fld_def.dyn_dsc, new_type,
|
||||
sizeof(new_type));
|
||||
DSC_get_dtype_name(&orig_fld_def.dyn_dsc, orig_type, sizeof(orig_type));
|
||||
DSC_get_dtype_name(&new_fld_def.dyn_dsc, new_type, sizeof(new_type));
|
||||
|
||||
DYN_error_punt(false, errorcode,
|
||||
SafeArg() << orig_fld_def.dyn_fld_name.c_str() <<
|
||||
|
@ -27,8 +27,9 @@
|
||||
|
||||
void DYN_UTIL_store_check_constraints(Jrd::thread_db*, Jrd::Global*,
|
||||
const Firebird::MetaName&, const Firebird::MetaName&);
|
||||
bool DYN_UTIL_find_field_source(Jrd::thread_db* tdbb, Jrd::Global* gbl, const Firebird::MetaName& view_name,
|
||||
USHORT context, const TEXT* local_name, TEXT* output_field_name);
|
||||
bool DYN_UTIL_find_field_source(Jrd::thread_db* tdbb, Jrd::Global* gbl,
|
||||
const Firebird::MetaName& view_name, USHORT context, const TEXT* local_name,
|
||||
TEXT* output_field_name);
|
||||
bool DYN_UTIL_get_prot(Jrd::thread_db*, Jrd::Global*, const SCHAR*,
|
||||
const SCHAR*, Jrd::SecurityClass::flags_t*);
|
||||
void DYN_UTIL_generate_trigger_name(Jrd::thread_db*, Jrd::Global*, Firebird::MetaName&);
|
||||
|
@ -61,7 +61,8 @@ using namespace Jrd;
|
||||
|
||||
DATABASE DB = STATIC "ODS.RDB";
|
||||
|
||||
static const SCHAR gen_id_blr1[] = {
|
||||
static const SCHAR gen_id_blr1[] =
|
||||
{
|
||||
blr_version5,
|
||||
blr_begin,
|
||||
blr_message, 0, 1, 0,
|
||||
@ -73,12 +74,14 @@ static const SCHAR gen_id_blr1[] = {
|
||||
blr_gen_id
|
||||
};
|
||||
|
||||
static const SCHAR gen_id_blr2[] = {
|
||||
static const SCHAR gen_id_blr2[] =
|
||||
{
|
||||
blr_literal, blr_long, 0, 1, 0, 0, 0,
|
||||
blr_parameter, 0, 0, 0, blr_end, blr_end, blr_end, blr_eoc
|
||||
};
|
||||
|
||||
static const UCHAR prot_blr[] = {
|
||||
static const UCHAR prot_blr[] =
|
||||
{
|
||||
blr_version5,
|
||||
blr_begin,
|
||||
blr_message, 1, 1, 0,
|
||||
@ -186,13 +189,10 @@ void DYN_UTIL_generate_constraint_name( thread_db* tdbb, Global* gbl, Firebird::
|
||||
try {
|
||||
|
||||
bool found = false;
|
||||
|
||||
|
||||
do {
|
||||
buffer.printf("INTEG_%" SQUADFORMAT,
|
||||
(SINT64) DYN_UTIL_gen_unique_id(tdbb,
|
||||
gbl,
|
||||
drq_g_nxt_con,
|
||||
"RDB$CONSTRAINT_NAME"));
|
||||
(SINT64) DYN_UTIL_gen_unique_id(tdbb, gbl, drq_g_nxt_con, "RDB$CONSTRAINT_NAME"));
|
||||
|
||||
request = CMP_find_request(tdbb, drq_f_nxt_con, DYN_REQUESTS);
|
||||
id = drq_f_nxt_con;
|
||||
@ -257,17 +257,14 @@ void DYN_UTIL_generate_field_name( thread_db* tdbb, Global* gbl, Firebird::MetaN
|
||||
|
||||
jrd_req* request = NULL;
|
||||
SSHORT id = -1;
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
bool found = false;
|
||||
|
||||
do {
|
||||
buffer.printf("RDB$%" SQUADFORMAT,
|
||||
(SINT64) DYN_UTIL_gen_unique_id(tdbb,
|
||||
gbl,
|
||||
drq_g_nxt_fld,
|
||||
"RDB$FIELD_NAME"));
|
||||
(SINT64) DYN_UTIL_gen_unique_id(tdbb, gbl, drq_g_nxt_fld, "RDB$FIELD_NAME"));
|
||||
|
||||
request = CMP_find_request(tdbb, drq_f_nxt_fld, DYN_REQUESTS);
|
||||
id = drq_f_nxt_fld;
|
||||
@ -296,8 +293,7 @@ void DYN_UTIL_generate_field_name( thread_db* tdbb, Global* gbl, Firebird::MetaN
|
||||
}
|
||||
|
||||
|
||||
void DYN_UTIL_generate_field_position(
|
||||
thread_db* tdbb,
|
||||
void DYN_UTIL_generate_field_position(thread_db* tdbb,
|
||||
Global* gbl,
|
||||
const Firebird::MetaName& relation_name,
|
||||
SLONG* field_pos)
|
||||
@ -348,7 +344,7 @@ void DYN_UTIL_generate_field_position(
|
||||
}
|
||||
|
||||
|
||||
void DYN_UTIL_generate_index_name(thread_db* tdbb, Global* gbl,
|
||||
void DYN_UTIL_generate_index_name(thread_db* tdbb, Global* gbl,
|
||||
Firebird::MetaName& buffer, UCHAR verb)
|
||||
{
|
||||
/**************************************
|
||||
@ -381,10 +377,7 @@ void DYN_UTIL_generate_index_name(thread_db* tdbb, Global* gbl,
|
||||
format = "RDB$%" SQUADFORMAT;
|
||||
|
||||
buffer.printf(format,
|
||||
(SINT64) DYN_UTIL_gen_unique_id(tdbb,
|
||||
gbl,
|
||||
drq_g_nxt_idx,
|
||||
"RDB$INDEX_NAME"));
|
||||
(SINT64) DYN_UTIL_gen_unique_id(tdbb, gbl, drq_g_nxt_idx, "RDB$INDEX_NAME"));
|
||||
|
||||
request = CMP_find_request(tdbb, drq_f_nxt_idx, DYN_REQUESTS);
|
||||
id = drq_f_nxt_idx;
|
||||
@ -431,15 +424,12 @@ void DYN_UTIL_generate_trigger_name( thread_db* tdbb, Global* gbl, Firebird::Met
|
||||
SSHORT id = -1;
|
||||
|
||||
try {
|
||||
|
||||
|
||||
bool found = false;
|
||||
|
||||
do {
|
||||
buffer.printf("CHECK_%" SQUADFORMAT,
|
||||
(SINT64) DYN_UTIL_gen_unique_id(tdbb,
|
||||
gbl,
|
||||
drq_g_nxt_trg,
|
||||
"RDB$TRIGGER_NAME"));
|
||||
(SINT64) DYN_UTIL_gen_unique_id(tdbb, gbl, drq_g_nxt_trg, "RDB$TRIGGER_NAME"));
|
||||
|
||||
request = CMP_find_request(tdbb, drq_f_nxt_trg, DYN_REQUESTS);
|
||||
id = drq_f_nxt_trg;
|
||||
@ -666,24 +656,24 @@ bool DYN_UTIL_is_array(thread_db* tdbb,
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_dom_is_array, DYN_REQUESTS);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
bool rc;
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ domain_name.c_str()
|
||||
|
||||
|
||||
if (!DYN_REQUEST(drq_dom_is_array))
|
||||
DYN_REQUEST(drq_dom_is_array) = request;
|
||||
|
||||
|
||||
rc = !X.RDB$DIMENSIONS.NULL && X.RDB$DIMENSIONS > 0;
|
||||
END_FOR
|
||||
|
||||
|
||||
if (!DYN_REQUEST(drq_dom_is_array))
|
||||
DYN_REQUEST(drq_dom_is_array) = request;
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
catch (const Firebird::Exception& ex)
|
||||
@ -710,9 +700,9 @@ bool DYN_UTIL_is_array(thread_db* tdbb,
|
||||
//
|
||||
//***************************************
|
||||
void DYN_UTIL_copy_domain(thread_db* tdbb,
|
||||
Global* gbl,
|
||||
const Firebird::MetaName& org_name,
|
||||
const Firebird::MetaName& new_name)
|
||||
Global* gbl,
|
||||
const Firebird::MetaName& org_name,
|
||||
const Firebird::MetaName& new_name)
|
||||
{
|
||||
SET_TDBB(tdbb);
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
@ -730,107 +720,107 @@ void DYN_UTIL_copy_domain(thread_db* tdbb,
|
||||
|
||||
if (!X.RDB$DIMENSIONS.NULL && X.RDB$DIMENSIONS > 0)
|
||||
ERR_punt();
|
||||
|
||||
|
||||
STORE(REQUEST_HANDLE req2 TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
X2 IN RDB$FIELDS
|
||||
|
||||
|
||||
X2.RDB$FIELD_NAME.NULL = FALSE;
|
||||
strcpy(X2.RDB$FIELD_NAME, new_name.c_str());
|
||||
|
||||
|
||||
X2.RDB$QUERY_NAME.NULL = X.RDB$QUERY_NAME.NULL;
|
||||
if (!X.RDB$QUERY_NAME.NULL)
|
||||
strcpy(X2.RDB$QUERY_NAME, X.RDB$QUERY_NAME);
|
||||
|
||||
|
||||
// The following fields may require blob copying:
|
||||
// rdb$validation_blr, rdb$validation_source,
|
||||
// rdb$computed_blr, rdb$computed_source,
|
||||
// rdb$default_value, rdb$default_source,
|
||||
// rdb$missing_value, rdb$missing_source,
|
||||
// rdb$description and rdb$query_header.
|
||||
|
||||
|
||||
X2.RDB$VALIDATION_BLR.NULL = X.RDB$VALIDATION_BLR.NULL;
|
||||
X2.RDB$VALIDATION_BLR = X.RDB$VALIDATION_BLR;
|
||||
|
||||
|
||||
X2.RDB$VALIDATION_SOURCE.NULL = X.RDB$VALIDATION_SOURCE.NULL;
|
||||
X2.RDB$VALIDATION_SOURCE = X.RDB$VALIDATION_SOURCE;
|
||||
|
||||
|
||||
X2.RDB$COMPUTED_BLR.NULL = X.RDB$COMPUTED_BLR.NULL;
|
||||
X2.RDB$COMPUTED_BLR = X.RDB$COMPUTED_BLR;
|
||||
|
||||
|
||||
X2.RDB$COMPUTED_SOURCE.NULL = X.RDB$COMPUTED_SOURCE.NULL;
|
||||
X2.RDB$COMPUTED_SOURCE = X.RDB$COMPUTED_SOURCE;
|
||||
|
||||
|
||||
//X2.RDB$DEFAULT_VALUE.NULL = X.RDB$DEFAULT_VALUE.NULL;
|
||||
//X2.RDB$DEFAULT_VALUE = X.RDB$DEFAULT_VALUE;
|
||||
|
||||
|
||||
//X2.RDB$DEFAULT_SOURCE.NULL = X.RDB$DEFAULT_SOURCE.NULL;
|
||||
//X2.RDB$DEFAULT_SOURCE = X.RDB$DEFAULT_SOURCE;
|
||||
|
||||
|
||||
X2.RDB$FIELD_LENGTH.NULL = X.RDB$FIELD_LENGTH.NULL;
|
||||
X2.RDB$FIELD_LENGTH = X.RDB$FIELD_LENGTH;
|
||||
|
||||
|
||||
X2.RDB$FIELD_SCALE.NULL = X.RDB$FIELD_SCALE.NULL;
|
||||
X2.RDB$FIELD_SCALE = X.RDB$FIELD_SCALE;
|
||||
|
||||
|
||||
X2.RDB$FIELD_TYPE.NULL = X.RDB$FIELD_TYPE.NULL;
|
||||
X2.RDB$FIELD_TYPE = X.RDB$FIELD_TYPE;
|
||||
|
||||
|
||||
X2.RDB$FIELD_SUB_TYPE.NULL = X.RDB$FIELD_SUB_TYPE.NULL;
|
||||
X2.RDB$FIELD_SUB_TYPE = X.RDB$FIELD_SUB_TYPE;
|
||||
|
||||
|
||||
X2.RDB$MISSING_VALUE.NULL = X.RDB$MISSING_VALUE.NULL;
|
||||
X2.RDB$MISSING_VALUE = X.RDB$MISSING_VALUE;
|
||||
|
||||
|
||||
X2.RDB$MISSING_SOURCE.NULL = X.RDB$MISSING_SOURCE.NULL;
|
||||
X2.RDB$MISSING_SOURCE = X.RDB$MISSING_SOURCE;
|
||||
|
||||
|
||||
X2.RDB$DESCRIPTION.NULL = X.RDB$DESCRIPTION.NULL;
|
||||
X2.RDB$DESCRIPTION = X.RDB$DESCRIPTION;
|
||||
|
||||
|
||||
X2.RDB$SYSTEM_FLAG.NULL = X.RDB$SYSTEM_FLAG.NULL;
|
||||
X2.RDB$SYSTEM_FLAG = X.RDB$SYSTEM_FLAG;
|
||||
|
||||
|
||||
X2.RDB$QUERY_HEADER.NULL = X.RDB$QUERY_HEADER.NULL;
|
||||
X2.RDB$QUERY_HEADER = X.RDB$QUERY_HEADER;
|
||||
|
||||
|
||||
X2.RDB$SEGMENT_LENGTH.NULL = X.RDB$SEGMENT_LENGTH.NULL;
|
||||
X2.RDB$SEGMENT_LENGTH = X.RDB$SEGMENT_LENGTH;
|
||||
|
||||
|
||||
X2.RDB$EDIT_STRING.NULL = X.RDB$EDIT_STRING.NULL;
|
||||
if (!X.RDB$EDIT_STRING.NULL)
|
||||
strcpy(X2.RDB$EDIT_STRING, X.RDB$EDIT_STRING);
|
||||
|
||||
|
||||
X2.RDB$EXTERNAL_LENGTH.NULL = X.RDB$EXTERNAL_LENGTH.NULL;
|
||||
X2.RDB$EXTERNAL_LENGTH = X.RDB$EXTERNAL_LENGTH;
|
||||
|
||||
|
||||
X2.RDB$EXTERNAL_SCALE.NULL = X.RDB$EXTERNAL_SCALE.NULL;
|
||||
X2.RDB$EXTERNAL_SCALE = X.RDB$EXTERNAL_SCALE;
|
||||
|
||||
|
||||
X2.RDB$EXTERNAL_TYPE.NULL = X.RDB$EXTERNAL_TYPE.NULL;
|
||||
X2.RDB$EXTERNAL_TYPE = X.RDB$EXTERNAL_TYPE;
|
||||
|
||||
|
||||
X2.RDB$DIMENSIONS.NULL = X.RDB$DIMENSIONS.NULL;
|
||||
X2.RDB$DIMENSIONS = X.RDB$DIMENSIONS;
|
||||
|
||||
|
||||
X2.RDB$NULL_FLAG.NULL = X.RDB$NULL_FLAG.NULL;
|
||||
X2.RDB$NULL_FLAG = X.RDB$NULL_FLAG;
|
||||
|
||||
|
||||
X2.RDB$CHARACTER_LENGTH.NULL = X.RDB$CHARACTER_LENGTH.NULL;
|
||||
X2.RDB$CHARACTER_LENGTH = X.RDB$CHARACTER_LENGTH;
|
||||
|
||||
|
||||
X2.RDB$COLLATION_ID.NULL = X.RDB$COLLATION_ID.NULL;
|
||||
X2.RDB$COLLATION_ID = X.RDB$COLLATION_ID;
|
||||
|
||||
|
||||
X2.RDB$CHARACTER_SET_ID.NULL = X.RDB$CHARACTER_SET_ID.NULL;
|
||||
X2.RDB$CHARACTER_SET_ID = X.RDB$CHARACTER_SET_ID;
|
||||
|
||||
|
||||
X2.RDB$FIELD_PRECISION.NULL = X.RDB$FIELD_PRECISION.NULL;
|
||||
X2.RDB$FIELD_PRECISION = X.RDB$FIELD_PRECISION;
|
||||
END_STORE
|
||||
CMP_release(tdbb, req2);
|
||||
req2 = NULL;
|
||||
END_FOR
|
||||
|
||||
|
||||
CMP_release(tdbb, request);
|
||||
request = NULL;
|
||||
// For now, CMP_release used instead of this:
|
||||
|
@ -274,10 +274,8 @@ EVH EVENT_init(ISC_STATUS* status_vector)
|
||||
gds__prefix_lock(buffer, EVENT_FILE);
|
||||
const TEXT* event_file = buffer;
|
||||
|
||||
if (!(EVENT_header = (EVH) ISC_map_file(status_vector,
|
||||
event_file,
|
||||
init, 0, Config::getEventMemSize(),
|
||||
&EVENT_data)))
|
||||
if (!(EVENT_header = (EVH) ISC_map_file(status_vector, event_file, init, 0,
|
||||
Config::getEventMemSize(), &EVENT_data)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -315,8 +313,7 @@ int EVENT_post(ISC_STATUS * status_vector,
|
||||
|
||||
EVNT event;
|
||||
EVNT parent = find_event(major_length, major_code, 0);
|
||||
if (parent &&
|
||||
(event = find_event(minor_length, minor_code, parent)))
|
||||
if (parent && (event = find_event(minor_length, minor_code, parent)))
|
||||
{
|
||||
event->evnt_count += count;
|
||||
srq* event_srq;
|
||||
@ -401,8 +398,7 @@ SLONG EVENT_que(ISC_STATUS* status_vector,
|
||||
const USHORT len = find_end - p + 1;
|
||||
EVNT event = find_event(len, reinterpret_cast<const char*>(p), parent);
|
||||
if (!event) {
|
||||
event =
|
||||
make_event(len, reinterpret_cast<const char*>(p), parent_offset);
|
||||
event = make_event(len, reinterpret_cast<const char*>(p), parent_offset);
|
||||
parent = (EVNT) SRQ_ABS_PTR(parent_offset);
|
||||
session = (SES) SRQ_ABS_PTR(session_id);
|
||||
request = (EVT_REQ) SRQ_ABS_PTR(request_offset);
|
||||
@ -424,8 +420,7 @@ SLONG EVENT_que(ISC_STATUS* status_vector,
|
||||
}
|
||||
}
|
||||
else {
|
||||
interest =
|
||||
(RINT) alloc_global(type_rint, (SLONG) sizeof(req_int), false);
|
||||
interest = (RINT) alloc_global(type_rint, (SLONG) sizeof(req_int), false);
|
||||
event = (EVNT) SRQ_ABS_PTR(event_offset);
|
||||
insert_tail(&event->evnt_interests, &interest->rint_interests);
|
||||
interest->rint_event = event_offset;
|
||||
@ -544,7 +539,7 @@ static FRB alloc_global(UCHAR type, ULONG length, bool recurse)
|
||||
SRQ_PTR* best = NULL;
|
||||
|
||||
for (ptr = &EVENT_header->evh_free; (free = (FRB) SRQ_ABS_PTR(*ptr)) && *ptr;
|
||||
ptr = &free->frb_next)
|
||||
ptr = &free->frb_next)
|
||||
{
|
||||
const SLONG tail = free->frb_header.hdr_length - length;
|
||||
if (tail >= 0 && (!best || tail < best_tail)) {
|
||||
@ -583,17 +578,14 @@ static FRB alloc_global(UCHAR type, ULONG length, bool recurse)
|
||||
EVH header = 0;
|
||||
#if !((defined SUPERSERVER) && (defined HAVE_MMAP))
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
header =
|
||||
reinterpret_cast<EVH>
|
||||
(ISC_remap_file(status_vector, &EVENT_data, ev_length, true));
|
||||
header = reinterpret_cast<EVH>(ISC_remap_file(status_vector, &EVENT_data, ev_length, true));
|
||||
#endif
|
||||
if (header) {
|
||||
free = (FRB) ((UCHAR *) header + old_length);
|
||||
/**
|
||||
free->frb_header.hdr_length = EVENT_EXTEND_SIZE - sizeof (struct evh);
|
||||
**/
|
||||
free->frb_header.hdr_length =
|
||||
EVENT_data.sh_mem_length_mapped - old_length;
|
||||
free->frb_header.hdr_length = EVENT_data.sh_mem_length_mapped - old_length;
|
||||
free->frb_header.hdr_type = type_frb;
|
||||
free->frb_next = 0;
|
||||
|
||||
@ -627,8 +619,7 @@ static FRB alloc_global(UCHAR type, ULONG length, bool recurse)
|
||||
free->frb_header.hdr_length = length;
|
||||
}
|
||||
|
||||
memset((UCHAR*) free + sizeof(event_hdr), 0,
|
||||
free->frb_header.hdr_length - sizeof(event_hdr));
|
||||
memset((UCHAR*) free + sizeof(event_hdr), 0, free->frb_header.hdr_length - sizeof(event_hdr));
|
||||
free->frb_header.hdr_type = type;
|
||||
|
||||
return free;
|
||||
@ -660,9 +651,7 @@ static SLONG create_process(void)
|
||||
|
||||
#ifdef SOLARIS_MT
|
||||
ISC_STATUS_ARRAY local_status;
|
||||
EVENT_process = (PRB) ISC_map_object(local_status, &EVENT_data,
|
||||
EVENT_process_offset,
|
||||
sizeof(prb));
|
||||
EVENT_process = (PRB) ISC_map_object(local_status, &EVENT_data, EVENT_process_offset, sizeof(prb));
|
||||
#endif
|
||||
|
||||
process->prb_process_id = getpid();
|
||||
@ -718,9 +707,7 @@ static void delete_process(SLONG process_offset)
|
||||
/* Delete any open sessions */
|
||||
|
||||
while (!SRQ_EMPTY(process->prb_sessions)) {
|
||||
SES session =
|
||||
(SES) ((UCHAR *) SRQ_NEXT(process->prb_sessions) -
|
||||
OFFSET(SES, ses_sessions));
|
||||
SES session = (SES) ((UCHAR *) SRQ_NEXT(process->prb_sessions) - OFFSET(SES, ses_sessions));
|
||||
delete_session(SRQ_REL_PTR(session));
|
||||
}
|
||||
|
||||
@ -821,8 +808,7 @@ static void delete_session(SLONG session_id)
|
||||
|
||||
while (!SRQ_EMPTY(session->ses_requests)) {
|
||||
srq requests = session->ses_requests;
|
||||
EVT_REQ request =
|
||||
(EVT_REQ) ((UCHAR *) SRQ_NEXT(requests) - OFFSET(EVT_REQ, req_requests));
|
||||
EVT_REQ request = (EVT_REQ) ((UCHAR *) SRQ_NEXT(requests) - OFFSET(EVT_REQ, req_requests));
|
||||
delete_request(request);
|
||||
}
|
||||
|
||||
@ -1017,8 +1003,7 @@ static EVNT find_event(USHORT length, const TEXT* string, EVNT parent)
|
||||
srq* event_srq;
|
||||
SRQ_LOOP(EVENT_header->evh_events, event_srq) {
|
||||
EVNT event = (EVNT) ((UCHAR *) event_srq - OFFSET(EVNT, evnt_events));
|
||||
if (event->evnt_parent == parent_offset &&
|
||||
event->evnt_length == length &&
|
||||
if (event->evnt_parent == parent_offset && event->evnt_length == length &&
|
||||
!memcmp(string, event->evnt_name, length))
|
||||
{
|
||||
return event;
|
||||
@ -1056,8 +1041,7 @@ static void free_global(FRB block)
|
||||
}
|
||||
|
||||
if (offset <= 0 || offset > EVENT_header->evh_length ||
|
||||
(prior
|
||||
&& (UCHAR*) block < (UCHAR*) prior + prior->frb_header.hdr_length))
|
||||
(prior && (UCHAR*) block < (UCHAR*) prior + prior->frb_header.hdr_length))
|
||||
{
|
||||
punt("free_global: bad block");
|
||||
return;
|
||||
@ -1148,8 +1132,7 @@ static void init(void* arg, SH_MEM shmem_data, bool initialize)
|
||||
#endif
|
||||
|
||||
FRB free = (FRB) ((UCHAR*) EVENT_header + sizeof(evh));
|
||||
free->frb_header.hdr_length =
|
||||
EVENT_data.sh_mem_length_mapped - sizeof(evh);
|
||||
free->frb_header.hdr_length = EVENT_data.sh_mem_length_mapped - sizeof(evh);
|
||||
free->frb_header.hdr_type = type_frb;
|
||||
free->frb_next = 0;
|
||||
|
||||
@ -1190,8 +1173,7 @@ static EVNT make_event(USHORT length, const TEXT* string, SLONG parent_offset)
|
||||
* Allocate an link in an event.
|
||||
*
|
||||
**************************************/
|
||||
EVNT event =
|
||||
(EVNT) alloc_global(type_evnt, (SLONG) (sizeof(evnt) + length), false);
|
||||
EVNT event = (EVNT) alloc_global(type_evnt, (SLONG) (sizeof(evnt) + length), false);
|
||||
insert_tail(&EVENT_header->evh_events, &event->evnt_events);
|
||||
SRQ_INIT(event->evnt_interests);
|
||||
|
||||
@ -1406,8 +1388,8 @@ static int validate(void)
|
||||
offset += block->frb_header.hdr_length)
|
||||
{
|
||||
const event_hdr* block = (event_hdr*) SRQ_ABS_PTR(offset);
|
||||
if (!block->frb_header.hdr_length || !block->frb_header.hdr_type
|
||||
|| block->frb_header.hdr_type >= type_max)
|
||||
if (!block->frb_header.hdr_length || !block->frb_header.hdr_type ||
|
||||
block->frb_header.hdr_type >= type_max)
|
||||
{
|
||||
punt("bad block length or type");
|
||||
break;
|
||||
|
@ -2615,10 +2615,8 @@ static dsc* add_timestamp(const dsc* desc, const jrd_nod* node, impure_value* va
|
||||
because nod_date is set in the nod_flags we know we're supposed
|
||||
to use some form of date arithmetic */
|
||||
|
||||
if (((node->nod_type == nod_subtract)
|
||||
|| (node->nod_type == nod_subtract2))
|
||||
&& ((desc->dsc_dtype == dtype_timestamp)
|
||||
|| DTYPE_IS_TEXT(desc->dsc_dtype)))
|
||||
if (((node->nod_type == nod_subtract) || (node->nod_type == nod_subtract2)) &&
|
||||
((desc->dsc_dtype == dtype_timestamp) || DTYPE_IS_TEXT(desc->dsc_dtype)))
|
||||
{
|
||||
|
||||
/* Handle cases of
|
||||
@ -2701,8 +2699,8 @@ static dsc* add_timestamp(const dsc* desc, const jrd_nod* node, impure_value* va
|
||||
// Coerce operand1 to a count of microseconds
|
||||
|
||||
bool op1_is_timestamp = false;
|
||||
if ((value->vlu_desc.dsc_dtype == dtype_timestamp)
|
||||
|| (DTYPE_IS_TEXT(value->vlu_desc.dsc_dtype)))
|
||||
if ((value->vlu_desc.dsc_dtype == dtype_timestamp) ||
|
||||
(DTYPE_IS_TEXT(value->vlu_desc.dsc_dtype)))
|
||||
{
|
||||
op1_is_timestamp = true;
|
||||
}
|
||||
@ -2710,8 +2708,7 @@ static dsc* add_timestamp(const dsc* desc, const jrd_nod* node, impure_value* va
|
||||
// Coerce operand2 to a count of microseconds
|
||||
|
||||
bool op2_is_timestamp = false;
|
||||
if ((desc->dsc_dtype == dtype_timestamp)
|
||||
|| (DTYPE_IS_TEXT(desc->dsc_dtype)))
|
||||
if ((desc->dsc_dtype == dtype_timestamp) || (DTYPE_IS_TEXT(desc->dsc_dtype)))
|
||||
{
|
||||
op2_is_timestamp = true;
|
||||
}
|
||||
|
@ -3050,8 +3050,7 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
|
||||
|
||||
VIO_modify(tdbb, org_rpb, new_rpb, transaction);
|
||||
const IDX_E error_code =
|
||||
IDX_modify(tdbb, org_rpb, new_rpb, transaction,
|
||||
&bad_relation, &bad_index);
|
||||
IDX_modify(tdbb, org_rpb, new_rpb, transaction, &bad_relation, &bad_index);
|
||||
|
||||
if (error_code) {
|
||||
ERR_duplicate_error(error_code, bad_relation, bad_index);
|
||||
@ -3062,8 +3061,7 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
|
||||
new_rpb->rpb_number.setValid(true);
|
||||
|
||||
jrd_req* trigger;
|
||||
if (relation->rel_post_modify &&
|
||||
which_trig != PRE_TRIG &&
|
||||
if (relation->rel_post_modify && which_trig != PRE_TRIG &&
|
||||
(trigger = execute_triggers(tdbb, &relation->rel_post_modify,
|
||||
org_rpb, new_rpb, jrd_req::req_trigger_update, POST_TRIG)))
|
||||
{
|
||||
@ -3074,9 +3072,7 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
|
||||
have fired. This is required for cascading referential integrity,
|
||||
which can be implemented as post_erase triggers */
|
||||
|
||||
if (!relation->rel_file &&
|
||||
!relation->rel_view_rse &&
|
||||
!relation->isVirtual())
|
||||
if (!relation->rel_file && !relation->rel_view_rse && !relation->isVirtual())
|
||||
{
|
||||
USHORT bad_index;
|
||||
jrd_rel* bad_relation = 0;
|
||||
@ -3174,9 +3170,7 @@ static jrd_nod* modify(thread_db* tdbb, jrd_nod* node, SSHORT which_trig)
|
||||
*/
|
||||
CLEAR_NULL(new_record, i);
|
||||
if (EVL_field(new_rpb->rpb_relation, new_record, i, &new_desc)) {
|
||||
if (EVL_field
|
||||
(org_rpb->rpb_relation, org_record, i,
|
||||
&org_desc))
|
||||
if (EVL_field(org_rpb->rpb_relation, org_record, i, &org_desc))
|
||||
{
|
||||
MOV_move(tdbb, &org_desc, &new_desc);
|
||||
}
|
||||
@ -3362,8 +3356,7 @@ static jrd_nod* seek_rse(thread_db* tdbb, jrd_req* request, jrd_nod* node)
|
||||
MOV_get_long(desc, 0) : MAX_USHORT;
|
||||
|
||||
desc = EVL_expr(tdbb, node->nod_arg[e_seek_offset]);
|
||||
const SLONG offset = (desc && !(request->req_flags & req_null)) ?
|
||||
MOV_get_long(desc, 0) : 0;
|
||||
const SLONG offset = (desc && !(request->req_flags & req_null)) ? MOV_get_long(desc, 0) : 0;
|
||||
|
||||
RecordSelExpr* rse = (RecordSelExpr*) node->nod_arg[e_seek_rse];
|
||||
|
||||
@ -3405,8 +3398,7 @@ static void seek_rsb(
|
||||
|
||||
/* set the backwards flag */
|
||||
|
||||
const irsb* next_impure =
|
||||
(IRSB) ((UCHAR *) request + rsb->rsb_next->rsb_impure);
|
||||
const irsb* next_impure = (IRSB) ((UCHAR *) request + rsb->rsb_next->rsb_impure);
|
||||
|
||||
if (next_impure->irsb_flags & irsb_last_backwards)
|
||||
impure->irsb_flags |= irsb_last_backwards;
|
||||
|
@ -554,8 +554,7 @@ ISC_STATUS filter_text(USHORT action, BlobControl* control)
|
||||
/* if control buffer cannot accommodate what needs to be saved, free
|
||||
the control buffer */
|
||||
|
||||
if (control->ctl_data[1]
|
||||
&& (control->ctl_data[0] > control->ctl_data[3]))
|
||||
if (control->ctl_data[1] && (control->ctl_data[0] > control->ctl_data[3]))
|
||||
{
|
||||
gds__free((void*) control->ctl_data[1]);
|
||||
control->ctl_data[1] = 0;
|
||||
@ -565,8 +564,7 @@ ISC_STATUS filter_text(USHORT action, BlobControl* control)
|
||||
/* if there is no control buffer allocate one */
|
||||
|
||||
if (!control->ctl_data[1]) {
|
||||
control->ctl_data[1] =
|
||||
(IPTR) gds__alloc((SLONG) control->ctl_buffer_length);
|
||||
control->ctl_data[1] = (IPTR) gds__alloc((SLONG) control->ctl_buffer_length);
|
||||
/* FREE: above & isc_blob_filter_close in this procedure */
|
||||
if (!control->ctl_data[1]) /* NOMEM: */
|
||||
return isc_virmemexh;
|
||||
|
@ -1055,10 +1055,10 @@ static void invoke(thread_db* tdbb,
|
||||
if (function->fun_return_arg)
|
||||
{
|
||||
CALL_UDF<void>(dbb, function->fun_entrypoint, args);
|
||||
result_is_null = return_ptr->fun_mechanism == FUN_descriptor
|
||||
&& (value->vlu_desc.dsc_flags & DSC_null)
|
||||
|| return_ptr->fun_mechanism == FUN_blob_struct && return_blob_struct &&
|
||||
!return_blob_struct->blob_handle;
|
||||
result_is_null = return_ptr->fun_mechanism == FUN_descriptor &&
|
||||
(value->vlu_desc.dsc_flags & DSC_null) ||
|
||||
return_ptr->fun_mechanism == FUN_blob_struct && return_blob_struct &&
|
||||
!return_blob_struct->blob_handle;
|
||||
}
|
||||
else if (return_ptr->fun_mechanism == FUN_value)
|
||||
{
|
||||
|
@ -131,8 +131,7 @@ FPTR_INT FUNCTIONS_entrypoint(const char* module, const char* entrypoint)
|
||||
*p = 0;
|
||||
|
||||
for (const FN* function = isc_functions; function->fn_module; ++function) {
|
||||
if (!strcmp(temp, function->fn_module)
|
||||
&& !strcmp(ep, function->fn_entrypoint))
|
||||
if (!strcmp(temp, function->fn_module) && !strcmp(ep, function->fn_entrypoint))
|
||||
{
|
||||
return function->fn_function;
|
||||
}
|
||||
|
@ -2489,8 +2489,7 @@ BOOLEAN API_ROUTINE gds__validate_lib_path(const TEXT* module,
|
||||
TEXT* p = path + strlen(path);
|
||||
if ((p != path) && ((p[-1] == '/') || (p[-1] == '\\')))
|
||||
p[-1] = 0;
|
||||
if ((EXPAND_PATH(path, abs_path))
|
||||
&& (!COMPARE_PATH(abs_path, abs_module_path)))
|
||||
if ((EXPAND_PATH(path, abs_path)) && (!COMPARE_PATH(abs_path, abs_module_path)))
|
||||
{
|
||||
strncpy(resolved_module, abs_module, length);
|
||||
resolved_module[length - 1] = 0;
|
||||
|
@ -64,7 +64,7 @@ const SecurityClass::flags_t VIEW_PRIVS = SCL_read | SCL_write | SCL_delete;
|
||||
const ULONG ACL_BUFFER_SIZE = 4096;
|
||||
static const char* DEFAULT_CLASS = "SQL$DEFAULT";
|
||||
|
||||
inline void CHECK_AND_MOVE(Acl& to, UCHAR from)
|
||||
inline void CHECK_AND_MOVE(Acl& to, UCHAR from)
|
||||
{
|
||||
to.add(from);
|
||||
}
|
||||
@ -87,8 +87,7 @@ static void grant_views(TEXT**, SecurityClass::flags_t);
|
||||
static void purge_default_class(TEXT*, SSHORT);
|
||||
#endif
|
||||
static SecurityClass::flags_t save_field_privileges(thread_db*, Acl&,
|
||||
const TEXT*, const Firebird::MetaName&,
|
||||
SecurityClass::flags_t);
|
||||
const TEXT*, const Firebird::MetaName&, SecurityClass::flags_t);
|
||||
static void save_security_class(thread_db*, const Firebird::MetaName&, const Acl&);
|
||||
static SecurityClass::flags_t trans_sql_priv(const TEXT*);
|
||||
static SecurityClass::flags_t squeeze_acl(Acl&, const Firebird::MetaName&, SSHORT);
|
||||
@ -106,8 +105,8 @@ bool GRANT_privileges(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
*
|
||||
* Functional description
|
||||
* Compute access control list from SQL privileges.
|
||||
* This calculation is tricky and involves interaction between
|
||||
* the relation-level and field-level privileges. Do not change
|
||||
* This calculation is tricky and involves interaction between
|
||||
* the relation-level and field-level privileges. Do not change
|
||||
* the order of operations lightly.
|
||||
*
|
||||
**************************************/
|
||||
@ -227,8 +226,7 @@ static void define_default_class(thread_db* tdbb,
|
||||
|
||||
if (default_class.length() == 0) {
|
||||
default_class.printf("%s%" SQUADFORMAT, DEFAULT_CLASS,
|
||||
DPM_gen_id(tdbb, MET_lookup_generator(tdbb, DEFAULT_CLASS), false,
|
||||
(SINT64) 1));
|
||||
DPM_gen_id(tdbb, MET_lookup_generator(tdbb, DEFAULT_CLASS), false, 1));
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, irq_grant7, IRQ_REQUESTS);
|
||||
|
||||
@ -284,7 +282,7 @@ static void delete_security_class( thread_db* tdbb, const TEXT* s_class)
|
||||
|
||||
FOR(REQUEST_HANDLE handle)
|
||||
CLS IN RDB$SECURITY_CLASSES
|
||||
WITH CLS.RDB$SECURITY_CLASS EQ s_class
|
||||
WITH CLS.RDB$SECURITY_CLASS EQ s_class
|
||||
ERASE CLS;
|
||||
END_FOR;
|
||||
|
||||
@ -343,7 +341,7 @@ static SecurityClass::flags_t get_public_privs(
|
||||
PRV.RDB$OBJECT_TYPE EQ obj_type AND
|
||||
PRV.RDB$USER EQ "PUBLIC" AND
|
||||
PRV.RDB$USER_TYPE EQ obj_user AND
|
||||
PRV.RDB$FIELD_NAME MISSING
|
||||
PRV.RDB$FIELD_NAME MISSING
|
||||
if (!REQUEST(irq_grant5))
|
||||
REQUEST(irq_grant5) = request;
|
||||
public_priv |= trans_sql_priv(PRV.RDB$PRIVILEGE);
|
||||
@ -360,8 +358,8 @@ static void get_object_info(thread_db* tdbb,
|
||||
const TEXT* object_name,
|
||||
SSHORT obj_type,
|
||||
Firebird::MetaName& owner,
|
||||
Firebird::MetaName& s_class,
|
||||
Firebird::MetaName& default_class,
|
||||
Firebird::MetaName& s_class,
|
||||
Firebird::MetaName& default_class,
|
||||
bool& view)
|
||||
{
|
||||
/**************************************
|
||||
@ -387,11 +385,11 @@ static void get_object_info(thread_db* tdbb,
|
||||
|
||||
FOR(REQUEST_HANDLE request)
|
||||
REL IN RDB$RELATIONS WITH
|
||||
REL.RDB$RELATION_NAME EQ object_name
|
||||
REL.RDB$RELATION_NAME EQ object_name
|
||||
|
||||
if (!REQUEST(irq_grant1))
|
||||
REQUEST(irq_grant1) = request;
|
||||
|
||||
|
||||
s_class = REL.RDB$SECURITY_CLASS;
|
||||
default_class = REL.RDB$DEFAULT_CLASS;
|
||||
owner = REL.RDB$OWNER_NAME;
|
||||
@ -575,7 +573,7 @@ static void purge_default_class( TEXT* object_name, SSHORT obj_type)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Get rid of any previously defined
|
||||
* Get rid of any previously defined
|
||||
* default security class for this relation.
|
||||
*
|
||||
**************************************/
|
||||
@ -587,11 +585,11 @@ static void purge_default_class( TEXT* object_name, SSHORT obj_type)
|
||||
FOR(REQUEST_HANDLE request)
|
||||
REL IN RDB$RELATIONS
|
||||
WITH REL.RDB$RELATION_NAME EQ object_name
|
||||
AND REL.RDB$DEFAULT_CLASS NOT MISSING
|
||||
AND REL.RDB$DEFAULT_CLASS NOT MISSING
|
||||
|
||||
if (!REQUEST(irq_grant8))
|
||||
REQUEST(irq_grant8) = request;
|
||||
|
||||
|
||||
fb_utils::exact_name_limit(REL.RDB$DEFAULT_CLASS, sizeof(REL.RDB$DEFAULT_CLASS));
|
||||
delete_security_class(tdbb, REL.RDB$DEFAULT_CLASS);
|
||||
|
||||
@ -631,7 +629,7 @@ static SecurityClass::flags_t save_field_privileges(thread_db* tdbb,
|
||||
* Functional description
|
||||
* Compute the privileges for all fields within a relation.
|
||||
* All fields must be given the initial relation-level privileges.
|
||||
* Conversely, field-level privileges must be added to the relation
|
||||
* Conversely, field-level privileges must be added to the relation
|
||||
* security class to be effective.
|
||||
*
|
||||
**************************************/
|
||||
@ -658,7 +656,7 @@ static SecurityClass::flags_t save_field_privileges(thread_db* tdbb,
|
||||
PRV.RDB$RELATION_NAME EQ relation_name AND
|
||||
PRV.RDB$FIELD_NAME NOT MISSING AND
|
||||
(PRV.RDB$USER NE owner.c_str() OR PRV.RDB$USER_TYPE NE obj_user)
|
||||
SORTED BY PRV.RDB$FIELD_NAME, PRV.RDB$USER
|
||||
SORTED BY PRV.RDB$FIELD_NAME, PRV.RDB$USER
|
||||
|
||||
if (!REQUEST(irq_grant6))
|
||||
REQUEST(irq_grant6) = request;
|
||||
@ -726,12 +724,12 @@ static SecurityClass::flags_t save_field_privileges(thread_db* tdbb,
|
||||
while (!unique)
|
||||
{
|
||||
sprintf(RFR.RDB$SECURITY_CLASS, "%s%" SQUADFORMAT, "SQL$GRANT",
|
||||
DPM_gen_id(tdbb, MET_lookup_generator(tdbb, "RDB$SECURITY_CLASS"),
|
||||
false, (SINT64) 1));
|
||||
DPM_gen_id(tdbb, MET_lookup_generator(tdbb, "RDB$SECURITY_CLASS"),
|
||||
false, 1));
|
||||
|
||||
unique = true;
|
||||
FOR (REQUEST_HANDLE request3)
|
||||
RFR2 IN RDB$RELATION_FIELDS
|
||||
RFR2 IN RDB$RELATION_FIELDS
|
||||
WITH RFR2.RDB$SECURITY_CLASS = RFR.RDB$SECURITY_CLASS
|
||||
unique = false;
|
||||
END_FOR;
|
||||
@ -788,7 +786,7 @@ static SecurityClass::flags_t save_field_privileges(thread_db* tdbb,
|
||||
aggregate_public |= field_public;
|
||||
finish_security_class(field_acl, (field_public | public_priv));
|
||||
save_security_class(tdbb, s_class, field_acl);
|
||||
|
||||
|
||||
dsc desc;
|
||||
desc.dsc_dtype = dtype_text;
|
||||
desc.dsc_sub_type = 0;
|
||||
@ -855,8 +853,7 @@ static void save_security_class(thread_db* tdbb,
|
||||
|
||||
STORE(REQUEST_HANDLE request)
|
||||
CLS IN RDB$SECURITY_CLASSES
|
||||
jrd_vtof(s_class.c_str(), CLS.RDB$SECURITY_CLASS,
|
||||
sizeof(CLS.RDB$SECURITY_CLASS));
|
||||
jrd_vtof(s_class.c_str(), CLS.RDB$SECURITY_CLASS, sizeof(CLS.RDB$SECURITY_CLASS));
|
||||
CLS.RDB$ACL = blob_id;
|
||||
END_STORE;
|
||||
|
||||
@ -929,13 +926,13 @@ static SecurityClass::flags_t squeeze_acl(Acl& acl,
|
||||
/* Make sure that this half-finished acl looks good enough to process. */
|
||||
acl.push(0);
|
||||
|
||||
UCHAR* a = acl.begin();
|
||||
UCHAR* a = acl.begin();
|
||||
|
||||
if (*a++ != ACL_version)
|
||||
BUGCHECK(160); /* msg 160 wrong ACL version */
|
||||
|
||||
bool hit = false;
|
||||
|
||||
|
||||
while ( (c = *a++) )
|
||||
switch (c) {
|
||||
case ACL_id_list:
|
||||
@ -1102,7 +1099,7 @@ static bool check_string(const UCHAR* acl, const Firebird::MetaName& name)
|
||||
const TEXT* string = name.c_str();
|
||||
if (l)
|
||||
{
|
||||
do
|
||||
do
|
||||
{
|
||||
const UCHAR c1 = *acl++;
|
||||
const TEXT c2 = *string++;
|
||||
|
@ -881,8 +881,8 @@ IDX_E IDX_modify_check_constraints(thread_db* tdbb,
|
||||
while (BTR_next_index
|
||||
(tdbb, org_rpb->rpb_relation, transaction, &idx, &window))
|
||||
{
|
||||
if (!(idx.idx_flags & (idx_primary | idx_unique))
|
||||
|| !MET_lookup_partner(tdbb, org_rpb->rpb_relation, &idx, 0))
|
||||
if (!(idx.idx_flags & (idx_primary | idx_unique)) ||
|
||||
!MET_lookup_partner(tdbb, org_rpb->rpb_relation, &idx, 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -890,20 +890,17 @@ IDX_E IDX_modify_check_constraints(thread_db* tdbb,
|
||||
*bad_relation = new_rpb->rpb_relation;
|
||||
if (
|
||||
(error_code =
|
||||
BTR_key(tdbb, new_rpb->rpb_relation, new_rpb->rpb_record, &idx,
|
||||
&key1, 0, false))
|
||||
|| (error_code =
|
||||
BTR_key(tdbb, org_rpb->rpb_relation, org_rpb->rpb_record,
|
||||
&idx, &key2, 0, false)))
|
||||
BTR_key(tdbb, new_rpb->rpb_relation, new_rpb->rpb_record, &idx, &key1, 0, false)) ||
|
||||
(error_code =
|
||||
BTR_key(tdbb, org_rpb->rpb_relation, org_rpb->rpb_record, &idx, &key2, 0, false)))
|
||||
{
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
break;
|
||||
}
|
||||
if (!key_equal(&key1, &key2)) {
|
||||
error_code =
|
||||
check_foreign_key(tdbb, org_rpb->rpb_record,
|
||||
org_rpb->rpb_relation, transaction, &idx,
|
||||
bad_relation, bad_index);
|
||||
check_foreign_key(tdbb, org_rpb->rpb_record, org_rpb->rpb_relation, transaction,
|
||||
&idx, bad_relation, bad_index);
|
||||
if (idx_e_ok != error_code) {
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
return error_code;
|
||||
@ -1037,11 +1034,9 @@ static IDX_E check_duplicates(
|
||||
|
||||
rpb.rpb_number.setValue(accessor.current());
|
||||
|
||||
if (rpb.rpb_number != insertion->iib_number
|
||||
&& VIO_get_current(tdbb, &old_rpb, &rpb, insertion->iib_transaction,
|
||||
tdbb->getDefaultPool(),
|
||||
is_fk,
|
||||
has_old_values) )
|
||||
if (rpb.rpb_number != insertion->iib_number &&
|
||||
VIO_get_current(tdbb, &old_rpb, &rpb, insertion->iib_transaction, tdbb->getDefaultPool(),
|
||||
is_fk, has_old_values) )
|
||||
{
|
||||
// dimitr: we shouldn't ignore status exceptions which take place
|
||||
// inside the lock manager. Namely, they are: isc_deadlock,
|
||||
|
542
src/jrd/met.epp
542
src/jrd/met.epp
File diff suppressed because it is too large
Load Diff
@ -76,8 +76,7 @@ bool MET_get_char_coll_subtype_info(Jrd::thread_db*, USHORT, SubtypeInfo* info)
|
||||
Jrd::jrd_nod* MET_get_dependencies(Jrd::thread_db*, Jrd::jrd_rel*, const UCHAR*,
|
||||
Jrd::CompilerScratch*, Jrd::bid*, Jrd::jrd_req**,
|
||||
Jrd::CompilerScratch**, Firebird::MetaName&, int, USHORT,
|
||||
Jrd::jrd_tra*,
|
||||
Firebird::MetaName = Firebird::MetaName());
|
||||
Jrd::jrd_tra*, Firebird::MetaName = Firebird::MetaName());
|
||||
Jrd::jrd_fld* MET_get_field(Jrd::jrd_rel*, USHORT);
|
||||
void MET_get_shadow_files(Jrd::thread_db*, bool);
|
||||
void MET_load_db_triggers(Jrd::thread_db*, int);
|
||||
|
@ -81,7 +81,7 @@ bool PCMET_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
case 0:
|
||||
MET_delete_dependencies(tdbb, work->dfw_name, obj_expression_index, transaction);
|
||||
return false;
|
||||
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
return true;
|
||||
@ -90,7 +90,7 @@ bool PCMET_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
|
||||
relation = NULL;
|
||||
MOVE_CLEAR(&idx, sizeof(index_desc));
|
||||
|
||||
|
||||
request = CMP_find_request(tdbb, irq_c_exp_index, IRQ_REQUESTS);
|
||||
/*
|
||||
if (request)
|
||||
@ -130,8 +130,7 @@ bool PCMET_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
if (IDX.RDB$INDEX_ID)
|
||||
{
|
||||
IDX_delete_index(tdbb, relation, IDX.RDB$INDEX_ID - 1);
|
||||
MET_delete_dependencies(tdbb, work->dfw_name,
|
||||
obj_expression_index, transaction);
|
||||
MET_delete_dependencies(tdbb, work->dfw_name, obj_expression_index, transaction);
|
||||
MODIFY IDX
|
||||
IDX.RDB$INDEX_ID.NULL = TRUE;
|
||||
END_MODIFY;
|
||||
@ -155,18 +154,18 @@ bool PCMET_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
idx.idx_flags |= idx_descending;
|
||||
|
||||
CompilerScratch* csb = 0;
|
||||
/* allocate a new pool to contain the expression tree
|
||||
/* allocate a new pool to contain the expression tree
|
||||
for the expression index */
|
||||
new_pool = dbb->createPool();
|
||||
{
|
||||
Jrd::ContextPoolHolder context(tdbb, new_pool);
|
||||
MET_scan_relation(tdbb, relation);
|
||||
|
||||
if (!IDX.RDB$EXPRESSION_BLR.NULL)
|
||||
if (!IDX.RDB$EXPRESSION_BLR.NULL)
|
||||
{
|
||||
MetaTmp(IDX.RDB$INDEX_NAME)
|
||||
idx.idx_expression = MET_get_dependencies(tdbb, relation,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
&IDX.RDB$EXPRESSION_BLR,
|
||||
&idx.idx_expression_request,
|
||||
&csb, tmp,
|
||||
@ -179,14 +178,13 @@ bool PCMET_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
|
||||
idx.idx_count = 1;
|
||||
idx.idx_flags |= idx_expressn;
|
||||
CMP_get_desc(tdbb, csb, idx.idx_expression,
|
||||
&idx.idx_expression_desc);
|
||||
CMP_get_desc(tdbb, csb, idx.idx_expression, &idx.idx_expression_desc);
|
||||
idx.idx_rpt[0].idx_itype =
|
||||
DFW_assign_index_type(tdbb, work,
|
||||
idx.idx_expression_desc.dsc_dtype,
|
||||
idx.idx_expression_desc.dsc_sub_type);
|
||||
idx.idx_rpt[0].idx_selectivity = 0;
|
||||
|
||||
|
||||
delete csb;
|
||||
}
|
||||
|
||||
@ -221,8 +219,8 @@ bool PCMET_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
||||
|
||||
TRA_detach_request(idx.idx_expression_request);
|
||||
tdbb->setRequest(current_request);
|
||||
tdbb->setTransaction(current_transaction);
|
||||
|
||||
tdbb->setTransaction(current_transaction);
|
||||
|
||||
DFW_update_index(work->dfw_name.c_str(), idx.idx_id, selectivity, transaction);
|
||||
|
||||
// Get rid of the pool containing the expression tree
|
||||
@ -251,12 +249,11 @@ void PCMET_lookup_index(thread_db* tdbb, jrd_rel* relation, index_desc* idx)
|
||||
SET_TDBB(tdbb);
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
// Check the index blocks for the relation to see if we
|
||||
// Check the index blocks for the relation to see if we
|
||||
// have a cached block
|
||||
|
||||
IndexBlock* index_block;
|
||||
for (index_block = relation->rel_index_blocks; index_block;
|
||||
index_block = index_block->idb_next)
|
||||
for (index_block = relation->rel_index_blocks; index_block; index_block = index_block->idb_next)
|
||||
{
|
||||
if (index_block->idb_id == idx->idx_id)
|
||||
break;
|
||||
@ -270,8 +267,7 @@ void PCMET_lookup_index(thread_db* tdbb, jrd_rel* relation, index_desc* idx)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(relation->rel_flags & REL_scanned) ||
|
||||
(relation->rel_flags & REL_being_scanned))
|
||||
if (!(relation->rel_flags & REL_scanned) || (relation->rel_flags & REL_being_scanned))
|
||||
{
|
||||
MET_scan_relation(tdbb, relation);
|
||||
}
|
||||
@ -295,7 +291,7 @@ void PCMET_lookup_index(thread_db* tdbb, jrd_rel* relation, index_desc* idx)
|
||||
idx->idx_expression_request = NULL;
|
||||
}
|
||||
|
||||
/* parse the blr, making sure to create the resulting expression
|
||||
/* parse the blr, making sure to create the resulting expression
|
||||
tree and request in its own pool so that it may be cached
|
||||
with the index block in the "permanent" metadata cache */
|
||||
|
||||
|
369
src/jrd/why.cpp
369
src/jrd/why.cpp
@ -1299,39 +1299,20 @@ ISC_STATUS API_ROUTINE GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
|
||||
utilities can modify it */
|
||||
|
||||
PathName org_filename(file_name, file_length ? file_length : strlen(file_name));
|
||||
|
||||
ClumpletWriter newDpb(ClumpletReader::Tagged, MAX_DPB_SIZE,
|
||||
reinterpret_cast<const UCHAR*>(dpb), dpb_length, isc_dpb_version1);
|
||||
|
||||
bool utfFilename = newDpb.find(isc_dpb_utf8_filename);
|
||||
|
||||
if (utfFilename)
|
||||
ISC_utf8ToSystem(org_filename);
|
||||
else
|
||||
newDpb.insertTag(isc_dpb_utf8_filename);
|
||||
|
||||
setLogin(newDpb);
|
||||
|
||||
org_filename.rtrim();
|
||||
|
||||
PathName expanded_filename;
|
||||
bool unescaped = false;
|
||||
|
||||
if (!set_path(org_filename, expanded_filename))
|
||||
{
|
||||
expanded_filename = org_filename;
|
||||
ISC_systemToUtf8(expanded_filename);
|
||||
ISC_unescape(expanded_filename);
|
||||
unescaped = true;
|
||||
ISC_utf8ToSystem(expanded_filename);
|
||||
ISC_expand_filename(expanded_filename, true);
|
||||
}
|
||||
|
||||
ISC_systemToUtf8(org_filename);
|
||||
ISC_systemToUtf8(expanded_filename);
|
||||
ClumpletWriter newDpb(ClumpletReader::Tagged, MAX_DPB_SIZE,
|
||||
reinterpret_cast<const UCHAR*>(dpb), dpb_length, isc_dpb_version1);
|
||||
|
||||
if (unescaped)
|
||||
ISC_escape(expanded_filename);
|
||||
setLogin(newDpb);
|
||||
|
||||
if (org_filename != expanded_filename && !newDpb.find(isc_dpb_org_filename))
|
||||
{
|
||||
@ -1470,7 +1451,7 @@ ISC_STATUS API_ROUTINE GDS_CANCEL_BLOB(ISC_STATUS * user_status,
|
||||
|
||||
ISC_STATUS API_ROUTINE GDS_CANCEL_EVENTS(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * handle,
|
||||
SLONG * id)
|
||||
SLONG* id)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1488,9 +1469,7 @@ ISC_STATUS API_ROUTINE GDS_CANCEL_EVENTS(ISC_STATUS * user_status,
|
||||
{
|
||||
Attachment* attachment = translate<Attachment>(handle);
|
||||
status.setPrimaryHandle(attachment);
|
||||
CALL(PROC_CANCEL_EVENTS, attachment->implementation) (status,
|
||||
&attachment->handle,
|
||||
id);
|
||||
CALL(PROC_CANCEL_EVENTS, attachment->implementation) (status, &attachment->handle, id);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -1598,9 +1577,7 @@ ISC_STATUS API_ROUTINE GDS_COMMIT(ISC_STATUS * user_status,
|
||||
|
||||
if (transaction->implementation != SUBSYSTEMS) {
|
||||
// Handle single transaction case
|
||||
if (CALL(PROC_COMMIT, transaction->implementation) (status,
|
||||
&transaction->
|
||||
handle))
|
||||
if (CALL(PROC_COMMIT, transaction->implementation) (status, &transaction->handle))
|
||||
{
|
||||
return status[1];
|
||||
}
|
||||
@ -1879,39 +1856,20 @@ ISC_STATUS API_ROUTINE GDS_CREATE_DATABASE(ISC_STATUS* user_status,
|
||||
utilities can modify it */
|
||||
|
||||
PathName org_filename(file_name, file_length ? file_length : strlen(file_name));
|
||||
|
||||
ClumpletWriter newDpb(ClumpletReader::Tagged, MAX_DPB_SIZE,
|
||||
reinterpret_cast<const UCHAR*>(dpb), dpb_length, isc_dpb_version1);
|
||||
|
||||
bool utfFilename = newDpb.find(isc_dpb_utf8_filename);
|
||||
|
||||
if (utfFilename)
|
||||
ISC_utf8ToSystem(org_filename);
|
||||
else
|
||||
newDpb.insertTag(isc_dpb_utf8_filename);
|
||||
|
||||
setLogin(newDpb);
|
||||
|
||||
org_filename.rtrim();
|
||||
|
||||
PathName expanded_filename;
|
||||
bool unescaped = false;
|
||||
|
||||
if (!set_path(org_filename, expanded_filename))
|
||||
{
|
||||
expanded_filename = org_filename;
|
||||
ISC_systemToUtf8(expanded_filename);
|
||||
ISC_unescape(expanded_filename);
|
||||
unescaped = true;
|
||||
ISC_utf8ToSystem(expanded_filename);
|
||||
ISC_expand_filename(expanded_filename, true);
|
||||
}
|
||||
|
||||
ISC_systemToUtf8(org_filename);
|
||||
ISC_systemToUtf8(expanded_filename);
|
||||
ClumpletWriter newDpb(ClumpletReader::Tagged, MAX_DPB_SIZE,
|
||||
reinterpret_cast<const UCHAR*>(dpb), dpb_length, isc_dpb_version1);
|
||||
|
||||
if (unescaped)
|
||||
ISC_escape(expanded_filename);
|
||||
setLogin(newDpb);
|
||||
|
||||
if (org_filename != expanded_filename && !newDpb.find(isc_dpb_org_filename))
|
||||
{
|
||||
@ -1927,10 +1885,7 @@ ISC_STATUS API_ROUTINE GDS_CREATE_DATABASE(ISC_STATUS* user_status,
|
||||
#ifdef WIN_NT
|
||||
// Now we can expand, the file exists
|
||||
expanded_filename = org_filename;
|
||||
ISC_unescape(expanded_filename);
|
||||
ISC_utf8ToSystem(expanded_filename);
|
||||
ISC_expand_filename(expanded_filename, true);
|
||||
ISC_systemToUtf8(expanded_filename);
|
||||
ISC_expand_filename(expanded_filename, true);
|
||||
#endif
|
||||
|
||||
attachment = new Attachment(handle, public_handle, n);
|
||||
@ -2025,12 +1980,9 @@ ISC_STATUS API_ROUTINE GDS_DATABASE_INFO(ISC_STATUS* user_status,
|
||||
{
|
||||
Attachment* attachment = translate<Attachment>(handle);
|
||||
status.setPrimaryHandle(attachment);
|
||||
CALL(PROC_DATABASE_INFO, attachment->implementation) (status,
|
||||
&attachment->handle,
|
||||
item_length,
|
||||
items,
|
||||
buffer_length,
|
||||
buffer);
|
||||
CALL(PROC_DATABASE_INFO, attachment->implementation) (status, &attachment->handle,
|
||||
item_length, items,
|
||||
buffer_length, buffer);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -2834,13 +2786,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_EXEC_IMM2_M(ISC_STATUS* user_status,
|
||||
Status status(user_status);
|
||||
|
||||
bool stmt_eaten;
|
||||
if (PREPARSE_execute( status,
|
||||
db_handle,
|
||||
tra_handle,
|
||||
length,
|
||||
string,
|
||||
&stmt_eaten,
|
||||
dialect))
|
||||
if (PREPARSE_execute(status, db_handle, tra_handle, length, string, &stmt_eaten, dialect))
|
||||
{
|
||||
if (status[1])
|
||||
{
|
||||
@ -2864,17 +2810,14 @@ ISC_STATUS API_ROUTINE GDS_DSQL_EXEC_IMM2_M(ISC_STATUS* user_status,
|
||||
|
||||
const SCHAR ch = isc_info_base_level;
|
||||
SCHAR buffer[16];
|
||||
if (!GDS_DATABASE_INFO(status, db_handle, 1, &ch, sizeof(buffer),
|
||||
buffer))
|
||||
if (!GDS_DATABASE_INFO(status, db_handle, 1, &ch, sizeof(buffer), buffer))
|
||||
{
|
||||
if ((buffer[0] != isc_info_base_level) || (buffer[4] > 3))
|
||||
GDS_DSQL_EXEC_IMM3_M(status, db_handle,
|
||||
&crdb_trans_handle, length, string,
|
||||
GDS_DSQL_EXEC_IMM3_M(status, db_handle, &crdb_trans_handle, length, string,
|
||||
dialect, in_blr_length, in_blr,
|
||||
in_msg_type, in_msg_length, in_msg,
|
||||
out_blr_length, out_blr,
|
||||
out_msg_type, out_msg_length,
|
||||
out_msg);
|
||||
out_msg_type, out_msg_length, out_msg);
|
||||
else
|
||||
ret_v3_error = TRUE;
|
||||
}
|
||||
@ -2904,12 +2847,9 @@ ISC_STATUS API_ROUTINE GDS_DSQL_EXEC_IMM2_M(ISC_STATUS* user_status,
|
||||
return status[1];
|
||||
}
|
||||
|
||||
return GDS_DSQL_EXEC_IMM3_M(user_status, db_handle, tra_handle,
|
||||
length, string, dialect,
|
||||
in_blr_length, in_blr, in_msg_type,
|
||||
in_msg_length, in_msg, out_blr_length,
|
||||
out_blr, out_msg_type, out_msg_length,
|
||||
out_msg);
|
||||
return GDS_DSQL_EXEC_IMM3_M(user_status, db_handle, tra_handle, length, string, dialect,
|
||||
in_blr_length, in_blr, in_msg_type, in_msg_length, in_msg,
|
||||
out_blr_length, out_blr, out_msg_type, out_msg_length, out_msg);
|
||||
}
|
||||
|
||||
|
||||
@ -2967,8 +2907,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_EXEC_IMM3_M(ISC_STATUS* user_status,
|
||||
}
|
||||
|
||||
CALL(PROC_DSQL_EXEC_IMMED2, dbb->implementation) (status,
|
||||
&dbb->handle,
|
||||
&handle,
|
||||
&dbb->handle, &handle,
|
||||
length, string, dialect,
|
||||
in_blr_length, in_blr,
|
||||
in_msg_type, in_msg_length, in_msg,
|
||||
@ -3107,8 +3046,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_FETCH2(ISC_STATUS* user_status,
|
||||
return s;
|
||||
}
|
||||
|
||||
if (UTLD_parse_sqlda(status, &dasup, NULL, NULL, NULL,
|
||||
dialect, sqlda, DASUP_CLAUSE_select))
|
||||
if (UTLD_parse_sqlda(status, &dasup, NULL, NULL, NULL, dialect, sqlda, DASUP_CLAUSE_select))
|
||||
{
|
||||
return status[1];
|
||||
}
|
||||
@ -3149,15 +3087,12 @@ ISC_STATUS API_ROUTINE GDS_DSQL_FETCH_M(ISC_STATUS* user_status,
|
||||
status.setPrimaryHandle(statement);
|
||||
|
||||
ISC_STATUS s =
|
||||
CALL(PROC_DSQL_FETCH, statement->implementation) (status,
|
||||
&statement->handle,
|
||||
CALL(PROC_DSQL_FETCH, statement->implementation) (status, &statement->handle,
|
||||
blr_length, blr,
|
||||
msg_type,
|
||||
msg_length, msg
|
||||
msg_type, msg_length, msg
|
||||
#ifdef SCROLLABLE_CURSORS
|
||||
,
|
||||
(USHORT) 0,
|
||||
(ULONG) 1
|
||||
(USHORT) 0, (ULONG) 1
|
||||
#endif // SCROLLABLE_CURSORS
|
||||
);
|
||||
|
||||
@ -3204,14 +3139,10 @@ ISC_STATUS API_ROUTINE GDS_DSQL_FETCH2_M(ISC_STATUS* user_status,
|
||||
status.setPrimaryHandle(statement);
|
||||
|
||||
ISC_STATUS s =
|
||||
CALL(PROC_DSQL_FETCH, statement->implementation) (status,
|
||||
&statement->
|
||||
handle,
|
||||
CALL(PROC_DSQL_FETCH, statement->implementation) (status, &statement->handle,
|
||||
blr_length, blr,
|
||||
msg_type,
|
||||
msg_length, msg,
|
||||
direction,
|
||||
offset);
|
||||
msg_type, msg_length, msg,
|
||||
direction, offset);
|
||||
|
||||
if (s == 100 || s == 101)
|
||||
{
|
||||
@ -3228,8 +3159,8 @@ ISC_STATUS API_ROUTINE GDS_DSQL_FETCH2_M(ISC_STATUS* user_status,
|
||||
#endif
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE GDS_DSQL_FREE(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * stmt_handle,
|
||||
ISC_STATUS API_ROUTINE GDS_DSQL_FREE(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* stmt_handle,
|
||||
USHORT option)
|
||||
{
|
||||
/*****************************************
|
||||
@ -3249,9 +3180,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_FREE(ISC_STATUS * user_status,
|
||||
Statement* statement = translate<Statement>(stmt_handle);
|
||||
status.setPrimaryHandle(statement);
|
||||
|
||||
if (CALL(PROC_DSQL_FREE, statement->implementation) (status,
|
||||
&statement->handle,
|
||||
option))
|
||||
if (CALL(PROC_DSQL_FREE, statement->implementation) (status, &statement->handle, option))
|
||||
{
|
||||
return status[1];
|
||||
}
|
||||
@ -3345,8 +3274,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_INSERT_M(ISC_STATUS* user_status,
|
||||
statement->checkPrepared();
|
||||
sqlda_sup& dasup = statement->das;
|
||||
|
||||
CALL(PROC_DSQL_INSERT, statement->implementation) (status,
|
||||
&statement->handle,
|
||||
CALL(PROC_DSQL_INSERT, statement->implementation) (status, &statement->handle,
|
||||
blr_length, blr,
|
||||
msg_type, msg_length, msg);
|
||||
}
|
||||
@ -3539,15 +3467,10 @@ ISC_STATUS API_ROUTINE GDS_DSQL_PREPARE_M(ISC_STATUS* user_status,
|
||||
handle = transaction->handle;
|
||||
}
|
||||
|
||||
CALL(PROC_DSQL_PREPARE, statement->implementation) (status,
|
||||
&handle,
|
||||
&statement->handle,
|
||||
length,
|
||||
string, dialect,
|
||||
item_length,
|
||||
items,
|
||||
buffer_length,
|
||||
buffer);
|
||||
CALL(PROC_DSQL_PREPARE, statement->implementation) (status, &handle, &statement->handle,
|
||||
length, string, dialect,
|
||||
item_length, items,
|
||||
buffer_length, buffer);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -3580,8 +3503,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_SET_CURSOR(ISC_STATUS* user_status,
|
||||
Statement* statement = translate<Statement>(stmt_handle);
|
||||
status.setPrimaryHandle(statement);
|
||||
|
||||
CALL(PROC_DSQL_SET_CURSOR, statement->implementation) (status,
|
||||
&statement->handle,
|
||||
CALL(PROC_DSQL_SET_CURSOR, statement->implementation) (status, &statement->handle,
|
||||
cursor, type);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -3620,8 +3542,7 @@ ISC_STATUS API_ROUTINE GDS_DSQL_SQL_INFO(ISC_STATUS* user_status,
|
||||
if (( (item_length == 1) && (items[0] == isc_info_sql_stmt_type) ||
|
||||
(item_length == 2) && (items[0] == isc_info_sql_stmt_type) &&
|
||||
(items[1] == isc_info_end || items[1] == 0) ) &&
|
||||
(statement->flags & HANDLE_STATEMENT_prepared) &&
|
||||
statement->das.dasup_stmt_type)
|
||||
(statement->flags & HANDLE_STATEMENT_prepared) && statement->das.dasup_stmt_type)
|
||||
{
|
||||
if (buffer_length >= 8)
|
||||
{
|
||||
@ -3671,8 +3592,8 @@ int API_ROUTINE gds__enable_subsystem(TEXT * subsystem)
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE isc_wait_for_event(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * handle,
|
||||
ISC_STATUS API_ROUTINE isc_wait_for_event(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* handle,
|
||||
USHORT length,
|
||||
const UCHAR* events,
|
||||
UCHAR* buffer)
|
||||
@ -3714,11 +3635,11 @@ ISC_STATUS API_ROUTINE isc_wait_for_event(ISC_STATUS * user_status,
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE GDS_GET_SEGMENT(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * blob_handle,
|
||||
USHORT * length,
|
||||
ISC_STATUS API_ROUTINE GDS_GET_SEGMENT(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* blob_handle,
|
||||
USHORT* length,
|
||||
USHORT buffer_length,
|
||||
UCHAR * buffer)
|
||||
UCHAR* buffer)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -3786,9 +3707,7 @@ ISC_STATUS API_ROUTINE GDS_GET_SLICE(ISC_STATUS* user_status,
|
||||
status.setPrimaryHandle(dbb);
|
||||
Transaction* transaction = findTransaction(tra_handle, dbb);
|
||||
|
||||
CALL(PROC_GET_SLICE, dbb->implementation) (status,
|
||||
&dbb->handle,
|
||||
&transaction->handle,
|
||||
CALL(PROC_GET_SLICE, dbb->implementation) (status, &dbb->handle, &transaction->handle,
|
||||
array_id,
|
||||
sdl_length, sdl,
|
||||
param_length, param,
|
||||
@ -3886,8 +3805,7 @@ ISC_STATUS API_ROUTINE GDS_OPEN_BLOB2(ISC_STATUS* user_status,
|
||||
**************************************/
|
||||
|
||||
return open_blob(user_status, db_handle, tra_handle, blob_handle, blob_id,
|
||||
bpb_length, bpb, PROC_OPEN_BLOB,
|
||||
PROC_OPEN_BLOB2);
|
||||
bpb_length, bpb, PROC_OPEN_BLOB, PROC_OPEN_BLOB2);
|
||||
}
|
||||
|
||||
|
||||
@ -3934,8 +3852,7 @@ ISC_STATUS API_ROUTINE GDS_PREPARE2(ISC_STATUS* user_status,
|
||||
for (Transaction* sub = transaction; sub; sub = sub->next)
|
||||
{
|
||||
if (sub->implementation != SUBSYSTEMS &&
|
||||
CALL(PROC_PREPARE, sub->implementation) (status, &sub->handle,
|
||||
msg_length, msg))
|
||||
CALL(PROC_PREPARE, sub->implementation) (status, &sub->handle, msg_length, msg))
|
||||
{
|
||||
return status[1];
|
||||
}
|
||||
@ -3973,10 +3890,7 @@ ISC_STATUS API_ROUTINE GDS_PUT_SEGMENT(ISC_STATUS* user_status,
|
||||
Blob* blob = translate<Blob>(blob_handle);
|
||||
status.setPrimaryHandle(blob);
|
||||
|
||||
CALL(PROC_PUT_SEGMENT, blob->implementation) (status,
|
||||
&blob->handle,
|
||||
buffer_length,
|
||||
buffer);
|
||||
CALL(PROC_PUT_SEGMENT, blob->implementation) (status, &blob->handle, buffer_length, buffer);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4016,16 +3930,11 @@ ISC_STATUS API_ROUTINE GDS_PUT_SLICE(ISC_STATUS* user_status,
|
||||
status.setPrimaryHandle(dbb);
|
||||
Transaction* transaction = findTransaction(tra_handle, dbb);
|
||||
|
||||
CALL(PROC_PUT_SLICE, dbb->implementation) (status,
|
||||
&dbb->handle,
|
||||
&transaction->handle,
|
||||
CALL(PROC_PUT_SLICE, dbb->implementation) (status, &dbb->handle, &transaction->handle,
|
||||
array_id,
|
||||
sdl_length,
|
||||
sdl,
|
||||
param_length,
|
||||
param,
|
||||
slice_length,
|
||||
slice);
|
||||
sdl_length, sdl,
|
||||
param_length, param,
|
||||
slice_length, slice);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4062,8 +3971,7 @@ ISC_STATUS API_ROUTINE GDS_QUE_EVENTS(ISC_STATUS* user_status,
|
||||
status.setPrimaryHandle(dbb);
|
||||
|
||||
CALL(PROC_QUE_EVENTS, dbb->implementation) (status, &dbb->handle,
|
||||
id, length, events,
|
||||
ast, arg);
|
||||
id, length, events, ast, arg);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4104,11 +4012,8 @@ ISC_STATUS API_ROUTINE GDS_RECEIVE(ISC_STATUS* user_status,
|
||||
Request* request = translate<Request>(req_handle);
|
||||
status.setPrimaryHandle(request);
|
||||
|
||||
CALL(PROC_RECEIVE, request->implementation) (status,
|
||||
&request->handle,
|
||||
msg_type,
|
||||
msg_length,
|
||||
msg,
|
||||
CALL(PROC_RECEIVE, request->implementation) (status, &request->handle,
|
||||
msg_type, msg_length, msg,
|
||||
level);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -4149,14 +4054,9 @@ ISC_STATUS API_ROUTINE GDS_RECEIVE2(ISC_STATUS* user_status,
|
||||
Request* request = translate<Request>(req_handle);
|
||||
status.setPrimaryHandle(request);
|
||||
|
||||
CALL(PROC_RECEIVE, request->implementation) (status,
|
||||
&request->handle,
|
||||
msg_type,
|
||||
msg_length,
|
||||
msg,
|
||||
level,
|
||||
direction,
|
||||
offset);
|
||||
CALL(PROC_RECEIVE, request->implementation) (status, &request->handle,
|
||||
msg_type, msg_length, msg,
|
||||
level, direction, offset);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4216,8 +4116,8 @@ ISC_STATUS API_ROUTINE GDS_RECONNECT(ISC_STATUS* user_status,
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE GDS_RELEASE_REQUEST(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * req_handle)
|
||||
ISC_STATUS API_ROUTINE GDS_RELEASE_REQUEST(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* req_handle)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4236,8 +4136,7 @@ ISC_STATUS API_ROUTINE GDS_RELEASE_REQUEST(ISC_STATUS * user_status,
|
||||
Request* request = translate<Request>(req_handle);
|
||||
status.setPrimaryHandle(request);
|
||||
|
||||
if (!CALL(PROC_RELEASE_REQUEST, request->implementation) (status,
|
||||
&request->handle))
|
||||
if (!CALL(PROC_RELEASE_REQUEST, request->implementation) (status, &request->handle))
|
||||
{
|
||||
delete request;
|
||||
*req_handle = 0;
|
||||
@ -4277,13 +4176,10 @@ ISC_STATUS API_ROUTINE GDS_REQUEST_INFO(ISC_STATUS* user_status,
|
||||
Request* request = translate<Request>(req_handle);
|
||||
status.setPrimaryHandle(request);
|
||||
|
||||
CALL(PROC_REQUEST_INFO, request->implementation) (status,
|
||||
&request->handle,
|
||||
CALL(PROC_REQUEST_INFO, request->implementation) (status, &request->handle,
|
||||
level,
|
||||
item_length,
|
||||
items,
|
||||
buffer_length,
|
||||
buffer);
|
||||
item_length, items,
|
||||
buffer_length, buffer);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4337,8 +4233,8 @@ SLONG API_ROUTINE isc_reset_fpe(USHORT fpe_status)
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE GDS_ROLLBACK_RETAINING(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * tra_handle)
|
||||
ISC_STATUS API_ROUTINE GDS_ROLLBACK_RETAINING(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* tra_handle)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4359,8 +4255,7 @@ ISC_STATUS API_ROUTINE GDS_ROLLBACK_RETAINING(ISC_STATUS * user_status,
|
||||
for (Transaction* sub = transaction; sub; sub = sub->next)
|
||||
{
|
||||
if (sub->implementation != SUBSYSTEMS &&
|
||||
CALL(PROC_ROLLBACK_RETAINING, sub->implementation) (status,
|
||||
&sub->handle))
|
||||
CALL(PROC_ROLLBACK_RETAINING, sub->implementation) (status, &sub->handle))
|
||||
{
|
||||
return status[1];
|
||||
}
|
||||
@ -4377,8 +4272,8 @@ ISC_STATUS API_ROUTINE GDS_ROLLBACK_RETAINING(ISC_STATUS * user_status,
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE GDS_ROLLBACK(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * tra_handle)
|
||||
ISC_STATUS API_ROUTINE GDS_ROLLBACK(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* tra_handle)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4400,8 +4295,7 @@ ISC_STATUS API_ROUTINE GDS_ROLLBACK(ISC_STATUS * user_status,
|
||||
if (sub->implementation != SUBSYSTEMS &&
|
||||
CALL(PROC_ROLLBACK, sub->implementation) (status, &sub->handle))
|
||||
{
|
||||
if (!is_network_error(status) ||
|
||||
(transaction->flags & HANDLE_TRANSACTION_limbo) )
|
||||
if (!is_network_error(status) || (transaction->flags & HANDLE_TRANSACTION_limbo) )
|
||||
{
|
||||
return status[1];
|
||||
}
|
||||
@ -4429,11 +4323,11 @@ ISC_STATUS API_ROUTINE GDS_ROLLBACK(ISC_STATUS * user_status,
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE GDS_SEEK_BLOB(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * blob_handle,
|
||||
ISC_STATUS API_ROUTINE GDS_SEEK_BLOB(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* blob_handle,
|
||||
SSHORT mode,
|
||||
SLONG offset,
|
||||
SLONG * result)
|
||||
SLONG* result)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4451,10 +4345,7 @@ ISC_STATUS API_ROUTINE GDS_SEEK_BLOB(ISC_STATUS * user_status,
|
||||
Blob* blob = translate<Blob>(blob_handle);
|
||||
status.setPrimaryHandle(blob);
|
||||
|
||||
CALL(PROC_SEEK_BLOB, blob->implementation) (status,
|
||||
&blob->handle,
|
||||
mode,
|
||||
offset, result);
|
||||
CALL(PROC_SEEK_BLOB, blob->implementation) (status, &blob->handle, mode, offset, result);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4560,10 +4451,7 @@ ISC_STATUS API_ROUTINE GDS_SERVICE_ATTACH(ISC_STATUS* user_status,
|
||||
ISC_STATUS* ptr = status;
|
||||
for (n = 0; n < SUBSYSTEMS; n++)
|
||||
{
|
||||
if (!CALL(PROC_SERVICE_ATTACH, n) (ptr,
|
||||
svcname.c_str(),
|
||||
&handle,
|
||||
spb_length, spb))
|
||||
if (!CALL(PROC_SERVICE_ATTACH, n) (ptr, svcname.c_str(), &handle, spb_length, spb))
|
||||
{
|
||||
service = new Service(handle, public_handle, n);
|
||||
status[0] = isc_arg_gds;
|
||||
@ -4601,8 +4489,8 @@ ISC_STATUS API_ROUTINE GDS_SERVICE_ATTACH(ISC_STATUS* user_status,
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE GDS_SERVICE_DETACH(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * handle)
|
||||
ISC_STATUS API_ROUTINE GDS_SERVICE_DETACH(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* handle)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4620,8 +4508,7 @@ ISC_STATUS API_ROUTINE GDS_SERVICE_DETACH(ISC_STATUS * user_status,
|
||||
{
|
||||
Service* service = translate<Service>(handle);
|
||||
|
||||
if (CALL(PROC_SERVICE_DETACH, service->implementation) (status,
|
||||
&service->handle))
|
||||
if (CALL(PROC_SERVICE_DETACH, service->implementation) (status, &service->handle))
|
||||
{
|
||||
return status[1];
|
||||
}
|
||||
@ -4674,12 +4561,9 @@ ISC_STATUS API_ROUTINE GDS_SERVICE_QUERY(ISC_STATUS* user_status,
|
||||
CALL(PROC_SERVICE_QUERY, service->implementation) (status,
|
||||
&service->handle,
|
||||
0, /* reserved */
|
||||
send_item_length,
|
||||
send_items,
|
||||
recv_item_length,
|
||||
recv_items,
|
||||
buffer_length,
|
||||
buffer);
|
||||
send_item_length, send_items,
|
||||
recv_item_length, recv_items,
|
||||
buffer_length, buffer);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4717,8 +4601,7 @@ ISC_STATUS API_ROUTINE GDS_SERVICE_START(ISC_STATUS* user_status,
|
||||
{
|
||||
Service* service = translate<Service>(handle);
|
||||
|
||||
CALL(PROC_SERVICE_START, service->implementation) (status,
|
||||
&service->handle,
|
||||
CALL(PROC_SERVICE_START, service->implementation) (status, &service->handle,
|
||||
NULL,
|
||||
spb_length, spb);
|
||||
}
|
||||
@ -4758,10 +4641,8 @@ ISC_STATUS API_ROUTINE GDS_START_AND_SEND(ISC_STATUS* user_status,
|
||||
Transaction* transaction = findTransaction(tra_handle, request->parent);
|
||||
|
||||
CALL(PROC_START_AND_SEND, request->implementation) (status,
|
||||
&request->handle,
|
||||
&transaction->
|
||||
handle, msg_type,
|
||||
msg_length, msg,
|
||||
&request->handle, &transaction->handle,
|
||||
msg_type, msg_length, msg,
|
||||
level);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -4773,9 +4654,9 @@ ISC_STATUS API_ROUTINE GDS_START_AND_SEND(ISC_STATUS* user_status,
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE GDS_START(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * req_handle,
|
||||
FB_API_HANDLE * tra_handle,
|
||||
ISC_STATUS API_ROUTINE GDS_START(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* req_handle,
|
||||
FB_API_HANDLE* tra_handle,
|
||||
SSHORT level)
|
||||
{
|
||||
/**************************************
|
||||
@ -4796,9 +4677,7 @@ ISC_STATUS API_ROUTINE GDS_START(ISC_STATUS * user_status,
|
||||
status.setPrimaryHandle(request);
|
||||
Transaction* transaction = findTransaction(tra_handle, request->parent);
|
||||
|
||||
CALL(PROC_START, request->implementation) (status,
|
||||
&request->handle,
|
||||
&transaction->handle,
|
||||
CALL(PROC_START, request->implementation) (status, &request->handle, &transaction->handle,
|
||||
level);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
@ -4845,21 +4724,16 @@ ISC_STATUS API_ROUTINE GDS_START_MULTIPLE(ISC_STATUS* user_status,
|
||||
|
||||
Transaction** ptr;
|
||||
USHORT n;
|
||||
for (n = 0, ptr = &transaction; n < count;
|
||||
n++, ptr = &(*ptr)->next, vector++)
|
||||
for (n = 0, ptr = &transaction; n < count; n++, ptr = &(*ptr)->next, vector++)
|
||||
{
|
||||
if (vector->teb_tpb_length < 0 ||
|
||||
(vector->teb_tpb_length > 0 && !vector->teb_tpb))
|
||||
if (vector->teb_tpb_length < 0 || (vector->teb_tpb_length > 0 && !vector->teb_tpb))
|
||||
{
|
||||
status_exception::raise(Arg::Gds(isc_bad_tpb_form));
|
||||
}
|
||||
|
||||
dbb = translate<Attachment>(vector->teb_database);
|
||||
|
||||
if (CALL(PROC_START_TRANSACTION, dbb->implementation) (status,
|
||||
&handle,
|
||||
1,
|
||||
&dbb->handle,
|
||||
if (CALL(PROC_START_TRANSACTION, dbb->implementation) (status, &handle, 1, &dbb->handle,
|
||||
vector->teb_tpb_length,
|
||||
vector->teb_tpb))
|
||||
{
|
||||
@ -4907,8 +4781,8 @@ ISC_STATUS API_ROUTINE GDS_START_MULTIPLE(ISC_STATUS* user_status,
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE_VARARG GDS_START_TRANSACTION(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * tra_handle,
|
||||
ISC_STATUS API_ROUTINE_VARARG GDS_START_TRANSACTION(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* tra_handle,
|
||||
SSHORT count, ...)
|
||||
{
|
||||
/**************************************
|
||||
@ -4977,14 +4851,10 @@ ISC_STATUS API_ROUTINE GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
|
||||
status.setPrimaryHandle(dbb);
|
||||
Transaction* transaction = findTransaction(tra_handle, dbb);
|
||||
|
||||
CALL(PROC_TRANSACT_REQUEST, dbb->implementation) (status,
|
||||
&dbb->handle,
|
||||
&transaction->
|
||||
handle, blr_length,
|
||||
blr, in_msg_length,
|
||||
in_msg,
|
||||
out_msg_length,
|
||||
out_msg);
|
||||
CALL(PROC_TRANSACT_REQUEST, dbb->implementation) (status, &dbb->handle, &transaction->handle,
|
||||
blr_length, blr,
|
||||
in_msg_length, in_msg,
|
||||
out_msg_length, out_msg);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4995,8 +4865,8 @@ ISC_STATUS API_ROUTINE GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE gds__transaction_cleanup(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * tra_handle,
|
||||
ISC_STATUS API_ROUTINE gds__transaction_cleanup(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* tra_handle,
|
||||
TransactionCleanupRoutine *routine,
|
||||
void* arg)
|
||||
{
|
||||
@ -5049,25 +4919,17 @@ ISC_STATUS API_ROUTINE GDS_TRANSACTION_INFO(ISC_STATUS* user_status,
|
||||
status.setPrimaryHandle(transaction);
|
||||
|
||||
if (transaction->implementation != SUBSYSTEMS) {
|
||||
CALL(PROC_TRANSACTION_INFO, transaction->implementation) (status,
|
||||
&transaction->
|
||||
handle,
|
||||
item_length,
|
||||
items,
|
||||
buffer_length,
|
||||
buffer);
|
||||
CALL(PROC_TRANSACTION_INFO, transaction->implementation) (status, &transaction->handle,
|
||||
item_length, items,
|
||||
buffer_length, buffer);
|
||||
}
|
||||
else {
|
||||
SSHORT item_len = item_length;
|
||||
SSHORT buffer_len = buffer_length;
|
||||
for (Transaction* sub = transaction->next; sub; sub = sub->next) {
|
||||
if (CALL(PROC_TRANSACTION_INFO, sub->implementation) (status,
|
||||
&sub->
|
||||
handle,
|
||||
item_len,
|
||||
items,
|
||||
buffer_len,
|
||||
buffer))
|
||||
if (CALL(PROC_TRANSACTION_INFO, sub->implementation) (status, &sub->handle,
|
||||
item_len, items,
|
||||
buffer_len, buffer))
|
||||
{
|
||||
return status[1];
|
||||
}
|
||||
@ -5098,8 +4960,8 @@ ISC_STATUS API_ROUTINE GDS_TRANSACTION_INFO(ISC_STATUS* user_status,
|
||||
}
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE GDS_UNWIND(ISC_STATUS * user_status,
|
||||
FB_API_HANDLE * req_handle,
|
||||
ISC_STATUS API_ROUTINE GDS_UNWIND(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* req_handle,
|
||||
SSHORT level)
|
||||
{
|
||||
/**************************************
|
||||
@ -5120,9 +4982,7 @@ ISC_STATUS API_ROUTINE GDS_UNWIND(ISC_STATUS * user_status,
|
||||
Request* request = translate<Request>(req_handle);
|
||||
status.setPrimaryHandle(request);
|
||||
|
||||
CALL(PROC_UNWIND, request->implementation) (status,
|
||||
&request->handle,
|
||||
level);
|
||||
CALL(PROC_UNWIND, request->implementation) (status, &request->handle, level);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -5191,9 +5051,7 @@ static void check_status_vector(const ISC_STATUS* status)
|
||||
|
||||
/* Vector [2] could either end the vector, or start a warning
|
||||
in either case the status vector is a success */
|
||||
if ((s[1] == FB_SUCCESS) &&
|
||||
(s[2] != isc_arg_end) &&
|
||||
(s[2] != isc_arg_gds) &&
|
||||
if ((s[1] == FB_SUCCESS) && (s[2] != isc_arg_end) && (s[2] != isc_arg_gds) &&
|
||||
(s[2] != isc_arg_warning))
|
||||
{
|
||||
SV_MSG("Bad success vector format");
|
||||
@ -5233,12 +5091,10 @@ static void check_status_vector(const ISC_STATUS* status)
|
||||
}
|
||||
if (!found)
|
||||
if (code == isc_arg_warning) {
|
||||
SV_MSG
|
||||
("warning code does not contain a valid facility");
|
||||
SV_MSG("warning code does not contain a valid facility");
|
||||
}
|
||||
else {
|
||||
SV_MSG
|
||||
("error code does not contain a valid facility");
|
||||
SV_MSG("error code does not contain a valid facility");
|
||||
}
|
||||
}
|
||||
s++;
|
||||
@ -6090,7 +5946,7 @@ int API_ROUTINE fb_shutdown(unsigned int timeout, const int reason)
|
||||
rc = FB_FAILURE;
|
||||
}
|
||||
|
||||
// Finish shutdown
|
||||
// Finish shutdown
|
||||
if (ShutChain::run(fb_shut_finish, reason) != FB_SUCCESS)
|
||||
{
|
||||
rc = FB_FAILURE;
|
||||
@ -6135,3 +5991,4 @@ ISC_STATUS API_ROUTINE fb_shutdown_callback(ISC_STATUS* user_status,
|
||||
|
||||
return status[1];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user