mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 06:03:02 +01:00
Remove trailing spaces from epp files - I had forgot them
This commit is contained in:
parent
42712a391f
commit
582d837778
@ -2,28 +2,28 @@
|
||||
* tab=4
|
||||
*
|
||||
*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* PROGRAM: Alice (All Else) Utility
|
||||
* MODULE: alice_meta.epp
|
||||
* DESCRIPTION: Metadata lookup routines
|
||||
*
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
*
|
||||
*
|
||||
*____________________________________________________________
|
||||
*
|
||||
@ -60,9 +60,9 @@ static void parse_fullpath(TDR);
|
||||
static USHORT snarf_blob(ISC_QUAD*, USHORT, TEXT*);
|
||||
|
||||
|
||||
/*
|
||||
table used to determine capabilities, checking for specific
|
||||
fields in system relations
|
||||
/*
|
||||
table used to determine capabilities, checking for specific
|
||||
fields in system relations
|
||||
*/
|
||||
|
||||
struct rfr_tab_t {
|
||||
@ -83,10 +83,10 @@ static inline void return_error(const ISC_STATUS* user_status)
|
||||
}
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Disable WAL for the database forcibly.
|
||||
* Drop all the entries from RDB$LOG_FILES
|
||||
*/
|
||||
*/
|
||||
|
||||
void MET_disable_wal(ISC_STATUS* user_status, isc_db_handle handle)
|
||||
{
|
||||
@ -96,15 +96,15 @@ void MET_disable_wal(ISC_STATUS* user_status, isc_db_handle handle)
|
||||
if (!(DB = handle))
|
||||
return;
|
||||
|
||||
START_TRANSACTION
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
START_TRANSACTION
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
FOR(REQUEST_HANDLE request)
|
||||
X IN RDB$LOG_FILES
|
||||
ERASE X;
|
||||
END_FOR
|
||||
COMMIT
|
||||
END_FOR
|
||||
COMMIT
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
@ -112,11 +112,11 @@ void MET_disable_wal(ISC_STATUS* user_status, isc_db_handle handle)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Get the state of a transaction,
|
||||
* assuming that the database has
|
||||
* already been attached.
|
||||
*/
|
||||
*/
|
||||
|
||||
void MET_get_state(ISC_STATUS* user_status, TDR trans)
|
||||
{
|
||||
@ -129,17 +129,17 @@ void MET_get_state(ISC_STATUS* user_status, TDR trans)
|
||||
return;
|
||||
}
|
||||
|
||||
START_TRANSACTION
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
START_TRANSACTION
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
|
||||
FOR(REQUEST_HANDLE request)
|
||||
TRA IN RDB$TRANSACTIONS WITH
|
||||
TRA.RDB$TRANSACTION_ID = trans->tdr_id
|
||||
trans->tdr_state = TRA.RDB$TRANSACTION_STATE;
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
|
||||
@ -148,19 +148,19 @@ void MET_get_state(ISC_STATUS* user_status, TDR trans)
|
||||
return_error(user_status);
|
||||
}
|
||||
|
||||
ROLLBACK
|
||||
ON_ERROR
|
||||
ROLLBACK
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Get the description of a transaction in
|
||||
* limbo, including all associated transactions
|
||||
* in other databases.
|
||||
*/
|
||||
*/
|
||||
|
||||
TDR MET_get_transaction(ISC_STATUS* user_status, isc_db_handle handle, SLONG id)
|
||||
{
|
||||
@ -171,8 +171,8 @@ TDR MET_get_transaction(ISC_STATUS* user_status, isc_db_handle handle, SLONG id)
|
||||
if (!(DB = handle))
|
||||
return 0;
|
||||
|
||||
START_TRANSACTION
|
||||
ON_ERROR
|
||||
START_TRANSACTION
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
|
||||
@ -184,8 +184,8 @@ TDR MET_get_transaction(ISC_STATUS* user_status, isc_db_handle handle, SLONG id)
|
||||
TRA.RDB$TRANSACTION_ID = id AND
|
||||
TRA.RDB$TRANSACTION_DESCRIPTION NOT MISSING
|
||||
trans = get_description(&TRA.RDB$TRANSACTION_DESCRIPTION);
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
|
||||
@ -195,9 +195,9 @@ TDR MET_get_transaction(ISC_STATUS* user_status, isc_db_handle handle, SLONG id)
|
||||
}
|
||||
}
|
||||
|
||||
ROLLBACK
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
ROLLBACK
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
|
||||
if (trans)
|
||||
@ -208,10 +208,10 @@ TDR MET_get_transaction(ISC_STATUS* user_status, isc_db_handle handle, SLONG id)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Get the capabilities associated with
|
||||
* the database for a particular transaction.
|
||||
*/
|
||||
*/
|
||||
|
||||
void MET_set_capabilities(ISC_STATUS* user_status, TDR trans)
|
||||
{
|
||||
@ -220,24 +220,24 @@ void MET_set_capabilities(ISC_STATUS* user_status, TDR trans)
|
||||
if (!(DB = trans->tdr_db_handle))
|
||||
return;
|
||||
|
||||
START_TRANSACTION
|
||||
ON_ERROR
|
||||
START_TRANSACTION
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
|
||||
trans->tdr_db_caps = get_capabilities(user_status);
|
||||
|
||||
ROLLBACK
|
||||
ON_ERROR
|
||||
ROLLBACK
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Eat a string with a byte-encoded length.
|
||||
*/
|
||||
*/
|
||||
|
||||
static alice_str* alloc_string(const TEXT** ptr)
|
||||
{
|
||||
@ -262,17 +262,17 @@ static alice_str* alloc_string(const TEXT** ptr)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Get the capabilities associated with
|
||||
* the database for a particular transaction.
|
||||
*/
|
||||
*/
|
||||
|
||||
static USHORT get_capabilities(ISC_STATUS* user_status)
|
||||
{
|
||||
USHORT capabilities = CAP_none;
|
||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||
|
||||
// Look for desired fields in system relations
|
||||
// Look for desired fields in system relations
|
||||
FB_API_HANDLE req = 0;
|
||||
|
||||
for (const rfr_tab_t* rel_field_table = rfr_table; rel_field_table->relation;
|
||||
@ -282,8 +282,8 @@ static USHORT get_capabilities(ISC_STATUS* user_status)
|
||||
WITH x.RDB$RELATION_NAME = rel_field_table->relation
|
||||
AND x.RDB$FIELD_NAME = rel_field_table->field
|
||||
capabilities |= rel_field_table->bit_mask;
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
return_error(user_status);
|
||||
END_ERROR;
|
||||
}
|
||||
@ -298,11 +298,11 @@ static USHORT get_capabilities(ISC_STATUS* user_status)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Get the description of a transaction in
|
||||
* limbo, including all associated transactions
|
||||
* in other databases.
|
||||
*/
|
||||
*/
|
||||
|
||||
static TDR get_description(ISC_QUAD* blob_id)
|
||||
{
|
||||
@ -329,9 +329,9 @@ static TDR get_description(ISC_QUAD* blob_id)
|
||||
alice_str* host_site = NULL;
|
||||
alice_str* database_path = NULL;
|
||||
|
||||
// skip version number
|
||||
// skip version number
|
||||
++p;
|
||||
|
||||
|
||||
TDR ptr = NULL; // silence uninitialized warning
|
||||
SLONG id_length, id;
|
||||
|
||||
@ -383,16 +383,16 @@ static TDR get_description(ISC_QUAD* blob_id)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
* Take apart a full remote path specification,
|
||||
*
|
||||
* Take apart a full remote path specification,
|
||||
* finding the filename and the remote site.
|
||||
*/
|
||||
*/
|
||||
|
||||
static void parse_fullpath(TDR trans)
|
||||
{
|
||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||
|
||||
// start at the end of the full pathname
|
||||
// start at the end of the full pathname
|
||||
|
||||
const TEXT* p = (TEXT*) trans->tdr_fullpath->str_data;
|
||||
const TEXT* const start = p;
|
||||
@ -400,7 +400,7 @@ static void parse_fullpath(TDR trans)
|
||||
p++;
|
||||
const TEXT* const end = p;
|
||||
|
||||
// Check for a named pipes name - \\node\path\db or //node/path/db
|
||||
// Check for a named pipes name - \\node\path\db or //node/path/db
|
||||
while (p > start &&
|
||||
!(*p == '/' && *(p - 1) == '/') &&
|
||||
!(*p == '\\' && *(p - 1) == '\\'))
|
||||
@ -426,7 +426,7 @@ static void parse_fullpath(TDR trans)
|
||||
else {
|
||||
p = end;
|
||||
|
||||
/* If not named pipes, check the other protocols
|
||||
/* If not named pipes, check the other protocols
|
||||
* work backwards until we find a remote protocol specifier
|
||||
*/
|
||||
|
||||
@ -438,11 +438,11 @@ static void parse_fullpath(TDR trans)
|
||||
p -= 2;
|
||||
trans->tdr_filename = p + 1;
|
||||
|
||||
// now find the last remote node in the chain
|
||||
// now find the last remote node in the chain
|
||||
|
||||
while (p > start && (*p == ':' || *p == '^' || *p == '@'))
|
||||
p--;
|
||||
|
||||
|
||||
USHORT length = 0;
|
||||
for (; p >= start && (*p != '^' && *p != ':' && *p != '@'); ++length)
|
||||
--p;
|
||||
@ -460,11 +460,11 @@ static void parse_fullpath(TDR trans)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Get a blob into a buffer, returning the
|
||||
* size of the blob if the passed buffer
|
||||
* size of the blob if the passed buffer
|
||||
* is not big enough.
|
||||
*/
|
||||
*/
|
||||
|
||||
static USHORT snarf_blob(ISC_QUAD* blob_id,
|
||||
USHORT buffer_length, TEXT* buffer)
|
||||
@ -483,7 +483,7 @@ static USHORT snarf_blob(ISC_QUAD* blob_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get the blob into the buffer, if it fits
|
||||
// get the blob into the buffer, if it fits
|
||||
|
||||
TEXT* ptr = buffer;
|
||||
const TEXT* const end = buffer + buffer_length;
|
||||
@ -500,7 +500,7 @@ static USHORT snarf_blob(ISC_QUAD* blob_id,
|
||||
ptr += returned_length;
|
||||
}
|
||||
|
||||
// snarf failed, get length of blob for retry
|
||||
// snarf failed, get length of blob for retry
|
||||
|
||||
if (!buffer_length)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -26,7 +26,7 @@
|
||||
* could be returned or a lookup for a blob field could fail. In addition,
|
||||
* a possible buffer overrun due to unchecked bounds was closed. The fc
|
||||
* get_name() as been renamed copy_exact_name().
|
||||
*
|
||||
*
|
||||
* 2002-02-24 Sean Leyne - Code Cleanup of old Win 3.1 port (WINDOWS_ONLY)
|
||||
*
|
||||
*
|
||||
@ -102,17 +102,17 @@ ISC_STATUS API_ROUTINE isc_array_gen_sdl(ISC_STATUS* status,
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
|
||||
|
||||
return gen_sdl(status, desc, sdl_buffer_length, &sdl_buffer, sdl_length, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ISC_STATUS API_ROUTINE isc_array_get_slice(ISC_STATUS* status,
|
||||
FB_API_HANDLE* db_handle,
|
||||
FB_API_HANDLE* trans_handle,
|
||||
ISC_QUAD* array_id,
|
||||
const ISC_ARRAY_DESC* desc,
|
||||
void* array,
|
||||
void* array,
|
||||
SLONG* slice_length)
|
||||
{
|
||||
/**************************************
|
||||
@ -182,8 +182,8 @@ ISC_STATUS API_ROUTINE isc_array_lookup_bounds(ISC_STATUS* status,
|
||||
tail->array_bound_lower = (SSHORT)X.RDB$LOWER_BOUND;
|
||||
tail->array_bound_upper = (SSHORT)X.RDB$UPPER_BOUND;
|
||||
++tail;
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
ISC_STATUS_ARRAY temp_status;
|
||||
isc_release_request(temp_status, &handle);
|
||||
return UTLD_copy_status(isc_status, status);
|
||||
@ -221,7 +221,7 @@ ISC_STATUS API_ROUTINE isc_array_put_slice(ISC_STATUS* status,
|
||||
FB_API_HANDLE* trans_handle,
|
||||
ISC_QUAD* array_id,
|
||||
const ISC_ARRAY_DESC* desc,
|
||||
void* array,
|
||||
void* array,
|
||||
SLONG* slice_length)
|
||||
{
|
||||
/**************************************
|
||||
@ -273,7 +273,7 @@ ISC_STATUS API_ROUTINE isc_array_set_desc(ISC_STATUS* status,
|
||||
sizeof(desc->array_desc_field_name));
|
||||
copy_exact_name (relation_name, desc->array_desc_relation_name,
|
||||
sizeof(desc->array_desc_relation_name));
|
||||
|
||||
|
||||
|
||||
desc->array_desc_flags = 0;
|
||||
desc->array_desc_dimensions = *dimensions;
|
||||
@ -320,7 +320,7 @@ ISC_STATUS API_ROUTINE isc_array_set_desc(ISC_STATUS* status,
|
||||
desc->array_desc_dtype = blr_quad;
|
||||
break;
|
||||
default:
|
||||
return error(status, Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
|
||||
return error(status, Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
|
||||
Arg::Gds(isc_random) << Arg::Str("data type not understood"));
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ static void adjust_length( ISC_ARRAY_DESC* desc)
|
||||
**************************************/
|
||||
}
|
||||
|
||||
static void copy_exact_name (
|
||||
static void copy_exact_name (
|
||||
const char* from,
|
||||
char* to,
|
||||
SSHORT bsize)
|
||||
@ -353,7 +353,7 @@ static void copy_exact_name (
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Functional description
|
||||
* Copy null terminated name ot stops at bsize - 1.
|
||||
* CVC: This is just another fc like DYN_terminate.
|
||||
*
|
||||
@ -374,7 +374,7 @@ static ISC_STATUS error(ISC_STATUS* status, const Arg::StatusVector& v)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e r r o r
|
||||
* e r r o r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
@ -535,9 +535,9 @@ static ISC_STATUS lookup_desc(ISC_STATUS* status,
|
||||
if (global) {
|
||||
copy_exact_name (Y.RDB$FIELD_NAME, global, sizeof(Y.RDB$FIELD_NAME));
|
||||
}
|
||||
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
ISC_STATUS_ARRAY temp_status;
|
||||
isc_release_request(temp_status, &handle);
|
||||
return UTLD_copy_status(isc_status, status);
|
||||
@ -546,7 +546,7 @@ static ISC_STATUS lookup_desc(ISC_STATUS* status,
|
||||
isc_release_request(isc_status, &handle);
|
||||
|
||||
if (!flag)
|
||||
return error(status, Arg::Gds(isc_fldnotdef) << Arg::Str(desc->array_desc_field_name) <<
|
||||
return error(status, Arg::Gds(isc_fldnotdef) << Arg::Str(desc->array_desc_field_name) <<
|
||||
Arg::Str(desc->array_desc_relation_name));
|
||||
|
||||
return error(status, Arg::Gds(FB_SUCCESS));
|
||||
@ -573,7 +573,7 @@ static ISC_STATUS stuff_args(gen_t* gen, SSHORT count, ...)
|
||||
return error(gen->gen_status, Arg::Gds(isc_misc_interpreted) << Arg::Str("SDL buffer overflow"));
|
||||
}
|
||||
|
||||
// The sdl buffer is too small. Allocate a larger one.
|
||||
// The sdl buffer is too small. Allocate a larger one.
|
||||
|
||||
const SSHORT new_len = gen->gen_end - *gen->gen_sdl_ptr + 512 + count;
|
||||
UCHAR* const new_sdl = (UCHAR*) gds__alloc(new_len);
|
||||
|
@ -91,7 +91,7 @@ ISC_STATUS API_ROUTINE isc_blob_gen_bpb(
|
||||
* Functional description
|
||||
*
|
||||
* This function will generate a bpb
|
||||
* given a to_desc and a from_desc
|
||||
* given a to_desc and a from_desc
|
||||
* which contain the subtype and
|
||||
* character set information.
|
||||
*
|
||||
@ -143,16 +143,16 @@ ISC_STATUS API_ROUTINE isc_blob_lookup_desc(ISC_STATUS* status,
|
||||
* character set and segment size information
|
||||
* from the metadata, given a relation/procedure name
|
||||
* and column/parameter name. it will fill in the information
|
||||
* in the BLOB_DESC.
|
||||
* in the BLOB_DESC.
|
||||
*
|
||||
***********************************************/
|
||||
ISC_STATUS_ARRAY isc_status = {0};
|
||||
isc_db_handle DB = *db_handle;
|
||||
isc_req_handle handle = 0;
|
||||
|
||||
copy_exact_name (field_name, desc->blob_desc_field_name,
|
||||
copy_exact_name (field_name, desc->blob_desc_field_name,
|
||||
sizeof(desc->blob_desc_field_name));
|
||||
copy_exact_name (relation_name, desc->blob_desc_relation_name,
|
||||
copy_exact_name (relation_name, desc->blob_desc_relation_name,
|
||||
sizeof(desc->blob_desc_relation_name));
|
||||
|
||||
bool flag = false;
|
||||
@ -172,7 +172,7 @@ ISC_STATUS API_ROUTINE isc_blob_lookup_desc(ISC_STATUS* status,
|
||||
copy_exact_name ((UCHAR*) Y.RDB$FIELD_NAME, global,
|
||||
sizeof(Y.RDB$FIELD_NAME));
|
||||
}
|
||||
END_FOR
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
ISC_STATUS_ARRAY temp_status;
|
||||
isc_release_request(temp_status, &handle);
|
||||
@ -200,7 +200,7 @@ ISC_STATUS API_ROUTINE isc_blob_lookup_desc(ISC_STATUS* status,
|
||||
copy_exact_name ((UCHAR*) Y.RDB$FIELD_NAME, global,
|
||||
sizeof(Y.RDB$FIELD_NAME));
|
||||
}
|
||||
END_FOR
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
ISC_STATUS_ARRAY temp_status;
|
||||
isc_release_request(temp_status, &handle);
|
||||
@ -209,9 +209,9 @@ ISC_STATUS API_ROUTINE isc_blob_lookup_desc(ISC_STATUS* status,
|
||||
|
||||
isc_release_request(isc_status, &handle);
|
||||
}
|
||||
|
||||
|
||||
if (!flag)
|
||||
return error(status, Arg::Gds(isc_fldnotdef) << Arg::Str((const char *)(desc->blob_desc_field_name)) <<
|
||||
return error(status, Arg::Gds(isc_fldnotdef) << Arg::Str((const char *)(desc->blob_desc_field_name)) <<
|
||||
Arg::Str((const char *)(desc->blob_desc_relation_name)));
|
||||
|
||||
return error(status, Arg::Gds(FB_SUCCESS));
|
||||
@ -241,9 +241,9 @@ ISC_STATUS API_ROUTINE isc_blob_set_desc(ISC_STATUS* status,
|
||||
*
|
||||
**************************************/
|
||||
|
||||
copy_exact_name (field_name, desc->blob_desc_field_name,
|
||||
copy_exact_name (field_name, desc->blob_desc_field_name,
|
||||
sizeof(desc->blob_desc_field_name));
|
||||
copy_exact_name (relation_name, desc->blob_desc_relation_name,
|
||||
copy_exact_name (relation_name, desc->blob_desc_relation_name,
|
||||
sizeof(desc->blob_desc_relation_name));
|
||||
|
||||
desc->blob_desc_subtype = subtype;
|
||||
@ -256,7 +256,7 @@ ISC_STATUS API_ROUTINE isc_blob_set_desc(ISC_STATUS* status,
|
||||
|
||||
|
||||
|
||||
static void copy_exact_name (
|
||||
static void copy_exact_name (
|
||||
const UCHAR* from,
|
||||
UCHAR* to,
|
||||
SSHORT bsize)
|
||||
@ -267,7 +267,7 @@ static void copy_exact_name (
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Functional description
|
||||
* Copy null terminated name ot stops at bsize - 1.
|
||||
* CVC: This is just another fc like DYN_terminate.
|
||||
*
|
||||
@ -288,7 +288,7 @@ static ISC_STATUS error(ISC_STATUS* status, const Arg::StatusVector& v)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e r r o r
|
||||
* e r r o r
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
|
@ -194,8 +194,8 @@ void EXE_create_database( DBB dbb)
|
||||
|
||||
const TEXT* file_name = dbb->dbb_name->sym_string;
|
||||
|
||||
const SLONG result = isc_attach_database(gds_status, 0, file_name,
|
||||
&DB, dpb.getBufferLength(),
|
||||
const SLONG result = isc_attach_database(gds_status, 0, file_name,
|
||||
&DB, dpb.getBufferLength(),
|
||||
reinterpret_cast<const char*>(dpb.getBuffer()));
|
||||
if (!dudleyGlob.DDL_replace) {
|
||||
if (!result) {
|
||||
@ -250,8 +250,8 @@ void EXE_create_database( DBB dbb)
|
||||
dpb.insertInt(isc_dpb_wal_grp_cmt_wait, len);
|
||||
}
|
||||
|
||||
if (isc_create_database(gds_status, 0, file_name, &DB,
|
||||
dpb.getBufferLength(),
|
||||
if (isc_create_database(gds_status, 0, file_name, &DB,
|
||||
dpb.getBufferLength(),
|
||||
reinterpret_cast<const char*>(dpb.getBuffer()), 0))
|
||||
{
|
||||
DDL_error_abort(gds_status, 21, SafeArg() << file_name);
|
||||
@ -301,12 +301,12 @@ void EXE_create_database( DBB dbb)
|
||||
|
||||
/* If there is a description of the database, store it now */
|
||||
|
||||
FOR D IN RDB$DATABASE
|
||||
MODIFY D USING
|
||||
FOR D IN RDB$DATABASE
|
||||
MODIFY D USING
|
||||
if (dbb->dbb_description) {
|
||||
store_text(dbb->dbb_description, &D.RDB$DESCRIPTION);
|
||||
D.RDB$DESCRIPTION.NULL = FALSE;
|
||||
}
|
||||
}
|
||||
if (dbb->dbb_security_class) {
|
||||
MOVE_SYMBOL(dbb->dbb_security_class, D.RDB$SECURITY_CLASS);
|
||||
D.RDB$SECURITY_CLASS.NULL = FALSE;
|
||||
@ -365,8 +365,8 @@ void EXE_drop_database( DBB dbb)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (isc_attach_database(gds_status, 0, dbb->dbb_name->sym_string,
|
||||
&DB, dpb.getBufferLength(),
|
||||
if (isc_attach_database(gds_status, 0, dbb->dbb_name->sym_string,
|
||||
&DB, dpb.getBufferLength(),
|
||||
reinterpret_cast<const char*>(dpb.getBuffer())))
|
||||
{
|
||||
DDL_error_abort(gds_status, 25);
|
||||
@ -707,8 +707,8 @@ void EXE_modify_database( DBB dbb)
|
||||
}
|
||||
*/
|
||||
|
||||
if (isc_attach_database(gds_status, 0, dbb->dbb_name->sym_string,
|
||||
&DB, dpb.getBufferLength(),
|
||||
if (isc_attach_database(gds_status, 0, dbb->dbb_name->sym_string,
|
||||
&DB, dpb.getBufferLength(),
|
||||
reinterpret_cast<const char*>(dpb.getBuffer())))
|
||||
{
|
||||
DDL_error_abort(gds_status, 29, SafeArg() << dbb->dbb_name->sym_string);
|
||||
@ -798,7 +798,7 @@ void EXE_modify_database( DBB dbb)
|
||||
|
||||
FOR X IN RDB$LOG_FILES
|
||||
DDL_error_abort(NULL, 333);
|
||||
// msg 333: Cannot modify log file specification. Drop and redefine log files
|
||||
// msg 333: Cannot modify log file specification. Drop and redefine log files
|
||||
END_FOR;
|
||||
|
||||
// add the new log files.
|
||||
@ -889,7 +889,7 @@ static void add_cache( DBB dbb)
|
||||
// **************************************
|
||||
bool result = false;
|
||||
|
||||
FOR FIL IN RDB$FILES WITH FIL.RDB$FILE_FLAGS EQ FILE_cache
|
||||
FOR FIL IN RDB$FILES WITH FIL.RDB$FILE_FLAGS EQ FILE_cache
|
||||
result = true;
|
||||
DDL_err(323, SafeArg() << FIL.RDB$FILE_NAME);
|
||||
// msg 323: a shared cache file %s already exists
|
||||
@ -900,7 +900,7 @@ static void add_cache( DBB dbb)
|
||||
|
||||
FIL file = dbb->dbb_cache_file;
|
||||
|
||||
STORE FIL IN RDB$FILES
|
||||
STORE FIL IN RDB$FILES
|
||||
MOVE_SYMBOL(file->fil_name, FIL.RDB$FILE_NAME);
|
||||
FIL.RDB$FILE_START = 0;
|
||||
FIL.RDB$FILE_LENGTH = file->fil_length;
|
||||
@ -1000,7 +1000,7 @@ static void add_files( DBB dbb, FIL files)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Add a file to an existing database.
|
||||
* Add a file to an existing database.
|
||||
*
|
||||
**************************************/
|
||||
FIL file, next;
|
||||
@ -1018,11 +1018,11 @@ static void add_files( DBB dbb, FIL files)
|
||||
against the user given maximum length (if given). */
|
||||
|
||||
SLONG length = 0, start = 0;
|
||||
|
||||
|
||||
if (dbb) {
|
||||
TEXT s[128];
|
||||
if (isc_database_info(gds_status, &DB, sizeof(alloc_info), alloc_info,
|
||||
sizeof(s), s) || s[0] != isc_info_allocation)
|
||||
sizeof(s), s) || s[0] != isc_info_allocation)
|
||||
{
|
||||
DDL_err(38);
|
||||
/* msg 38: isc_database_info failed */
|
||||
@ -1333,7 +1333,7 @@ static void add_index( DUDLEY_IDX index)
|
||||
|
||||
if (!if_any) {
|
||||
DDL_err(43, SafeArg() << index->idx_relation->sym_string);
|
||||
// msg 43: relation %s doesn't exist
|
||||
// msg 43: relation %s doesn't exist
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1402,7 +1402,7 @@ static void add_index( DUDLEY_IDX index)
|
||||
/* if there wasn't an index record, clean up any orphan index segments */
|
||||
|
||||
FOR X IN RDB$INDEX_SEGMENTS
|
||||
WITH X.RDB$INDEX_NAME = index->idx_name->sym_string
|
||||
WITH X.RDB$INDEX_NAME = index->idx_name->sym_string
|
||||
ERASE X;
|
||||
END_FOR;
|
||||
|
||||
@ -1558,7 +1558,7 @@ static void add_security_class( SCL sec_class)
|
||||
|
||||
SYM name = sec_class->scl_name;
|
||||
|
||||
FOR X IN RDB$SECURITY_CLASSES WITH X.RDB$SECURITY_CLASS EQ name->sym_string
|
||||
FOR X IN RDB$SECURITY_CLASSES WITH X.RDB$SECURITY_CLASS EQ name->sym_string
|
||||
if_any = true;
|
||||
DDL_err(50, SafeArg() << name->sym_string);
|
||||
/* msg 50: security class %s already exists */
|
||||
@ -1567,7 +1567,7 @@ static void add_security_class( SCL sec_class)
|
||||
if (if_any)
|
||||
return;
|
||||
|
||||
STORE X IN RDB$SECURITY_CLASSES
|
||||
STORE X IN RDB$SECURITY_CLASSES
|
||||
MOVE_SYMBOL(name, X.RDB$SECURITY_CLASS);
|
||||
if (sec_class->scl_description) {
|
||||
store_text(sec_class->scl_description, &X.RDB$DESCRIPTION);
|
||||
@ -1597,12 +1597,12 @@ static void add_trigger( DUDLEY_TRG trigger)
|
||||
FOR F IN RDB$RELATION_FIELDS CROSS V IN RDB$VIEW_RELATIONS WITH
|
||||
F.RDB$RELATION_NAME = V.RDB$VIEW_NAME AND
|
||||
F.RDB$RELATION_NAME = relation->rel_name->sym_string
|
||||
MODIFY F USING
|
||||
MODIFY F USING
|
||||
F.RDB$UPDATE_FLAG = TRUE;
|
||||
END_MODIFY;
|
||||
END_FOR;
|
||||
|
||||
STORE X IN RDB$TRIGGERS
|
||||
STORE X IN RDB$TRIGGERS
|
||||
X.RDB$TRIGGER_SOURCE.NULL = TRUE;
|
||||
X.RDB$TRIGGER_BLR.NULL = TRUE;
|
||||
X.RDB$DESCRIPTION.NULL = TRUE;
|
||||
@ -1617,12 +1617,12 @@ static void add_trigger( DUDLEY_TRG trigger)
|
||||
X.RDB$TRIGGER_SOURCE.NULL = FALSE;
|
||||
store_text(trigger->trg_source, &X.RDB$TRIGGER_SOURCE);
|
||||
}
|
||||
|
||||
|
||||
if (trigger->trg_statement) {
|
||||
X.RDB$TRIGGER_BLR.NULL = FALSE;
|
||||
store_blr(trigger->trg_statement, &X.RDB$TRIGGER_BLR, NULL);
|
||||
}
|
||||
|
||||
|
||||
if (trigger->trg_description) {
|
||||
X.RDB$DESCRIPTION.NULL = FALSE;
|
||||
store_text(trigger->trg_description, &X.RDB$DESCRIPTION);
|
||||
@ -1668,7 +1668,7 @@ static void add_type( TYP fldtype)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
STORE X IN RDB$TYPES
|
||||
STORE X IN RDB$TYPES
|
||||
X.RDB$DESCRIPTION.NULL = TRUE;
|
||||
MOVE_SYMBOL(fldtype->typ_field_name, X.RDB$FIELD_NAME);
|
||||
MOVE_SYMBOL(fldtype->typ_name, X.RDB$TYPE_NAME);
|
||||
@ -1702,7 +1702,7 @@ static void add_user_privilege( USERPRIV upriv)
|
||||
|
||||
/* rdb$owner_name doesn't get filled in until we store the relation */
|
||||
|
||||
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ upriv->userpriv_relation->sym_string
|
||||
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ upriv->userpriv_relation->sym_string
|
||||
strcpy(grantor, X.RDB$OWNER_NAME);
|
||||
if_any = true;
|
||||
END_FOR;
|
||||
@ -1718,7 +1718,7 @@ static void add_user_privilege( USERPRIV upriv)
|
||||
loop for each privilege, and if update privilege, loop for each field */
|
||||
|
||||
for (usr = upriv->userpriv_userlist; usr; usr = usr->usre_next) {
|
||||
/* start with a fresh copy of privflag and erase each
|
||||
/* start with a fresh copy of privflag and erase each
|
||||
privilege as we take care of it */
|
||||
|
||||
privflag = upriv->userpriv_flags & ~USERPRIV_grant;
|
||||
@ -1815,7 +1815,7 @@ static void add_view( DUDLEY_REL relation)
|
||||
|
||||
contexts = rse->nod_arg[s_rse_contexts];
|
||||
for (i = 0; i < contexts->nod_count; i++) {
|
||||
STORE X IN RDB$VIEW_RELATIONS
|
||||
STORE X IN RDB$VIEW_RELATIONS
|
||||
context = (DUDLEY_CTX) contexts->nod_arg[i]->nod_arg[0];
|
||||
target = context->ctx_relation;
|
||||
MOVE_SYMBOL(relation->rel_name, X.RDB$VIEW_NAME);
|
||||
@ -1833,7 +1833,7 @@ static void add_view( DUDLEY_REL relation)
|
||||
relation->rel_name->sym_string);
|
||||
/* msg 56: field %s already exists in relation %s */
|
||||
|
||||
STORE X IN RDB$RELATION_FIELDS
|
||||
STORE X IN RDB$RELATION_FIELDS
|
||||
X.RDB$SECURITY_CLASS.NULL = TRUE;
|
||||
X.RDB$FIELD_POSITION.NULL = TRUE;
|
||||
X.RDB$DESCRIPTION.NULL = TRUE;
|
||||
@ -1860,7 +1860,7 @@ static void add_view( DUDLEY_REL relation)
|
||||
target->rel_name->sym_string <<
|
||||
field->fld_name->sym_string);
|
||||
/* msg 57: field %s doesn't exist in relation %s as referenced in view field %s */
|
||||
|
||||
|
||||
X.RDB$VIEW_CONTEXT = context->ctx_context_id;
|
||||
FOR RFR IN RDB$RELATION_FIELDS WITH
|
||||
RFR.RDB$RELATION_NAME EQ target->rel_name->sym_string AND
|
||||
@ -1948,7 +1948,7 @@ static DUDLEY_FLD check_field( SYM relation, SYM field)
|
||||
SYM symbol = HSH_typed_lookup(X.RDB$FIELD_SOURCE, (USHORT) 0, SYM_global);
|
||||
if (symbol)
|
||||
return (DUDLEY_FLD) symbol->sym_object;
|
||||
}
|
||||
}
|
||||
END_FOR;
|
||||
|
||||
return NULL;
|
||||
@ -1964,7 +1964,7 @@ static bool check_function( SYM name)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Check function for existence.
|
||||
* Check function for existence.
|
||||
*
|
||||
**************************************/
|
||||
bool if_any = false;
|
||||
@ -1981,7 +1981,7 @@ static bool check_range(DUDLEY_FLD field)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* c h e c k _ r a n g e
|
||||
* c h e c k _ r a n g e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
@ -2003,7 +2003,7 @@ static bool check_range(DUDLEY_FLD field)
|
||||
// existance: if neither is an array, life is good
|
||||
// else if there are dimensions they'd better match
|
||||
|
||||
FOR X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name
|
||||
FOR X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name
|
||||
if (!dims) {
|
||||
if (!X.RDB$DIMENSIONS.NULL)
|
||||
DDL_err(302, SafeArg() << name);
|
||||
@ -2045,7 +2045,7 @@ static bool check_relation( SYM name)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Check relation for existence.
|
||||
* Check relation for existence.
|
||||
*
|
||||
**************************************/
|
||||
bool if_any = false;
|
||||
@ -2121,7 +2121,7 @@ static void drop_cache( DBB dbb)
|
||||
// **************************************
|
||||
bool found = false;
|
||||
|
||||
FOR FIL IN RDB$FILES WITH FIL.RDB$FILE_FLAGS EQ FILE_cache
|
||||
FOR FIL IN RDB$FILES WITH FIL.RDB$FILE_FLAGS EQ FILE_cache
|
||||
ERASE FIL;
|
||||
found = true;
|
||||
END_FOR;
|
||||
@ -2131,8 +2131,8 @@ static void drop_cache( DBB dbb)
|
||||
// msg 325: no shared cache file exists to drop
|
||||
|
||||
if (!dudleyGlob.DDL_errors) {
|
||||
COMMIT
|
||||
ON_ERROR
|
||||
COMMIT
|
||||
ON_ERROR
|
||||
DDL_db_error(gds_status, 326);
|
||||
// msg 326: error commiting deletion of shared cache file
|
||||
ROLLBACK;
|
||||
@ -2155,9 +2155,9 @@ static void drop_field( DUDLEY_FLD field)
|
||||
* Drop a field from a relation. First
|
||||
* check that it's not referenced in a
|
||||
* view (other that the current one, if the
|
||||
* current relation happens to be a view).
|
||||
* current relation happens to be a view).
|
||||
* If the field is computed, and
|
||||
* the current reference is not a view,
|
||||
* the current reference is not a view,
|
||||
* erase the artificially named source field.
|
||||
*
|
||||
**************************************/
|
||||
@ -2174,7 +2174,7 @@ static void drop_field( DUDLEY_FLD field)
|
||||
X.RDB$FIELD_SOURCE = 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
|
||||
|
||||
DDL_err(60, SafeArg() << field->fld_name->sym_string <<
|
||||
relation->rel_name->sym_string <<
|
||||
@ -2192,12 +2192,12 @@ static void drop_field( DUDLEY_FLD field)
|
||||
FOR Y IN RDB$RELATION_FIELDS WITH
|
||||
Y.RDB$FIELD_NAME = X.RDB$BASE_FIELD
|
||||
if_any = true;
|
||||
END_FOR
|
||||
END_FOR
|
||||
|
||||
if (!if_any) {
|
||||
FOR Z IN RDB$FIELDS WITH
|
||||
Z.RDB$FIELD_NAME = X.RDB$FIELD_SOURCE
|
||||
AND NOT(Z.RDB$COMPUTED_BLR MISSING)
|
||||
AND NOT(Z.RDB$COMPUTED_BLR MISSING)
|
||||
ERASE Z;
|
||||
END_FOR;
|
||||
}
|
||||
@ -2226,7 +2226,7 @@ static void drop_filter( FILTER filter)
|
||||
**************************************/
|
||||
bool if_any = false;
|
||||
|
||||
FOR F IN RDB$FILTERS WITH F.RDB$FUNCTION_NAME EQ filter->filter_name->sym_string
|
||||
FOR F IN RDB$FILTERS WITH F.RDB$FUNCTION_NAME EQ filter->filter_name->sym_string
|
||||
ERASE F;
|
||||
if_any = true;
|
||||
END_FOR;
|
||||
@ -2260,7 +2260,7 @@ static void drop_function( FUNC function)
|
||||
ERASE FUNCARG;
|
||||
END_FOR;
|
||||
|
||||
FOR FUNC IN RDB$FUNCTIONS WITH FUNC.RDB$FUNCTION_NAME EQ name
|
||||
FOR FUNC IN RDB$FUNCTIONS WITH FUNC.RDB$FUNCTION_NAME EQ name
|
||||
ERASE FUNC;
|
||||
if_any = true;
|
||||
END_FOR;
|
||||
@ -2308,21 +2308,21 @@ static void drop_global_field( DUDLEY_FLD field)
|
||||
return;
|
||||
|
||||
FOR X IN RDB$TYPES WITH
|
||||
X.RDB$FIELD_NAME EQ field->fld_name->sym_string
|
||||
X.RDB$FIELD_NAME EQ field->fld_name->sym_string
|
||||
ERASE X;
|
||||
END_FOR;
|
||||
|
||||
FOR X IN RDB$FIELD_DIMENSIONS WITH
|
||||
X.RDB$FIELD_NAME EQ field->fld_name->sym_string
|
||||
X.RDB$FIELD_NAME EQ field->fld_name->sym_string
|
||||
ERASE X;
|
||||
END_FOR;
|
||||
|
||||
FOR X IN RDB$FIELDS WITH
|
||||
X.RDB$FIELD_NAME EQ field->fld_name->sym_string
|
||||
X.RDB$FIELD_NAME EQ field->fld_name->sym_string
|
||||
ERASE X;
|
||||
if_any = true;
|
||||
END_FOR
|
||||
|
||||
END_FOR
|
||||
|
||||
if (!if_any)
|
||||
DDL_err(65, SafeArg() << field->fld_name->sym_string);
|
||||
/* msg 65: field %s doesn't exist */
|
||||
@ -2347,11 +2347,11 @@ static void drop_index( DUDLEY_IDX index)
|
||||
|
||||
/* Clean out index segments first. */
|
||||
|
||||
FOR SEG IN RDB$INDEX_SEGMENTS WITH SEG.RDB$INDEX_NAME EQ name
|
||||
FOR SEG IN RDB$INDEX_SEGMENTS WITH SEG.RDB$INDEX_NAME EQ name
|
||||
ERASE SEG;
|
||||
END_FOR;
|
||||
|
||||
FOR IDX IN RDB$INDICES WITH IDX.RDB$INDEX_NAME EQ name
|
||||
FOR IDX IN RDB$INDICES WITH IDX.RDB$INDEX_NAME EQ name
|
||||
ERASE IDX;
|
||||
if_any = true;
|
||||
END_FOR;
|
||||
@ -2389,7 +2389,7 @@ static void drop_relation( DUDLEY_REL relation)
|
||||
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name
|
||||
if (X.RDB$SYSTEM_FLAG == 1) {
|
||||
DDL_err(68, SafeArg() << name);
|
||||
// msg 68: can't drop system relation %s
|
||||
// msg 68: can't drop system relation %s
|
||||
return;
|
||||
}
|
||||
if_any = true;
|
||||
@ -2403,35 +2403,35 @@ static void drop_relation( DUDLEY_REL relation)
|
||||
|
||||
/* First, get rid of the relation itself. This will speed things later on. */
|
||||
|
||||
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name
|
||||
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name
|
||||
ERASE X;
|
||||
END_FOR;
|
||||
|
||||
/* Clean out RDB$INDICES, RDB$VIEW_RELATIONS and RDB$RELATION_FIELDS */
|
||||
|
||||
FOR IDX IN RDB$INDICES WITH IDX.RDB$RELATION_NAME EQ name
|
||||
FOR SEG IN RDB$INDEX_SEGMENTS WITH
|
||||
SEG.RDB$INDEX_NAME EQ IDX.RDB$INDEX_NAME
|
||||
FOR SEG IN RDB$INDEX_SEGMENTS WITH
|
||||
SEG.RDB$INDEX_NAME EQ IDX.RDB$INDEX_NAME
|
||||
ERASE SEG;
|
||||
END_FOR;
|
||||
ERASE IDX;
|
||||
END_FOR;
|
||||
|
||||
FOR X IN RDB$VIEW_RELATIONS WITH X.RDB$VIEW_NAME EQ name
|
||||
FOR X IN RDB$VIEW_RELATIONS WITH X.RDB$VIEW_NAME EQ name
|
||||
ERASE X;
|
||||
END_FOR;
|
||||
|
||||
FOR X IN RDB$RELATION_FIELDS WITH X.RDB$RELATION_NAME EQ name
|
||||
FOR X IN RDB$RELATION_FIELDS WITH X.RDB$RELATION_NAME EQ name
|
||||
ERASE X;
|
||||
END_FOR;
|
||||
|
||||
/* Finally, get rid of any user privileges */
|
||||
|
||||
FOR PRIV IN RDB$USER_PRIVILEGES WITH PRIV.RDB$RELATION_NAME EQ name AND
|
||||
PRIV.RDB$OBJECT_TYPE = obj_relation
|
||||
PRIV.RDB$OBJECT_TYPE = obj_relation
|
||||
ERASE PRIV;
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
END_ERROR;
|
||||
}
|
||||
|
||||
@ -2452,7 +2452,7 @@ static void drop_security_class( SCL scl_class)
|
||||
|
||||
SYM name = scl_class->scl_name;
|
||||
|
||||
FOR X IN RDB$SECURITY_CLASSES WITH X.RDB$SECURITY_CLASS EQ name->sym_string
|
||||
FOR X IN RDB$SECURITY_CLASSES WITH X.RDB$SECURITY_CLASS EQ name->sym_string
|
||||
ERASE X;
|
||||
if_any = true;
|
||||
END_FOR;
|
||||
@ -2480,7 +2480,7 @@ static void drop_shadow( SLONG shadow_number)
|
||||
dudley_lls* first_file = NULL;
|
||||
|
||||
FOR FIL IN RDB$FILES WITH
|
||||
FIL.RDB$SHADOW_NUMBER EQ shadow_number
|
||||
FIL.RDB$SHADOW_NUMBER EQ shadow_number
|
||||
ERASE FIL;
|
||||
SYM string = (SYM) DDL_alloc(SYM_LEN + strlen(FIL.RDB$FILE_NAME));
|
||||
strcpy(string->sym_name, FIL.RDB$FILE_NAME);
|
||||
@ -2494,8 +2494,8 @@ static void drop_shadow( SLONG shadow_number)
|
||||
/* msg 71: shadow %ld doesn't exist */
|
||||
|
||||
if (!dudleyGlob.DDL_errors) {
|
||||
COMMIT
|
||||
ON_ERROR
|
||||
COMMIT
|
||||
ON_ERROR
|
||||
DDL_db_error(gds_status, 72);
|
||||
/* msg 72: error commiting deletion of shadow */
|
||||
ROLLBACK;
|
||||
@ -2528,7 +2528,7 @@ static void drop_trigger( DUDLEY_TRG trigger)
|
||||
|
||||
/* Clean out possible trigger messages first. */
|
||||
|
||||
FOR TM IN RDB$TRIGGER_MESSAGES WITH TM.RDB$TRIGGER_NAME EQ name
|
||||
FOR TM IN RDB$TRIGGER_MESSAGES WITH TM.RDB$TRIGGER_NAME EQ name
|
||||
ERASE TM;
|
||||
END_FOR;
|
||||
|
||||
@ -2547,14 +2547,14 @@ static void drop_trigger( DUDLEY_TRG trigger)
|
||||
WITH V.RDB$VIEW_NAME = relation_name
|
||||
FOR F IN RDB$RELATION_FIELDS CROSS T IN RDB$TRIGGERS OVER
|
||||
RDB$RELATION_NAME WITH
|
||||
F.RDB$RELATION_NAME = V.RDB$VIEW_NAME
|
||||
F.RDB$RELATION_NAME = V.RDB$VIEW_NAME
|
||||
others = true;
|
||||
END_FOR;
|
||||
|
||||
if (!others) {
|
||||
FOR F IN RDB$RELATION_FIELDS
|
||||
WITH F.RDB$RELATION_NAME = V.RDB$VIEW_NAME
|
||||
MODIFY F USING
|
||||
MODIFY F USING
|
||||
F.RDB$UPDATE_FLAG = FALSE;
|
||||
END_MODIFY;
|
||||
END_FOR;
|
||||
@ -2609,7 +2609,7 @@ static void drop_type( TYP fldtype)
|
||||
!strncmp(fldtype->typ_name->sym_string, "ALL", 3))
|
||||
{
|
||||
FOR X IN RDB$TYPES WITH
|
||||
X.RDB$FIELD_NAME EQ fldtype->typ_field_name->sym_string
|
||||
X.RDB$FIELD_NAME EQ fldtype->typ_field_name->sym_string
|
||||
ERASE X;
|
||||
END_FOR;
|
||||
|
||||
@ -2618,7 +2618,7 @@ static void drop_type( TYP fldtype)
|
||||
|
||||
FOR X IN RDB$TYPES WITH
|
||||
X.RDB$FIELD_NAME EQ fldtype->typ_field_name->sym_string AND
|
||||
X.RDB$TYPE_NAME EQ fldtype->typ_name->sym_string
|
||||
X.RDB$TYPE_NAME EQ fldtype->typ_name->sym_string
|
||||
ERASE X;
|
||||
if_any = true;
|
||||
END_FOR;
|
||||
@ -2640,7 +2640,7 @@ static void drop_user_privilege( USERPRIV upriv)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Find and delete as many rdb$user_privilege entries
|
||||
* Find and delete as many rdb$user_privilege entries
|
||||
* as needed for the REVOKE statement.
|
||||
*
|
||||
**************************************/
|
||||
@ -2655,7 +2655,7 @@ static void drop_user_privilege( USERPRIV upriv)
|
||||
field entries */
|
||||
|
||||
for (usr = upriv->userpriv_userlist; usr; usr = usr->usre_next) {
|
||||
/* start with a fresh copy of privflag and erase each
|
||||
/* start with a fresh copy of privflag and erase each
|
||||
privilege as we take care of it */
|
||||
|
||||
privflag = upriv->userpriv_flags & ~USERPRIV_grant;
|
||||
@ -2726,7 +2726,7 @@ static void erase_userpriv( USERPRIV upriv, TEXT * priv, USRE usr, UPFE upf)
|
||||
X.RDB$PRIVILEGE EQ priv AND
|
||||
X.RDB$FIELD_NAME EQ fldname AND
|
||||
X.RDB$RELATION_NAME EQ relname AND
|
||||
X.RDB$OBJECT_TYPE EQ obj_relation
|
||||
X.RDB$OBJECT_TYPE EQ obj_relation
|
||||
|
||||
ERASE X;
|
||||
if_any = true;
|
||||
@ -2741,7 +2741,7 @@ static void erase_userpriv( USERPRIV upriv, TEXT * priv, USRE usr, UPFE upf)
|
||||
X.RDB$USER_TYPE EQ obj_user AND
|
||||
X.RDB$PRIVILEGE EQ priv AND
|
||||
X.RDB$RELATION_NAME EQ relname AND
|
||||
X.RDB$OBJECT_TYPE EQ obj_relation
|
||||
X.RDB$OBJECT_TYPE EQ obj_relation
|
||||
|
||||
ERASE X;
|
||||
if_any = true;
|
||||
@ -2831,7 +2831,7 @@ static void get_relations( DBB databaseL)
|
||||
DUDLEY_FLD field;
|
||||
SYM symbol;
|
||||
|
||||
FOR R IN RDB$RELATIONS
|
||||
FOR R IN RDB$RELATIONS
|
||||
relation = (DUDLEY_REL) DDL_alloc(sizeof(dudley_rel));
|
||||
relation->rel_name = symbol =
|
||||
get_symbol(SYM_relation, R.RDB$RELATION_NAME, (DUDLEY_CTX) relation);
|
||||
@ -2840,8 +2840,8 @@ static void get_relations( DBB databaseL)
|
||||
relation->rel_next = dudleyGlob.database->dbb_relations;
|
||||
dudleyGlob.database->dbb_relations = relation;
|
||||
relation->rel_system = R.RDB$SYSTEM_FLAG;
|
||||
FOR RFR IN RDB$RELATION_FIELDS WITH
|
||||
RFR.RDB$RELATION_NAME = R.RDB$RELATION_NAME
|
||||
FOR RFR IN RDB$RELATION_FIELDS WITH
|
||||
RFR.RDB$RELATION_NAME = R.RDB$RELATION_NAME
|
||||
|
||||
field = (DUDLEY_FLD) DDL_alloc(sizeof(dudley_fld));
|
||||
field->fld_name = get_symbol(SYM_field, RFR.RDB$FIELD_NAME, (DUDLEY_CTX) field);
|
||||
@ -2967,8 +2967,8 @@ static void get_triggers( DBB databaseL)
|
||||
DUDLEY_TRG trigger;
|
||||
SYM symbol, rel_name;
|
||||
|
||||
FOR T IN RDB$TRIGGERS WITH T.RDB$SYSTEM_FLAG MISSING OR
|
||||
T.RDB$SYSTEM_FLAG = 0
|
||||
FOR T IN RDB$TRIGGERS WITH T.RDB$SYSTEM_FLAG MISSING OR
|
||||
T.RDB$SYSTEM_FLAG = 0
|
||||
|
||||
trigger = (DUDLEY_TRG) DDL_alloc(sizeof(dudley_trg));
|
||||
trigger->trg_name = symbol =
|
||||
@ -3016,8 +3016,8 @@ static void get_udfs( DBB dbb)
|
||||
arg->funcarg_length = ARG.RDB$FIELD_LENGTH;
|
||||
arg->funcarg_sub_type = ARG.RDB$FIELD_SUB_TYPE;
|
||||
arg->funcarg_has_sub_type = !(ARG.RDB$FIELD_SUB_TYPE.NULL);
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
END_ERROR;
|
||||
}
|
||||
|
||||
@ -3345,10 +3345,10 @@ static void modify_field( DUDLEY_FLD field)
|
||||
relation = field->fld_relation;
|
||||
SYM name = field->fld_name;
|
||||
|
||||
FOR FIRST 1 X IN RDB$RELATION_FIELDS WITH
|
||||
X.RDB$FIELD_NAME EQ name->sym_string AND
|
||||
X.RDB$RELATION_NAME EQ relation->rel_name->sym_string
|
||||
MODIFY X USING
|
||||
FOR FIRST 1 X IN RDB$RELATION_FIELDS WITH
|
||||
X.RDB$FIELD_NAME EQ name->sym_string AND
|
||||
X.RDB$RELATION_NAME EQ relation->rel_name->sym_string
|
||||
MODIFY X USING
|
||||
if (field->fld_flags & fld_null_description)
|
||||
X.RDB$DESCRIPTION.NULL = TRUE;
|
||||
if (field->fld_flags & fld_null_security_class)
|
||||
@ -3368,7 +3368,7 @@ static void modify_field( DUDLEY_FLD field)
|
||||
|
||||
if (field->fld_source)
|
||||
MOVE_SYMBOL(field->fld_source, X.RDB$FIELD_SOURCE);
|
||||
|
||||
|
||||
if (field->fld_security_class) {
|
||||
MOVE_SYMBOL(field->fld_security_class, X.RDB$SECURITY_CLASS);
|
||||
X.RDB$SECURITY_CLASS.NULL = FALSE;
|
||||
@ -3394,9 +3394,9 @@ static void modify_field( DUDLEY_FLD field)
|
||||
X.RDB$QUERY_HEADER.NULL = FALSE;
|
||||
}
|
||||
|
||||
END_MODIFY
|
||||
END_MODIFY
|
||||
if_any = true;
|
||||
END_FOR
|
||||
END_FOR
|
||||
if (!if_any)
|
||||
DDL_err(82, SafeArg() << name->sym_string);
|
||||
/* msg 82: field %s doesn't exist */
|
||||
@ -3420,7 +3420,7 @@ static void modify_global_field( DUDLEY_FLD field)
|
||||
SYM name = field->fld_name;
|
||||
|
||||
FOR FIRST 1 X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name->sym_string
|
||||
MODIFY X USING
|
||||
MODIFY X USING
|
||||
if (field->fld_dtype) {
|
||||
if ((X.RDB$FIELD_TYPE != blr_blob) && (field->fld_dtype != blr_blob)) {
|
||||
if ((check_range(field))) {
|
||||
@ -3429,7 +3429,7 @@ static void modify_global_field( DUDLEY_FLD field)
|
||||
X.RDB$FIELD_SCALE = field->fld_scale;
|
||||
}
|
||||
}
|
||||
else if (field->fld_dtype != X.RDB$FIELD_TYPE)
|
||||
else if (field->fld_dtype != X.RDB$FIELD_TYPE)
|
||||
DDL_err(83, SafeArg() << name->sym_name);
|
||||
/* msg 83: Unauthorized attempt to change field %s to or from blob */
|
||||
}
|
||||
@ -3438,37 +3438,37 @@ static void modify_global_field( DUDLEY_FLD field)
|
||||
X.RDB$SYSTEM_FLAG = field->fld_system;
|
||||
else
|
||||
X.RDB$SYSTEM_FLAG = 0;
|
||||
|
||||
|
||||
if (field->fld_flags & fld_null_description)
|
||||
X.RDB$DESCRIPTION.NULL = TRUE;
|
||||
|
||||
|
||||
if (field->fld_flags & fld_null_missing_value)
|
||||
X.RDB$MISSING_VALUE.NULL = TRUE;
|
||||
|
||||
|
||||
if (field->fld_flags & fld_null_query_name)
|
||||
X.RDB$QUERY_NAME.NULL = TRUE;
|
||||
|
||||
|
||||
if (field->fld_flags & fld_null_query_header)
|
||||
X.RDB$QUERY_HEADER.NULL = TRUE;
|
||||
|
||||
|
||||
if (field->fld_flags & fld_null_edit_string)
|
||||
X.RDB$EDIT_STRING.NULL = TRUE;
|
||||
|
||||
|
||||
if (field->fld_flags & fld_null_validation) {
|
||||
X.RDB$VALIDATION_BLR.NULL = TRUE;
|
||||
X.RDB$VALIDATION_SOURCE.NULL = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (field->fld_segment_length) {
|
||||
X.RDB$SEGMENT_LENGTH = field->fld_segment_length;
|
||||
X.RDB$SEGMENT_LENGTH.NULL = FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (field->fld_has_sub_type) {
|
||||
X.RDB$FIELD_SUB_TYPE = field->fld_sub_type;
|
||||
X.RDB$FIELD_SUB_TYPE.NULL = FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (field->fld_missing) {
|
||||
store_blr(field->fld_missing, &X.RDB$MISSING_VALUE, NULL);
|
||||
X.RDB$MISSING_VALUE.NULL = FALSE;
|
||||
@ -3495,10 +3495,10 @@ static void modify_global_field( DUDLEY_FLD field)
|
||||
store_query_header(field->fld_query_header, &X.RDB$QUERY_HEADER);
|
||||
X.RDB$QUERY_HEADER.NULL = FALSE;
|
||||
}
|
||||
END_MODIFY
|
||||
END_MODIFY
|
||||
if_any = true;
|
||||
END_FOR
|
||||
|
||||
END_FOR
|
||||
|
||||
if (!if_any)
|
||||
DDL_err(84, SafeArg() << name->sym_string);
|
||||
/* msg 84: field %s doesn't exist */
|
||||
@ -3521,7 +3521,7 @@ static void modify_index( DUDLEY_IDX index)
|
||||
bool if_any = false;
|
||||
|
||||
FOR X IN RDB$INDICES WITH X.RDB$INDEX_NAME = index->idx_name->sym_string
|
||||
MODIFY X USING
|
||||
MODIFY X USING
|
||||
if (index->idx_flags & IDX_active_flag) {
|
||||
X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE;
|
||||
if (index->idx_flags & IDX_unique_flag)
|
||||
@ -3570,9 +3570,9 @@ static void modify_relation( DUDLEY_REL relation)
|
||||
}
|
||||
SYM name = relation->rel_name;
|
||||
|
||||
FOR FIRST 1 X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name->sym_string
|
||||
MODIFY X USING
|
||||
if (relation->rel_flags & rel_null_security_class)
|
||||
FOR FIRST 1 X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name->sym_string
|
||||
MODIFY X USING
|
||||
if (relation->rel_flags & rel_null_security_class)
|
||||
X.RDB$SECURITY_CLASS.NULL = TRUE;
|
||||
if (relation->rel_security_class) {
|
||||
MOVE_SYMBOL(relation->rel_security_class, X.RDB$SECURITY_CLASS);
|
||||
@ -3589,16 +3589,16 @@ static void modify_relation( DUDLEY_REL relation)
|
||||
X.RDB$SYSTEM_FLAG = relation->rel_system;
|
||||
else
|
||||
X.RDB$SYSTEM_FLAG = 0;
|
||||
|
||||
|
||||
if (relation->rel_filename) {
|
||||
if (X.RDB$EXTERNAL_FILE.NULL)
|
||||
DDL_err(86, SafeArg() << name->sym_string);
|
||||
/* msg 86: relation %s is not external */
|
||||
MOVE_SYMBOL(relation->rel_filename, X.RDB$EXTERNAL_FILE);
|
||||
}
|
||||
END_MODIFY
|
||||
END_MODIFY
|
||||
if_any = true;
|
||||
END_FOR
|
||||
END_FOR
|
||||
|
||||
if (!if_any)
|
||||
DDL_err(87, SafeArg() << name->sym_string);
|
||||
@ -3624,7 +3624,7 @@ static void modify_trigger( DUDLEY_TRG trigger)
|
||||
|
||||
FOR FIRST 1 X IN RDB$TRIGGERS WITH
|
||||
X.RDB$TRIGGER_NAME EQ trigger->trg_name->sym_string
|
||||
MODIFY X USING
|
||||
MODIFY X USING
|
||||
if (relation = trigger->trg_relation) {
|
||||
TEXT* p = buffer;
|
||||
for (const TEXT* q = X.RDB$RELATION_NAME; *q && *q != ' ';)
|
||||
@ -3633,7 +3633,7 @@ static void modify_trigger( DUDLEY_TRG trigger)
|
||||
if (strcmp(relation->rel_name->sym_string, buffer))
|
||||
DDL_err(88, SafeArg() << trigger->trg_name->sym_string);
|
||||
/* msg 88: Invalid attempt to assign trigger %s to a new relation */
|
||||
}
|
||||
}
|
||||
if (trigger->trg_mflag & trg_mflag_onoff)
|
||||
X.RDB$TRIGGER_INACTIVE = trigger->trg_inactive;
|
||||
if (trigger->trg_mflag & trg_mflag_type)
|
||||
@ -3645,12 +3645,12 @@ static void modify_trigger( DUDLEY_TRG trigger)
|
||||
X.RDB$TRIGGER_SOURCE.NULL = FALSE;
|
||||
store_text(trigger->trg_source, &X.RDB$TRIGGER_SOURCE);
|
||||
}
|
||||
|
||||
|
||||
if (trigger->trg_statement) {
|
||||
X.RDB$TRIGGER_BLR.NULL = FALSE;
|
||||
store_blr(trigger->trg_statement, &X.RDB$TRIGGER_BLR, NULL);
|
||||
}
|
||||
|
||||
|
||||
if (trigger->trg_description) {
|
||||
X.RDB$DESCRIPTION.NULL = FALSE;
|
||||
store_text(trigger->trg_description, &X.RDB$DESCRIPTION);
|
||||
@ -3682,7 +3682,7 @@ static void modify_trigger_msg( TRGMSG trigmsg)
|
||||
FOR FIRST 1 X IN RDB$TRIGGER_MESSAGES WITH
|
||||
X.RDB$TRIGGER_NAME EQ trigmsg->trgmsg_trg_name->sym_string AND
|
||||
X.RDB$MESSAGE_NUMBER = trigmsg->trgmsg_number;
|
||||
MODIFY X USING
|
||||
MODIFY X USING
|
||||
MOVE_SYMBOL(trigmsg->trgmsg_text, X.RDB$MESSAGE);
|
||||
END_MODIFY;
|
||||
if_any = true;
|
||||
@ -3710,7 +3710,7 @@ static void modify_type( TYP fldtype)
|
||||
FOR FIRST 1 X IN RDB$TYPES WITH
|
||||
X.RDB$FIELD_NAME EQ fldtype->typ_field_name->sym_string AND
|
||||
X.RDB$TYPE_NAME EQ fldtype->typ_name->sym_string;
|
||||
MODIFY X USING
|
||||
MODIFY X USING
|
||||
X.RDB$TYPE = fldtype->typ_type;
|
||||
if (fldtype->typ_description) {
|
||||
X.RDB$DESCRIPTION.NULL = FALSE;
|
||||
@ -3918,7 +3918,7 @@ static void store_blr( DUDLEY_NOD node, ISC_QUAD* blob_id, DUDLEY_REL relation)
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
FB_API_HANDLE handle;
|
||||
|
||||
blr.str_current = blr.str_start =
|
||||
blr.str_current = blr.str_start =
|
||||
reinterpret_cast<UCHAR*>(gds__alloc(4096));
|
||||
if (!blr.str_current)
|
||||
DDL_error_abort(NULL, 14); /* msg 14: memory exhausted */
|
||||
@ -3987,7 +3987,7 @@ static void store_range( DUDLEY_FLD field)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* s t o r e _ r a n g e
|
||||
* s t o r e _ r a n g e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
@ -4009,7 +4009,7 @@ static void store_range( DUDLEY_FLD field)
|
||||
for (range = field->fld_ranges, n = 0; n < field->fld_dimension;
|
||||
range += 2, ++n)
|
||||
{
|
||||
STORE X IN RDB$FIELD_DIMENSIONS
|
||||
STORE X IN RDB$FIELD_DIMENSIONS
|
||||
strcpy(X.RDB$FIELD_NAME, name);
|
||||
X.RDB$DIMENSION = n;
|
||||
X.RDB$LOWER_BOUND = range[0];
|
||||
@ -4057,7 +4057,7 @@ static void store_userpriv(USERPRIV upriv,
|
||||
*
|
||||
**************************************/
|
||||
|
||||
STORE X IN RDB$USER_PRIVILEGES USING
|
||||
STORE X IN RDB$USER_PRIVILEGES USING
|
||||
X.RDB$FIELD_NAME.NULL = TRUE;
|
||||
|
||||
MOVE_SYMBOL(usr->usre_name, X.RDB$USER);
|
||||
|
@ -110,7 +110,7 @@ enum EXT_flags {
|
||||
EXT_v4 = 256
|
||||
};
|
||||
|
||||
/* table used to determine capabilities, checking for specific
|
||||
/* table used to determine capabilities, checking for specific
|
||||
fields in system relations */
|
||||
|
||||
struct rfr_tab_t {
|
||||
@ -121,7 +121,7 @@ struct rfr_tab_t {
|
||||
|
||||
static const rfr_tab_t rfr_table[] = {
|
||||
{ "RDB$INDICES", "RDB$INDEX_INACTIVE", EXT_idx_inactive },
|
||||
/* Obsolete - 1996-Aug-05 David Schnepper
|
||||
/* Obsolete - 1996-Aug-05 David Schnepper
|
||||
{ "RDB$RELATIONS", "RDB$STORE_TRIGGER", EXT_triggers },
|
||||
*/
|
||||
{ "RDB$RELATIONS", "RDB$EXTERNAL_FILE", EXT_external },
|
||||
@ -161,7 +161,7 @@ void DDL_ext(void)
|
||||
else
|
||||
output_file = stdout;
|
||||
|
||||
if (!(dudleyGlob.DDL_default_user || dudleyGlob.DDL_default_password))
|
||||
if (!(dudleyGlob.DDL_default_user || dudleyGlob.DDL_default_password))
|
||||
{
|
||||
#ifdef TRUSTED_AUTH
|
||||
if (dudleyGlob.DDL_trusted)
|
||||
@ -290,7 +290,7 @@ static void decompile_blr_literal(const SCHAR* string)
|
||||
}
|
||||
|
||||
static const SafeArg dummy;
|
||||
|
||||
|
||||
TEXT* b = buffer;
|
||||
|
||||
switch (*p++) {
|
||||
@ -346,12 +346,12 @@ static void extract_acls(void)
|
||||
const TEXT* relname;
|
||||
|
||||
bool first = true;
|
||||
|
||||
FOR S IN RDB$SECURITY_CLASSES
|
||||
|
||||
FOR S IN RDB$SECURITY_CLASSES
|
||||
if (first) {
|
||||
put_comment(251); /* msg 251: \n\n\tSecurity Class Definitions / GRANT statements\t */
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
USHORT count = 0;
|
||||
|
||||
/* if there's any rdb$user_privileges entry then we can use GRANT statement */
|
||||
@ -426,7 +426,7 @@ static void extract_computed(const TEXT * relation_name, bool first)
|
||||
* Check on the way by that we're not
|
||||
* trying to expand a computed field
|
||||
* that's been copied whole into a
|
||||
* view. Meaning that if there is a
|
||||
* view. Meaning that if there is a
|
||||
* view context, skip this field
|
||||
*
|
||||
**************************************/
|
||||
@ -436,14 +436,14 @@ static void extract_computed(const TEXT * relation_name, bool first)
|
||||
WITH RFR.RDB$RELATION_NAME = relation_name
|
||||
AND F.RDB$FIELD_NAME = RFR.RDB$FIELD_SOURCE
|
||||
AND F.RDB$COMPUTED_BLR NOT MISSING
|
||||
SORTED BY RFR.RDB$FIELD_POSITION
|
||||
SORTED BY RFR.RDB$FIELD_POSITION
|
||||
|
||||
if (RFR.RDB$VIEW_CONTEXT)
|
||||
if (RFR.RDB$VIEW_CONTEXT)
|
||||
continue;
|
||||
|
||||
|
||||
if (!first)
|
||||
fprintf(output_file, ",\n");
|
||||
|
||||
|
||||
first = false;
|
||||
name_trunc(RFR.RDB$FIELD_NAME, s);
|
||||
if (F.RDB$COMPUTED_SOURCE.NULL) {
|
||||
@ -451,7 +451,7 @@ static void extract_computed(const TEXT * relation_name, bool first)
|
||||
continue;
|
||||
}
|
||||
fprintf(output_file, " %s", s);
|
||||
|
||||
|
||||
strcpy(s, F.RDB$FIELD_NAME);
|
||||
if (EXT_capabilities & EXT_v3) {
|
||||
FOR FNDA IN RDB$FIELDS WITH FNDA.RDB$FIELD_NAME = s
|
||||
@ -468,7 +468,7 @@ static void extract_computed(const TEXT * relation_name, bool first)
|
||||
END_FOR;
|
||||
}
|
||||
fprintf(output_file, " computed by (");
|
||||
|
||||
|
||||
print_blob(&F.RDB$COMPUTED_SOURCE, 'u');
|
||||
fprintf(output_file, ")");
|
||||
if (!RFR.RDB$FIELD_POSITION.NULL)
|
||||
@ -476,7 +476,7 @@ static void extract_computed(const TEXT * relation_name, bool first)
|
||||
field_attributes(&RFR.RDB$DESCRIPTION, RFR.RDB$QUERY_NAME,
|
||||
&RFR.RDB$QUERY_HEADER, RFR.RDB$EDIT_STRING,
|
||||
RFR.RDB$SYSTEM_FLAG);
|
||||
|
||||
|
||||
END_FOR;
|
||||
}
|
||||
|
||||
@ -502,12 +502,12 @@ static void extract_database(const TEXT * DB_file_nameL)
|
||||
fprintf(output_file, "define database \"%s\"", DB_file_nameL);
|
||||
|
||||
if (EXT_capabilities & EXT_security) {
|
||||
FOR D IN RDB$DATABASE
|
||||
FOR D IN RDB$DATABASE
|
||||
if (!blob_null(D.RDB$DESCRIPTION)) {
|
||||
fprintf(output_file, "\n\t{");
|
||||
print_blob(&D.RDB$DESCRIPTION, 'u');
|
||||
fprintf(output_file, "}");
|
||||
}
|
||||
}
|
||||
if (!D.RDB$SECURITY_CLASS.NULL) {
|
||||
name_trunc(D.RDB$SECURITY_CLASS, s);
|
||||
if (*s)
|
||||
@ -516,17 +516,17 @@ static void extract_database(const TEXT * DB_file_nameL)
|
||||
END_FOR;
|
||||
}
|
||||
else if (EXT_capabilities & EXT_db_description)
|
||||
FOR D IN RDB$DATABASE
|
||||
FOR D IN RDB$DATABASE
|
||||
if (!blob_null(D.RDB$DESCRIPTION)) {
|
||||
fprintf(output_file, "\n\t{");
|
||||
print_blob(&D.RDB$DESCRIPTION, 'u');
|
||||
fprintf(output_file, "}");
|
||||
}
|
||||
}
|
||||
END_FOR;
|
||||
|
||||
if (isc_database_info(status_vector, &DB, sizeof(db_items),
|
||||
db_items, sizeof(buffer), buffer)) {
|
||||
put_error(254, 0);
|
||||
put_error(254, 0);
|
||||
/* msg 254: ***isc_database_info failed*** */
|
||||
gds__print_status(status_vector);
|
||||
}
|
||||
@ -539,12 +539,12 @@ static void extract_database(const TEXT * DB_file_nameL)
|
||||
if (page_size)
|
||||
fprintf(output_file, "\n\tpage_size %"SLONGFORMAT, page_size);
|
||||
}
|
||||
|
||||
|
||||
if (EXT_capabilities & EXT_files)
|
||||
{
|
||||
if (EXT_capabilities & EXT_v3) {
|
||||
FOR F IN RDB$FILES WITH F.RDB$SHADOW_NUMBER MISSING OR
|
||||
F.RDB$SHADOW_NUMBER EQ 0
|
||||
FOR F IN RDB$FILES WITH F.RDB$SHADOW_NUMBER MISSING OR
|
||||
F.RDB$SHADOW_NUMBER EQ 0
|
||||
name_trunc(F.RDB$FILE_NAME, buffer);
|
||||
fprintf(output_file, "\n\tfile \"%s\" starting at page %ld",
|
||||
buffer, F.RDB$FILE_START);
|
||||
@ -571,11 +571,11 @@ static void extract_database(const TEXT * DB_file_nameL)
|
||||
FOR F IN RDB$LOG_FILES
|
||||
if (F.RDB$FILE_FLAGS & LOG_overflow)
|
||||
continue;
|
||||
|
||||
|
||||
if (first_time) {
|
||||
first_time = false;
|
||||
fprintf(output_file, "\n\tlogfile");
|
||||
|
||||
|
||||
if (F.RDB$FILE_FLAGS & LOG_default)
|
||||
break;
|
||||
else if (F.RDB$FILE_FLAGS & LOG_serial)
|
||||
@ -584,21 +584,21 @@ static void extract_database(const TEXT * DB_file_nameL)
|
||||
need_close = true;
|
||||
fprintf(output_file, "\n\t\t(");
|
||||
}
|
||||
|
||||
|
||||
fprintf(output_file, "\n\t\t\"%s\"", F.RDB$FILE_NAME);
|
||||
}
|
||||
else
|
||||
fprintf(output_file, ",\n\t\t\"%s\"", F.RDB$FILE_NAME);
|
||||
|
||||
|
||||
if (F.RDB$FILE_LENGTH)
|
||||
fprintf(output_file, " size = %ld", F.RDB$FILE_LENGTH);
|
||||
|
||||
|
||||
if (F.RDB$FILE_PARTITIONS)
|
||||
fprintf(output_file, " partitions = %d",
|
||||
F.RDB$FILE_PARTITIONS);
|
||||
if (F.RDB$FILE_FLAGS & LOG_raw)
|
||||
fprintf(output_file, " raw");
|
||||
|
||||
|
||||
END_FOR;
|
||||
|
||||
if (need_close)
|
||||
@ -607,13 +607,13 @@ static void extract_database(const TEXT * DB_file_nameL)
|
||||
FOR F IN RDB$LOG_FILES
|
||||
if (!(F.RDB$FILE_FLAGS & LOG_overflow))
|
||||
continue;
|
||||
|
||||
|
||||
fprintf(output_file, "\n\toverflow");
|
||||
fprintf(output_file, " \"%s\"", F.RDB$FILE_NAME);
|
||||
|
||||
|
||||
if (F.RDB$FILE_LENGTH)
|
||||
fprintf(output_file, " size = %ld", F.RDB$FILE_LENGTH);
|
||||
|
||||
|
||||
if (F.RDB$FILE_PARTITIONS)
|
||||
fprintf(output_file, " partitions = %d",
|
||||
F.RDB$FILE_PARTITIONS);
|
||||
@ -688,12 +688,12 @@ static void extract_fields(void)
|
||||
bool first = true;
|
||||
FOR F IN RDB$FIELDS WITH
|
||||
(F.RDB$SYSTEM_FLAG NE 1 OR F.RDB$SYSTEM_FLAG MISSING) AND
|
||||
F.RDB$COMPUTED_BLR MISSING SORTED BY F.RDB$FIELD_NAME
|
||||
F.RDB$COMPUTED_BLR MISSING SORTED BY F.RDB$FIELD_NAME
|
||||
|
||||
if (first) {
|
||||
put_comment(255); /*msg 255: \n\n\tGlobal Field Definitions\t */
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
name_trunc(F.RDB$FIELD_NAME, s);
|
||||
fprintf(output_file, "define field %s", s);
|
||||
if (F.RDB$FIELD_TYPE == blr_blob) {
|
||||
@ -734,30 +734,30 @@ static void extract_fields(void)
|
||||
FNDA.RDB$FIELD_SUB_TYPE, 0, NULL);
|
||||
END_FOR;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!blob_null(F.RDB$VALIDATION_SOURCE)) {
|
||||
fprintf(output_file, "\n\tvalid if (");
|
||||
print_blob(&F.RDB$VALIDATION_SOURCE, 'u');
|
||||
fprintf(output_file, ")");
|
||||
}
|
||||
|
||||
|
||||
if (!blob_null(F.RDB$MISSING_VALUE)) {
|
||||
fprintf(output_file, "\n\tmissing_value is ");
|
||||
print_blob(&F.RDB$MISSING_VALUE, 'm');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if (!blob_null (F.RDB$DEFAULT_VALUE))
|
||||
default_value (&F.RDB$DEFAULT_VALUE);
|
||||
*/
|
||||
|
||||
|
||||
field_attributes(&F.RDB$DESCRIPTION, F.RDB$QUERY_NAME,
|
||||
&F.RDB$QUERY_HEADER, F.RDB$EDIT_STRING,
|
||||
F.RDB$SYSTEM_FLAG);
|
||||
fprintf(output_file, ";\n");
|
||||
|
||||
|
||||
END_FOR;
|
||||
}
|
||||
|
||||
@ -766,7 +766,7 @@ static void extract_filters(void)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e x t r a c t _ f i l t e r s
|
||||
* e x t r a c t _ f i l t e r s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
@ -870,7 +870,7 @@ static void extract_func_args(const TEXT * function_name)
|
||||
p = ",";
|
||||
first = false;
|
||||
}
|
||||
|
||||
|
||||
fprintf(output_file, "\t\t");
|
||||
if (FARG.RDB$FIELD_TYPE == blr_blob)
|
||||
fprintf(output_file, " blob");
|
||||
@ -886,7 +886,7 @@ static void extract_func_args(const TEXT * function_name)
|
||||
fprintf(output_file, "reference");
|
||||
else if (FARG.RDB$MECHANISM == FUNCARG_mechanism_sc_array_desc)
|
||||
fprintf(output_file, "scalar_array_descriptor");
|
||||
|
||||
|
||||
FOR FUNC IN RDB$FUNCTIONS
|
||||
WITH FUNC.RDB$FUNCTION_NAME = function_name
|
||||
if (FARG.RDB$ARGUMENT_POSITION == FUNC.RDB$RETURN_ARGUMENT) {
|
||||
@ -894,9 +894,9 @@ static void extract_func_args(const TEXT * function_name)
|
||||
fprintf(output_file, " return_argument");
|
||||
else
|
||||
fprintf(output_file, " return_value");
|
||||
}
|
||||
}
|
||||
END_FOR;
|
||||
|
||||
|
||||
END_FOR;
|
||||
}
|
||||
|
||||
@ -916,16 +916,16 @@ static void extract_generators(void)
|
||||
TEXT s[32];
|
||||
|
||||
bool first = true;
|
||||
|
||||
|
||||
FOR G IN RDB$GENERATORS WITH
|
||||
(G.RDB$SYSTEM_FLAG NE 1 OR G.RDB$SYSTEM_FLAG MISSING)
|
||||
SORTED BY G.RDB$GENERATOR_NAME
|
||||
SORTED BY G.RDB$GENERATOR_NAME
|
||||
if (first) {
|
||||
put_comment(290); /* msg 290: \n\n\tGenerator Definitions\t */
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
name_trunc(G.RDB$GENERATOR_NAME, s);
|
||||
fprintf(output_file, "\ndefine generator %s;", s);
|
||||
fprintf(output_file, "\ndefine generator %s;", s);
|
||||
END_FOR;
|
||||
}
|
||||
|
||||
@ -949,36 +949,36 @@ static void extract_grants(const TEXT * relname)
|
||||
if (EXT_capabilities & EXT_v4) {
|
||||
FOR U IN RDB$USER_PRIVILEGES WITH U.RDB$RELATION_NAME EQ relname
|
||||
AND U.RDB$OBJECT_TYPE EQ obj_relation
|
||||
SORTED BY U.RDB$USER, U.RDB$PRIVILEGE
|
||||
SORTED BY U.RDB$USER, U.RDB$PRIVILEGE
|
||||
|
||||
switch (U.RDB$PRIVILEGE[0]) {
|
||||
case 'S':
|
||||
user_priv = "SELECT";
|
||||
break;
|
||||
|
||||
|
||||
case 'U':
|
||||
user_priv = "UPDATE";
|
||||
break;
|
||||
|
||||
|
||||
case 'D':
|
||||
user_priv = "DELETE";
|
||||
break;
|
||||
|
||||
|
||||
case 'I':
|
||||
user_priv = "INSERT";
|
||||
break;
|
||||
|
||||
|
||||
case 'R':
|
||||
/* None of the interfaces knows about the references privilege.
|
||||
Ignore it for now. */
|
||||
|
||||
|
||||
continue;
|
||||
|
||||
|
||||
default:
|
||||
user_priv = "**unknown**";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
fprintf(output_file, "\ngrant %s ", user_priv);
|
||||
if (!U.RDB$FIELD_NAME.NULL) {
|
||||
name_trunc(U.RDB$FIELD_NAME, field_name);
|
||||
@ -990,7 +990,7 @@ static void extract_grants(const TEXT * relname)
|
||||
if (U.RDB$GRANT_OPTION)
|
||||
fprintf(output_file, " with grant option");
|
||||
fprintf(output_file, ";\n");
|
||||
|
||||
|
||||
END_FOR;
|
||||
}
|
||||
else {
|
||||
@ -999,30 +999,30 @@ static void extract_grants(const TEXT * relname)
|
||||
case 'S':
|
||||
user_priv = "SELECT";
|
||||
break;
|
||||
|
||||
|
||||
case 'U':
|
||||
user_priv = "UPDATE";
|
||||
break;
|
||||
|
||||
|
||||
case 'D':
|
||||
user_priv = "DELETE";
|
||||
break;
|
||||
|
||||
|
||||
case 'I':
|
||||
user_priv = "INSERT";
|
||||
break;
|
||||
|
||||
|
||||
case 'R':
|
||||
/* None of the interfaces knows about the references privilege.
|
||||
Ignore it for now. */
|
||||
|
||||
|
||||
continue;
|
||||
|
||||
|
||||
default:
|
||||
user_priv = "**unknown**";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
fprintf(output_file, "\ngrant %s ", user_priv);
|
||||
if (!U.RDB$FIELD_NAME.NULL) {
|
||||
name_trunc(U.RDB$FIELD_NAME, field_name);
|
||||
@ -1034,7 +1034,7 @@ static void extract_grants(const TEXT * relname)
|
||||
if (U.RDB$GRANT_OPTION)
|
||||
fprintf(output_file, " with grant option");
|
||||
fprintf(output_file, ";\n");
|
||||
|
||||
|
||||
END_FOR;
|
||||
}
|
||||
}
|
||||
@ -1062,11 +1062,11 @@ static void extract_indexes(void)
|
||||
FOR I IN RDB$INDICES CROSS R IN RDB$RELATIONS
|
||||
OVER RDB$RELATION_NAME
|
||||
WITH(R.RDB$SYSTEM_FLAG NE 1 OR R.RDB$SYSTEM_FLAG MISSING)
|
||||
SORTED BY I.RDB$RELATION_NAME, I.RDB$INDEX_NAME
|
||||
SORTED BY I.RDB$RELATION_NAME, I.RDB$INDEX_NAME
|
||||
if (first) {
|
||||
put_comment(291); /* msg 291: \n\n\tIndex Definitions\t */
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
if (!I.RDB$UNIQUE_FLAG.NULL && I.RDB$UNIQUE_FLAG == 1)
|
||||
p = "unique";
|
||||
else
|
||||
@ -1075,37 +1075,37 @@ static void extract_indexes(void)
|
||||
name_trunc(I.RDB$RELATION_NAME, relation);
|
||||
fprintf(output_file, "\ndefine index %s for %s %s",
|
||||
index, relation, p);
|
||||
|
||||
|
||||
if (!blob_null(I.RDB$DESCRIPTION)) {
|
||||
fprintf(output_file, "\n\t{");
|
||||
print_blob(&I.RDB$DESCRIPTION, 'u');
|
||||
fprintf(output_file, "}");
|
||||
}
|
||||
|
||||
|
||||
if (EXT_capabilities & EXT_idx_inactive)
|
||||
FOR ACT IN RDB$INDICES WITH ACT.RDB$INDEX_NAME = index
|
||||
if (ACT.RDB$INDEX_INACTIVE)
|
||||
if (ACT.RDB$INDEX_INACTIVE)
|
||||
fprintf(output_file, "\ninactive");
|
||||
END_FOR;
|
||||
|
||||
|
||||
if (EXT_capabilities & EXT_v3)
|
||||
FOR ACT IN RDB$INDICES WITH ACT.RDB$INDEX_NAME = index
|
||||
if (ACT.RDB$INDEX_TYPE)
|
||||
fprintf(output_file, "\ndescending");
|
||||
END_FOR;
|
||||
|
||||
|
||||
|
||||
|
||||
p = "";
|
||||
|
||||
|
||||
FOR I_S IN RDB$INDEX_SEGMENTS WITH
|
||||
I_S.RDB$INDEX_NAME = I.RDB$INDEX_NAME
|
||||
SORTED BY I_S.RDB$FIELD_POSITION
|
||||
name_trunc(I_S.RDB$FIELD_NAME, field);
|
||||
fprintf(output_file, "%s\n\t%s", p, field);
|
||||
p = ",";
|
||||
|
||||
|
||||
END_FOR;
|
||||
|
||||
|
||||
fprintf(output_file, ";\n");
|
||||
END_FOR;
|
||||
}
|
||||
@ -1131,17 +1131,17 @@ static void extract_relations(void)
|
||||
if (EXT_capabilities & EXT_external) {
|
||||
FOR R IN RDB$RELATIONS WITH
|
||||
(R.RDB$SYSTEM_FLAG NE 1 OR R.RDB$SYSTEM_FLAG MISSING) AND
|
||||
R.RDB$VIEW_BLR MISSING SORTED BY R.RDB$RELATION_NAME
|
||||
R.RDB$VIEW_BLR MISSING SORTED BY R.RDB$RELATION_NAME
|
||||
if (first) {
|
||||
put_comment(258); /* msg 258: \n\n\tRelation Definitions\t */
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
name_trunc(R.RDB$RELATION_NAME, s);
|
||||
fprintf(output_file, "\ndefine relation %s", s);
|
||||
|
||||
|
||||
if (!R.RDB$EXTERNAL_FILE.NULL && name_trunc(R.RDB$EXTERNAL_FILE, s))
|
||||
fprintf(output_file, "\n\texternal_file \"%s\"", s);
|
||||
|
||||
|
||||
if (R.RDB$SYSTEM_FLAG)
|
||||
fprintf(output_file, "\n\tsystem_flag %d", R.RDB$SYSTEM_FLAG);
|
||||
if (!blob_null(R.RDB$DESCRIPTION)) {
|
||||
@ -1156,14 +1156,14 @@ static void extract_relations(void)
|
||||
else {
|
||||
FOR R IN RDB$RELATIONS WITH
|
||||
(R.RDB$SYSTEM_FLAG NE 1 OR R.RDB$SYSTEM_FLAG MISSING) AND
|
||||
R.RDB$VIEW_BLR MISSING SORTED BY R.RDB$RELATION_NAME
|
||||
R.RDB$VIEW_BLR MISSING SORTED BY R.RDB$RELATION_NAME
|
||||
if (first) {
|
||||
put_comment(258); /* msg 258: \n\n\tRelation Definitions\t */
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
name_trunc(R.RDB$RELATION_NAME, s);
|
||||
fprintf(output_file, "\ndefine relation %s", s);
|
||||
|
||||
|
||||
if (R.RDB$SYSTEM_FLAG)
|
||||
fprintf(output_file, "\n\tsystem_flag %d", R.RDB$SYSTEM_FLAG);
|
||||
if (!blob_null(R.RDB$DESCRIPTION)) {
|
||||
@ -1201,24 +1201,24 @@ static void extract_rfr(const TEXT * relation_name)
|
||||
WITH RFR.RDB$RELATION_NAME = relation_name
|
||||
AND F.RDB$FIELD_NAME = RFR.RDB$FIELD_SOURCE
|
||||
AND F.RDB$COMPUTED_BLR MISSING
|
||||
SORTED BY RFR.RDB$FIELD_POSITION
|
||||
SORTED BY RFR.RDB$FIELD_POSITION
|
||||
|
||||
fprintf(output_file, "%s\n", p);
|
||||
if (first) {
|
||||
p = ",";
|
||||
first = false;
|
||||
}
|
||||
|
||||
|
||||
name_trunc(RFR.RDB$FIELD_NAME, s);
|
||||
fprintf(output_file, " %s", s);
|
||||
if (strcmp(RFR.RDB$FIELD_NAME, RFR.RDB$FIELD_SOURCE)) {
|
||||
name_trunc(RFR.RDB$FIELD_SOURCE, s);
|
||||
fprintf(output_file, " based on %s", s);
|
||||
}
|
||||
|
||||
|
||||
if (!RFR.RDB$FIELD_POSITION.NULL)
|
||||
fprintf(output_file, "\tposition %d", RFR.RDB$FIELD_POSITION);
|
||||
|
||||
|
||||
field_attributes(&RFR.RDB$DESCRIPTION, RFR.RDB$QUERY_NAME,
|
||||
&RFR.RDB$QUERY_HEADER, RFR.RDB$EDIT_STRING,
|
||||
RFR.RDB$SYSTEM_FLAG);
|
||||
@ -1232,7 +1232,7 @@ static void extract_security(void)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* e x t r a c t _ s e c u r i t y
|
||||
* e x t r a c t _ s e c u r i t y
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
@ -1245,7 +1245,7 @@ static void extract_security(void)
|
||||
|
||||
bool first = true;
|
||||
|
||||
FOR R IN RDB$RELATIONS
|
||||
FOR R IN RDB$RELATIONS
|
||||
bool first_field = true;
|
||||
bool modify = false;
|
||||
name_trunc(R.RDB$RELATION_NAME, r);
|
||||
@ -1260,7 +1260,7 @@ static void extract_security(void)
|
||||
/* extract if security_class is 'SQL$..' but relation_name doesn't match
|
||||
'SQL$relation_name' */
|
||||
/* extract if security_class doesn't start with 'SQL$' */
|
||||
|
||||
|
||||
if (EXT_capabilities & EXT_v3) {
|
||||
if (strncmp(R.RDB$SECURITY_CLASS, "SQL$", 4) == 0) {
|
||||
int count = 0;
|
||||
@ -1278,17 +1278,17 @@ static void extract_security(void)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (first) {
|
||||
put_comment(259); /* msg 259: \n\tAdd Security Classes to Defined Objects\t\n */
|
||||
first = false;
|
||||
}
|
||||
|
||||
|
||||
fprintf(output_file, "\nmodify %s %s\n\tsecurity_class %s", p, r,
|
||||
s);
|
||||
modify = true;
|
||||
}
|
||||
|
||||
|
||||
FOR RFR IN RDB$RELATION_FIELDS
|
||||
WITH RFR.RDB$RELATION_NAME EQ R.RDB$RELATION_NAME AND
|
||||
RFR.RDB$SECURITY_CLASS NOT MISSING
|
||||
@ -1337,48 +1337,48 @@ static void extract_triggers(void)
|
||||
|
||||
FOR T IN RDB$TRIGGERS WITH
|
||||
(T.RDB$SYSTEM_FLAG NE 1 OR T.RDB$SYSTEM_FLAG MISSING)
|
||||
SORTED BY T.RDB$TRIGGER_NAME
|
||||
SORTED BY T.RDB$TRIGGER_NAME
|
||||
if (first) {
|
||||
put_comment(260); /* msg 260: \n\n\tTrigger Definitions\t */
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
name_trunc(T.RDB$TRIGGER_NAME, st);
|
||||
fprintf(output_file, "\n\ndefine trigger %s", st);
|
||||
name_trunc(T.RDB$RELATION_NAME, s);
|
||||
fprintf(output_file, " for %s\n", s);
|
||||
|
||||
|
||||
if (T.RDB$TRIGGER_INACTIVE)
|
||||
fprintf(output_file, "\tinactive\n");
|
||||
|
||||
|
||||
switch (T.RDB$TRIGGER_TYPE) {
|
||||
case (SSHORT) trg_store:
|
||||
fprintf(output_file, "\tpre store");
|
||||
break;
|
||||
|
||||
|
||||
case (SSHORT) trg_post_store:
|
||||
fprintf(output_file, "\tpost store");
|
||||
break;
|
||||
|
||||
|
||||
case (SSHORT) trg_modify:
|
||||
fprintf(output_file, "\tpre modify");
|
||||
break;
|
||||
|
||||
|
||||
case (SSHORT) trg_post_modify:
|
||||
fprintf(output_file, "\tpost modify");
|
||||
break;
|
||||
|
||||
|
||||
case (SSHORT) trg_pre_erase:
|
||||
fprintf(output_file, "\tpre erase");
|
||||
break;
|
||||
|
||||
|
||||
case (SSHORT) trg_erase:
|
||||
fprintf(output_file, "\tpost erase");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
put_comment(261); /* msg 261: ***** trigger type not understood **** */
|
||||
}
|
||||
|
||||
|
||||
fprintf(output_file, " %d:\n", T.RDB$TRIGGER_SEQUENCE);
|
||||
if (T.RDB$TRIGGER_SOURCE.NULL) {
|
||||
put_error(262, st);
|
||||
@ -1394,7 +1394,7 @@ static void extract_triggers(void)
|
||||
fprintf(output_file, "}");
|
||||
}
|
||||
extract_trig_msgs(T.RDB$TRIGGER_NAME);
|
||||
|
||||
|
||||
fprintf(output_file, ";");
|
||||
END_FOR;
|
||||
}
|
||||
@ -1436,7 +1436,7 @@ static void extract_trig_msgs(const TEXT * trigger_name)
|
||||
fprintf(output_file, " %c%s%c", quote_char, TM.RDB$MESSAGE,
|
||||
quote_char);
|
||||
END_FOR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void extract_view(const TEXT * rel_name,
|
||||
@ -1519,7 +1519,7 @@ static void extract_views(void)
|
||||
extract_view(V.RDB$RELATION_NAME, &V.RDB$VIEW_SOURCE,
|
||||
&V.RDB$DESCRIPTION, source_null, desc_null,
|
||||
(V.RDB$SYSTEM_FLAG), &first);
|
||||
|
||||
|
||||
END_FOR;
|
||||
return;
|
||||
}
|
||||
@ -1581,7 +1581,7 @@ static void extract_views(void)
|
||||
extract_view(V.RDB$RELATION_NAME, &V.RDB$VIEW_SOURCE,
|
||||
&V.RDB$DESCRIPTION, source_null, desc_null,
|
||||
(V.RDB$SYSTEM_FLAG), &first);
|
||||
|
||||
|
||||
END_FOR;
|
||||
did_any = true;
|
||||
*view_ptr = (*view_ptr)->view_next;
|
||||
@ -1591,7 +1591,7 @@ static void extract_views(void)
|
||||
}
|
||||
} while (did_any);
|
||||
|
||||
// If any views remain, we can't figure out an order so just dump them
|
||||
// If any views remain, we can't figure out an order so just dump them
|
||||
|
||||
for (view* viewp = view_list; viewp; viewp = viewp->view_next) {
|
||||
FOR V IN RDB$RELATIONS WITH
|
||||
@ -1601,7 +1601,7 @@ static void extract_views(void)
|
||||
extract_view(V.RDB$RELATION_NAME, &V.RDB$VIEW_SOURCE,
|
||||
&V.RDB$DESCRIPTION, source_null, desc_null,
|
||||
(V.RDB$SYSTEM_FLAG), &first);
|
||||
|
||||
|
||||
END_FOR;
|
||||
}
|
||||
}
|
||||
@ -1740,7 +1740,7 @@ static void format_acl(const SCHAR * string)
|
||||
p += l;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
Here we try to decompose the identifier. Views are easy, they're just views.
|
||||
If its not a view, it may be a user/group pair or just the user or just the group.
|
||||
Those are operating system dependant. Otherwise, its an Apollo identifier.
|
||||
@ -1806,7 +1806,7 @@ static void print_blob(ISC_QUAD* blob_id, TEXT type)
|
||||
* unspecified, "m" for missing values
|
||||
* to decode, "h" meaning query
|
||||
* headers that need formatting and "a"
|
||||
* for acls.
|
||||
* for acls.
|
||||
*
|
||||
**************************************/
|
||||
TEXT buffer[4096];
|
||||
@ -1908,7 +1908,7 @@ static void put_comment(USHORT number)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Retrieve a message from the error file,
|
||||
* Retrieve a message from the error file,
|
||||
* format it, and print it in the output file
|
||||
* but not on the screen
|
||||
*
|
||||
@ -1930,7 +1930,7 @@ static void put_error(USHORT number, const TEXT* arg1)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Retrieve a message from the error file,
|
||||
* Retrieve a message from the error file,
|
||||
* format it, and print it in the output file
|
||||
* and on the screen
|
||||
*
|
||||
@ -2048,9 +2048,9 @@ static void type_scalar(USHORT dtype,
|
||||
|
||||
if (dim) {
|
||||
TEXT c = '(';
|
||||
FOR D IN RDB$FIELD_DIMENSIONS WITH
|
||||
D.RDB$FIELD_NAME EQ field_name
|
||||
SORTED BY D.RDB$DIMENSION
|
||||
FOR D IN RDB$FIELD_DIMENSIONS WITH
|
||||
D.RDB$FIELD_NAME EQ field_name
|
||||
SORTED BY D.RDB$DIMENSION
|
||||
if (D.RDB$LOWER_BOUND == 1)
|
||||
fprintf(output_file, "%c%ld", c, D.RDB$UPPER_BOUND);
|
||||
else
|
||||
@ -2099,7 +2099,7 @@ static void view_fields(const TEXT * view_name)
|
||||
AND RFR.RDB$VIEW_CONTEXT != 0 AND
|
||||
VR.RDB$VIEW_NAME = RFR.RDB$RELATION_NAME AND
|
||||
VR.RDB$VIEW_CONTEXT = RFR.RDB$VIEW_CONTEXT
|
||||
SORTED BY RFR.RDB$FIELD_POSITION
|
||||
SORTED BY RFR.RDB$FIELD_POSITION
|
||||
if (!first)
|
||||
fprintf(output_file, ",\n");
|
||||
else
|
||||
@ -2119,11 +2119,11 @@ static void view_fields(const TEXT * view_name)
|
||||
}
|
||||
if (!RFR.RDB$FIELD_POSITION.NULL)
|
||||
fprintf(output_file, "\tposition %d", RFR.RDB$FIELD_POSITION);
|
||||
|
||||
|
||||
field_attributes(&RFR.RDB$DESCRIPTION, RFR.RDB$QUERY_NAME,
|
||||
&RFR.RDB$QUERY_HEADER, RFR.RDB$EDIT_STRING,
|
||||
RFR.RDB$SYSTEM_FLAG);
|
||||
}
|
||||
}
|
||||
END_FOR;
|
||||
|
||||
extract_computed(view_name, first);
|
||||
|
@ -1,28 +1,28 @@
|
||||
/*
|
||||
* tab=4
|
||||
*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* PROGRAM: C preprocessor
|
||||
* MODULE: gpre_meta.epp
|
||||
* DESCRIPTION: Meta data interface to system
|
||||
*
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.Inprise.com/IPL.html
|
||||
*
|
||||
*
|
||||
* Software distributed under the License is distributed on an
|
||||
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*
|
||||
* The Original Code was created by Inprise Corporation
|
||||
* and its predecessors. Portions created by Inprise Corporation are
|
||||
* Copyright (C) Inprise Corporation.
|
||||
*
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
*
|
||||
*
|
||||
*____________________________________________________________
|
||||
*
|
||||
@ -83,10 +83,10 @@ static int upcase(const TEXT*, TEXT* const);
|
||||
#endif
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup a field by name in a context.
|
||||
* If found, return field block. If not, return NULL.
|
||||
*/
|
||||
*/
|
||||
|
||||
gpre_fld* MET_context_field( gpre_ctx* context, const char* string)
|
||||
{
|
||||
@ -120,10 +120,10 @@ gpre_fld* MET_context_field( gpre_ctx* context, const char* string)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Initialize meta data access to database. If the
|
||||
* database can't be opened, return false.
|
||||
*/
|
||||
*/
|
||||
|
||||
bool MET_database(dbb* database, bool print_version)
|
||||
{
|
||||
@ -134,8 +134,8 @@ bool MET_database(dbb* database, bool print_version)
|
||||
isc_info_db_sql_dialect,
|
||||
isc_info_end
|
||||
};
|
||||
/*
|
||||
** Each info item requested will return
|
||||
/*
|
||||
** Each info item requested will return
|
||||
**
|
||||
** 1 byte for the info item tag
|
||||
** 2 bytes for the length of the information that follows
|
||||
@ -158,8 +158,8 @@ bool MET_database(dbb* database, bool print_version)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* generate a dpb for the attach from the specified
|
||||
* compiletime user name and password
|
||||
/* generate a dpb for the attach from the specified
|
||||
* compiletime user name and password
|
||||
*/
|
||||
|
||||
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
|
||||
@ -177,14 +177,14 @@ bool MET_database(dbb* database, bool print_version)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (isc_attach_database(gds_status, 0, database->dbb_filename, &DB,
|
||||
dpb.getBufferLength(),
|
||||
if (isc_attach_database(gds_status, 0, database->dbb_filename, &DB,
|
||||
dpb.getBufferLength(),
|
||||
reinterpret_cast<const char*>(dpb.getBuffer())))
|
||||
{
|
||||
/* We failed to attach, try in read only mode just in case
|
||||
/* We failed to attach, try in read only mode just in case
|
||||
dpb.insertByte(isc_dpb_set_db_readonly, true);
|
||||
if (isc_attach_database(gds_status, 0, database->dbb_filename, &DB,
|
||||
dpb.getBufferLength(),
|
||||
if (isc_attach_database(gds_status, 0, database->dbb_filename, &DB,
|
||||
dpb.getBufferLength(),
|
||||
reinterpret_cast<const char*>(dpb.getBuffer()))) {
|
||||
*/
|
||||
isc_print_status(gds_status);
|
||||
@ -214,7 +214,7 @@ bool MET_database(dbb* database, bool print_version)
|
||||
const UCHAR item = *ptr++;
|
||||
const USHORT length = isc_vax_integer((char*)ptr, sizeof(USHORT));
|
||||
ptr += sizeof(USHORT);
|
||||
|
||||
|
||||
switch (item) {
|
||||
case isc_info_base_level:
|
||||
gpreGlob.sw_server_version = (USHORT) ptr[1];
|
||||
@ -227,7 +227,7 @@ bool MET_database(dbb* database, bool print_version)
|
||||
case isc_info_db_sql_dialect:
|
||||
gpreGlob.compiletime_db_dialect = isc_vax_integer((char*)ptr, length);
|
||||
break;
|
||||
|
||||
|
||||
case isc_info_error:
|
||||
/* Error indicates that one of the option
|
||||
was not understood by thr server. Make sure it was
|
||||
@ -240,7 +240,7 @@ bool MET_database(dbb* database, bool print_version)
|
||||
printf("Internal error: Unexpected isc_info_value %d\n",
|
||||
item);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
printf("Internal error: Unexpected isc_info_value %d\n", item);
|
||||
break;
|
||||
@ -281,7 +281,7 @@ bool MET_database(dbb* database, bool print_version)
|
||||
|
||||
SCHAR buffer[16];
|
||||
|
||||
// get the base level of the engine
|
||||
// get the base level of the engine
|
||||
|
||||
if (isc_database_info(gds_status, &DB, sizeof(db_version_info),
|
||||
db_version_info, sizeof(buffer), buffer))
|
||||
@ -290,9 +290,9 @@ bool MET_database(dbb* database, bool print_version)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* this seems like a lot of rigamarole to read one info item,
|
||||
* but it provides for easy extensibility in case we need
|
||||
* more info items later
|
||||
/* this seems like a lot of rigamarole to read one info item,
|
||||
* but it provides for easy extensibility in case we need
|
||||
* more info items later
|
||||
*/
|
||||
|
||||
const SCHAR* data = buffer;
|
||||
@ -302,19 +302,19 @@ bool MET_database(dbb* database, bool print_version)
|
||||
data += sizeof(USHORT);
|
||||
|
||||
switch (item) {
|
||||
/* This flag indicates the version level of the engine
|
||||
itself, so we can tell what capabilities the engine
|
||||
/* This flag indicates the version level of the engine
|
||||
itself, so we can tell what capabilities the engine
|
||||
code itself (as opposed to the on-disk structure).
|
||||
Apparently the base level up to now indicated the major
|
||||
version number, but for 4.1 the base level is being
|
||||
incremented, so the base level indicates an engine version
|
||||
Apparently the base level up to now indicated the major
|
||||
version number, but for 4.1 the base level is being
|
||||
incremented, so the base level indicates an engine version
|
||||
as follows:
|
||||
1 == v1.x
|
||||
2 == v2.x
|
||||
3 == v3.x
|
||||
4 == v4.0 only
|
||||
5 == v4.1
|
||||
Note: this info item is so old it apparently uses an
|
||||
Note: this info item is so old it apparently uses an
|
||||
archaic format, not a standard vax integer format.
|
||||
*/
|
||||
|
||||
@ -335,10 +335,10 @@ bool MET_database(dbb* database, bool print_version)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup a domain by name.
|
||||
* Initialize the size of the field.
|
||||
*/
|
||||
*/
|
||||
|
||||
bool MET_domain_lookup(gpre_req* request, gpre_fld* field, const char* string)
|
||||
{
|
||||
@ -416,7 +416,7 @@ bool MET_domain_lookup(gpre_req* request, gpre_fld* field, const char* string)
|
||||
}
|
||||
else {
|
||||
FOR(REQUEST_HANDLE database->dbb_domain_request)
|
||||
F IN RDB$FIELDS WITH F.RDB$FIELD_NAME EQ name
|
||||
F IN RDB$FIELDS WITH F.RDB$FIELD_NAME EQ name
|
||||
found = true;
|
||||
field->fld_length = F.RDB$FIELD_LENGTH;
|
||||
field->fld_scale = F.RDB$FIELD_SCALE;
|
||||
@ -447,9 +447,9 @@ bool MET_domain_lookup(gpre_req* request, gpre_fld* field, const char* string)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Gets the default value for a domain of an existing table
|
||||
*/
|
||||
*/
|
||||
|
||||
bool MET_get_domain_default(dbb* database,
|
||||
const TEXT* domain_name,
|
||||
@ -477,7 +477,7 @@ bool MET_get_domain_default(dbb* database,
|
||||
if (!GLOB_FLD.RDB$DEFAULT_VALUE.NULL) {
|
||||
ISC_QUAD* blob_id = &GLOB_FLD.RDB$DEFAULT_VALUE;
|
||||
|
||||
// open the blob
|
||||
// open the blob
|
||||
isc_blob_handle blob_handle = 0;
|
||||
ISC_STATUS stat = isc_open_blob2(status_vect, &DB, &gds_trans,
|
||||
&blob_handle, blob_id, sizeof(blr_bpb),
|
||||
@ -486,7 +486,7 @@ bool MET_get_domain_default(dbb* database,
|
||||
isc_print_status(status_vect);
|
||||
CPR_exit(FINI_ERROR);
|
||||
}
|
||||
// fetch segments. Assume buffer is big enough.
|
||||
// fetch segments. Assume buffer is big enough.
|
||||
TEXT* ptr_in_buffer = buffer;
|
||||
while (true)
|
||||
{
|
||||
@ -499,7 +499,7 @@ bool MET_get_domain_default(dbb* database,
|
||||
if (!stat)
|
||||
continue;
|
||||
if (stat == isc_segstr_eof) {
|
||||
// null terminate the buffer
|
||||
// null terminate the buffer
|
||||
*ptr_in_buffer = 0;
|
||||
break;
|
||||
}
|
||||
@ -517,7 +517,7 @@ bool MET_get_domain_default(dbb* database,
|
||||
|
||||
has_default = true;
|
||||
}
|
||||
else { // default not found
|
||||
else { // default not found
|
||||
|
||||
if (gpreGlob.sw_sql_dialect > SQL_DIALECT_V5)
|
||||
buffer[0] = blr_version5;
|
||||
@ -532,16 +532,16 @@ bool MET_get_domain_default(dbb* database,
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Gets the default value for a column of an existing table.
|
||||
* Will check the default for the column of the table, if that is
|
||||
* not present, will check for the default of the relevant domain
|
||||
*
|
||||
*
|
||||
* The default blr is returned in buffer. The blr is of the form
|
||||
* blr_version4 blr_literal ..... blr_eoc
|
||||
*
|
||||
*
|
||||
* Reads the system tables RDB$FIELDS and RDB$RELATION_FIELDS.
|
||||
*/
|
||||
*/
|
||||
|
||||
bool MET_get_column_default(const gpre_rel* relation,
|
||||
const TEXT* column_name,
|
||||
@ -570,7 +570,7 @@ bool MET_get_column_default(const gpre_rel* relation,
|
||||
RFR.RDB$FIELD_SOURCE EQ F.RDB$FIELD_NAME AND
|
||||
RFR.RDB$FIELD_NAME EQ name AND
|
||||
RFR.RDB$RELATION_NAME EQ relation->rel_symbol->sym_string
|
||||
|
||||
|
||||
ISC_QUAD* blob_id;
|
||||
if (!RFR.RDB$DEFAULT_VALUE.NULL) {
|
||||
blob_id = &RFR.RDB$DEFAULT_VALUE;
|
||||
@ -585,7 +585,7 @@ bool MET_get_column_default(const gpre_rel* relation,
|
||||
}
|
||||
|
||||
if (has_default) {
|
||||
// open the blob
|
||||
// open the blob
|
||||
isc_blob_handle blob_handle = 0;
|
||||
ISC_STATUS stat = isc_open_blob2(status_vect, &DB, &gds_trans,
|
||||
&blob_handle, blob_id, sizeof(blr_bpb),
|
||||
@ -595,7 +595,7 @@ bool MET_get_column_default(const gpre_rel* relation,
|
||||
CPR_exit(FINI_ERROR);
|
||||
}
|
||||
|
||||
// fetch segments. Assuming here that the buffer is big enough.
|
||||
// fetch segments. Assuming here that the buffer is big enough.
|
||||
TEXT* ptr_in_buffer = buffer;
|
||||
while (true)
|
||||
{
|
||||
@ -607,7 +607,7 @@ bool MET_get_column_default(const gpre_rel* relation,
|
||||
if (!stat)
|
||||
continue;
|
||||
if (stat == isc_segstr_eof) {
|
||||
// null terminate the buffer
|
||||
// null terminate the buffer
|
||||
*ptr_in_buffer = 0;
|
||||
break;
|
||||
}
|
||||
@ -639,11 +639,11 @@ bool MET_get_column_default(const gpre_rel* relation,
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup the fields for the primary key
|
||||
* index on a relation, returning a list
|
||||
* of the fields.
|
||||
*/
|
||||
*/
|
||||
|
||||
gpre_lls* MET_get_primary_key(dbb* database, const TEXT* relation_name)
|
||||
{
|
||||
@ -673,7 +673,7 @@ gpre_lls* MET_get_primary_key(dbb* database, const TEXT* relation_name)
|
||||
WITH Z.RDB$RELATION_NAME EQ name
|
||||
AND Z.RDB$CONSTRAINT_TYPE EQ "PRIMARY KEY"
|
||||
SORTED BY Y.RDB$FIELD_POSITION
|
||||
|
||||
|
||||
str* field_name = (str*) MSC_string(Y.RDB$FIELD_NAME);
|
||||
// Strip off any trailing spaces from field name
|
||||
// CVC: This code stops at the first space, even in the middle.
|
||||
@ -693,10 +693,10 @@ gpre_lls* MET_get_primary_key(dbb* database, const TEXT* relation_name)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup a field by name in a relation.
|
||||
* If found, return field block. If not, return NULL.
|
||||
*/
|
||||
*/
|
||||
|
||||
gpre_fld* MET_field(gpre_rel* relation, const char* string)
|
||||
{
|
||||
@ -844,9 +844,9 @@ gpre_fld* MET_field(gpre_rel* relation, const char* string)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Return a list of the fields in a relation
|
||||
*/
|
||||
*/
|
||||
|
||||
GPRE_NOD MET_fields(gpre_ctx* context)
|
||||
{
|
||||
@ -927,9 +927,9 @@ GPRE_NOD MET_fields(gpre_ctx* context)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Shutdown all attached databases.
|
||||
*/
|
||||
*/
|
||||
|
||||
void MET_fini(dbb* end)
|
||||
{
|
||||
@ -966,10 +966,10 @@ void MET_fini(dbb* end)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup a generator by name.
|
||||
* If found, return string. If not, return NULL.
|
||||
*/
|
||||
*/
|
||||
|
||||
const SCHAR* MET_generator(const TEXT* string, dbb* database)
|
||||
{
|
||||
@ -987,9 +987,9 @@ const SCHAR* MET_generator(const TEXT* string, dbb* database)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Compute internal datatype and length based on system relation field values.
|
||||
*/
|
||||
*/
|
||||
|
||||
USHORT MET_get_dtype(USHORT blr_dtype, USHORT sub_type, USHORT* length)
|
||||
{
|
||||
@ -1076,12 +1076,12 @@ USHORT MET_get_dtype(USHORT blr_dtype, USHORT sub_type, USHORT* length)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup a procedure (represented by a token) in a database.
|
||||
* Return a procedure block (if name is found) or NULL.
|
||||
*
|
||||
*
|
||||
* This function has been cloned into MET_get_udf
|
||||
*/
|
||||
*/
|
||||
|
||||
gpre_prc* MET_get_procedure(dbb* database, const TEXT* string, const TEXT* owner_name)
|
||||
{
|
||||
@ -1095,7 +1095,7 @@ gpre_prc* MET_get_procedure(dbb* database, const TEXT* string, const TEXT* owner
|
||||
procedure->prc_database == database &&
|
||||
(!owner[0] ||
|
||||
(procedure->prc_owner
|
||||
&& !strcmp(owner, procedure->prc_owner->sym_string))))
|
||||
&& !strcmp(owner, procedure->prc_owner->sym_string))))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -1191,10 +1191,10 @@ gpre_prc* MET_get_procedure(dbb* database, const TEXT* string, const TEXT* owner
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup a relation (represented by a token) in a database.
|
||||
* Return a relation block (if name is found) or NULL.
|
||||
*/
|
||||
*/
|
||||
|
||||
gpre_rel* MET_get_relation(dbb* database, const TEXT* string, const TEXT* owner_name)
|
||||
{
|
||||
@ -1217,8 +1217,8 @@ gpre_rel* MET_get_relation(dbb* database, const TEXT* string, const TEXT* owner_
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
|
||||
INTLSYM MET_get_text_subtype(SSHORT ttype)
|
||||
{
|
||||
@ -1231,17 +1231,17 @@ INTLSYM MET_get_text_subtype(SSHORT ttype)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup a udf (represented by a token) in a database.
|
||||
* Return a udf block (if name is found) or NULL.
|
||||
*
|
||||
*
|
||||
* This function was cloned from MET_get_procedure
|
||||
*/
|
||||
*/
|
||||
|
||||
udf* MET_get_udf(dbb* database, const TEXT* string)
|
||||
{
|
||||
MetIdentifier name(string);
|
||||
|
||||
|
||||
udf* the_udf = NULL;
|
||||
for (gpre_sym* symbol = HSH_lookup(name); symbol; symbol = symbol->sym_homonym)
|
||||
{
|
||||
@ -1259,7 +1259,7 @@ udf* MET_get_udf(dbb* database, const TEXT* string)
|
||||
return the_udf;
|
||||
|
||||
if (database->dbb_flags & DBB_v3) {
|
||||
// Version of V4 request without new V4 metadata
|
||||
// Version of V4 request without new V4 metadata
|
||||
FOR(REQUEST_HANDLE database->dbb_udf_request)
|
||||
UDF_DEF IN RDB$FUNCTIONS CROSS
|
||||
UDF_ARG IN RDB$FUNCTION_ARGUMENTS
|
||||
@ -1293,7 +1293,7 @@ udf* MET_get_udf(dbb* database, const TEXT* string)
|
||||
END_FOR;
|
||||
}
|
||||
else {
|
||||
// Same request as above, but with V4 metadata also fetched
|
||||
// Same request as above, but with V4 metadata also fetched
|
||||
FOR(REQUEST_HANDLE database->dbb_udf_request)
|
||||
UDF_DEF IN RDB$FUNCTIONS CROSS
|
||||
UDF_ARG IN RDB$FUNCTION_ARGUMENTS
|
||||
@ -1340,15 +1340,15 @@ udf* MET_get_udf(dbb* database, const TEXT* string)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
* Return relation if the passed view_name represents a
|
||||
* view with the passed relation as a base table
|
||||
*
|
||||
* Return relation if the passed view_name represents a
|
||||
* view with the passed relation as a base table
|
||||
* (the relation could be an alias).
|
||||
*/
|
||||
*/
|
||||
|
||||
gpre_rel* MET_get_view_relation(gpre_req* request,
|
||||
const char* view_name,
|
||||
const char* relation_or_alias,
|
||||
const char* relation_or_alias,
|
||||
USHORT level)
|
||||
{
|
||||
dbb* database = request->req_database;
|
||||
@ -1374,7 +1374,7 @@ gpre_rel* MET_get_view_relation(gpre_req* request,
|
||||
return MET_get_relation(database, X.RDB$RELATION_NAME, "");
|
||||
}
|
||||
|
||||
if (relation = MET_get_view_relation(request, X.RDB$RELATION_NAME,
|
||||
if (relation = MET_get_view_relation(request, X.RDB$RELATION_NAME,
|
||||
relation_or_alias, level + 1))
|
||||
{
|
||||
return relation;
|
||||
@ -1387,10 +1387,10 @@ gpre_rel* MET_get_view_relation(gpre_req* request,
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup an index for a database.
|
||||
* Return an index block (if name is found) or NULL.
|
||||
*/
|
||||
*/
|
||||
|
||||
IND MET_index(dbb* database, const TEXT* string)
|
||||
{
|
||||
@ -1431,12 +1431,12 @@ IND MET_index(dbb* database, const TEXT* string)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Load all of the relation names, procedure names
|
||||
* and user defined function names
|
||||
* into the symbol (hash) table.
|
||||
* Includes also charsets and collations.
|
||||
*/
|
||||
*/
|
||||
|
||||
void MET_load_hash_table(dbb* database)
|
||||
{
|
||||
@ -1454,7 +1454,7 @@ void MET_load_hash_table(dbb* database)
|
||||
}
|
||||
|
||||
if (database->dbb_transaction) {
|
||||
// we must have already loaded this one
|
||||
// we must have already loaded this one
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1465,13 +1465,13 @@ void MET_load_hash_table(dbb* database)
|
||||
|
||||
database->dbb_transaction = gds_trans;
|
||||
|
||||
// Determine if the database is V3.
|
||||
// Determine if the database is V3.
|
||||
|
||||
bool post_v3_flag = false;
|
||||
FB_API_HANDLE handle = 0;
|
||||
FOR(REQUEST_HANDLE handle)
|
||||
X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME = 'RDB$PROCEDURES' AND
|
||||
X.RDB$SYSTEM_FLAG = 1
|
||||
X.RDB$SYSTEM_FLAG = 1
|
||||
post_v3_flag = true;
|
||||
|
||||
END_FOR;
|
||||
@ -1555,7 +1555,7 @@ void MET_load_hash_table(dbb* database)
|
||||
MSC_symbol(SYM_username, X.RDB$OWNER_NAME, length, NULL);
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
// assume pre V4 database, no procedures
|
||||
// assume pre V4 database, no procedures
|
||||
END_ERROR;
|
||||
|
||||
if (handle)
|
||||
@ -1625,7 +1625,7 @@ void MET_load_hash_table(dbb* database)
|
||||
/* Pick up all Collation names, might have several collations
|
||||
* for a given character set.
|
||||
* There can also be several alias names for a character set.
|
||||
*/
|
||||
*/
|
||||
|
||||
FOR(REQUEST_HANDLE handle)
|
||||
CHARSET IN RDB$CHARACTER_SETS CROSS COLL IN RDB$COLLATIONS OVER
|
||||
@ -1670,7 +1670,7 @@ void MET_load_hash_table(dbb* database)
|
||||
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
// assume pre V4 database, no collations
|
||||
// assume pre V4 database, no collations
|
||||
END_ERROR;
|
||||
|
||||
isc_release_request(gds_status, &handle);
|
||||
@ -1679,7 +1679,7 @@ void MET_load_hash_table(dbb* database)
|
||||
|
||||
/* Now pick up all character set names - with the subtype set to
|
||||
* the type of the default collation for the character set.
|
||||
*/
|
||||
*/
|
||||
FOR(REQUEST_HANDLE handle)
|
||||
CHARSET IN RDB$CHARACTER_SETS CROSS COLL IN RDB$COLLATIONS
|
||||
WITH CHARSET.RDB$DEFAULT_COLLATE_NAME EQ COLL.RDB$COLLATION_NAME;
|
||||
@ -1721,14 +1721,14 @@ void MET_load_hash_table(dbb* database)
|
||||
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
// assume pre V4 database, no character sets
|
||||
// assume pre V4 database, no character sets
|
||||
END_ERROR;
|
||||
|
||||
isc_release_request(gds_status, &handle);
|
||||
if (handle2)
|
||||
isc_release_request(gds_status, &handle2);
|
||||
|
||||
// Pick up name of database default character set for SQL
|
||||
// Pick up name of database default character set for SQL
|
||||
|
||||
FOR(REQUEST_HANDLE handle)
|
||||
FIRST 1 DBB IN RDB$DATABASE
|
||||
@ -1743,12 +1743,12 @@ void MET_load_hash_table(dbb* database)
|
||||
CPR_warn("Default character set for database is not known");
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
// Assume V3 Db, no default charset
|
||||
// Assume V3 Db, no default charset
|
||||
END_ERROR;
|
||||
|
||||
isc_release_request(gds_status, &handle);
|
||||
|
||||
// Pick up all generators for the database
|
||||
// Pick up all generators for the database
|
||||
|
||||
FOR(REQUEST_HANDLE handle)
|
||||
X IN RDB$GENERATORS
|
||||
@ -1756,7 +1756,7 @@ void MET_load_hash_table(dbb* database)
|
||||
fb_utils::name_length(X.RDB$GENERATOR_NAME), (gpre_ctx*) database);
|
||||
HSH_insert(symbol);
|
||||
|
||||
END_FOR
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
// Nothing
|
||||
END_ERROR;
|
||||
@ -1765,7 +1765,7 @@ void MET_load_hash_table(dbb* database)
|
||||
|
||||
/* now that we have attached to the database, resolve the character set
|
||||
* request (if any) (and if we can)
|
||||
*/
|
||||
*/
|
||||
|
||||
if (database->dbb_c_lc_ctype) {
|
||||
if (get_intl_char_subtype
|
||||
@ -1788,9 +1788,9 @@ void MET_load_hash_table(dbb* database)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Make a field symbol.
|
||||
*/
|
||||
*/
|
||||
|
||||
gpre_fld* MET_make_field(const SCHAR* name,
|
||||
SSHORT dtype,
|
||||
@ -1810,9 +1810,9 @@ gpre_fld* MET_make_field(const SCHAR* name,
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Make an index symbol.
|
||||
*/
|
||||
*/
|
||||
|
||||
IND MET_make_index(const SCHAR* name)
|
||||
{
|
||||
@ -1824,9 +1824,9 @@ IND MET_make_index(const SCHAR* name)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Make an relation symbol.
|
||||
*/
|
||||
*/
|
||||
|
||||
gpre_rel* MET_make_relation(const SCHAR* name)
|
||||
{
|
||||
@ -1839,9 +1839,9 @@ gpre_rel* MET_make_relation(const SCHAR* name)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup a type name for a field.
|
||||
*/
|
||||
*/
|
||||
|
||||
bool MET_type(gpre_fld* field,
|
||||
const TEXT* string,
|
||||
@ -1865,7 +1865,7 @@ bool MET_type(gpre_fld* field,
|
||||
DB = database->dbb_handle;
|
||||
gds_trans = database->dbb_transaction;
|
||||
|
||||
// Force the name to uppercase, using C locale rules for uppercasing
|
||||
// Force the name to uppercase, using C locale rules for uppercasing
|
||||
UCHAR* p;
|
||||
for (p = buffer; *string && p < &buffer[sizeof(buffer) - 1];
|
||||
++p, ++string)
|
||||
@ -1894,12 +1894,12 @@ bool MET_type(gpre_fld* field,
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Lookup an index for a database.
|
||||
*
|
||||
*
|
||||
* Return: true if the trigger exists
|
||||
* false otherwise
|
||||
*/
|
||||
*/
|
||||
|
||||
bool MET_trigger_exists(dbb* database,
|
||||
const TEXT* trigger_name)
|
||||
@ -1910,7 +1910,7 @@ bool MET_trigger_exists(dbb* database,
|
||||
gds_trans = database->dbb_transaction;
|
||||
|
||||
FOR(REQUEST_HANDLE database->dbb_trigger_request)
|
||||
TRIG IN RDB$TRIGGERS WITH TRIG.RDB$TRIGGER_NAME EQ name
|
||||
TRIG IN RDB$TRIGGERS WITH TRIG.RDB$TRIGGER_NAME EQ name
|
||||
return true;
|
||||
END_FOR;
|
||||
|
||||
@ -1919,9 +1919,9 @@ bool MET_trigger_exists(dbb* database,
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Compute and return the size of the array.
|
||||
*/
|
||||
*/
|
||||
|
||||
static SLONG array_size( gpre_fld* field)
|
||||
{
|
||||
@ -1939,9 +1939,9 @@ static SLONG array_size( gpre_fld* field)
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* See if field is array.
|
||||
*/
|
||||
*/
|
||||
|
||||
static void get_array(dbb* database, const TEXT* field_name, gpre_fld* field)
|
||||
{
|
||||
@ -1969,7 +1969,7 @@ static void get_array(dbb* database, const TEXT* field_name, gpre_fld* field)
|
||||
field->fld_array_info = array_block = (ary*) MSC_alloc(ARY_LEN);
|
||||
//(ary*) MSC_alloc(ARY_LEN(F.RDB$DIMENSIONS));
|
||||
array_block->ary_dtype = sub_field->fld_dtype;
|
||||
}
|
||||
}
|
||||
END_FOR
|
||||
ON_ERROR {
|
||||
database->dbb_flags |= DBB_no_arrays;
|
||||
@ -2006,29 +2006,29 @@ static void get_array(dbb* database, const TEXT* field_name, gpre_fld* field)
|
||||
// it happened in the past due to buggy DYN code.
|
||||
fb_assert(last_dimension_block);
|
||||
fb_assert(dimension_counter == field_dimensions);
|
||||
|
||||
|
||||
array_block->ary_dimension_count = last_dimension_block->dim_number + 1;
|
||||
array_block->ary_size = array_size(field);
|
||||
}
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Character types can be specified as either:
|
||||
* b) A POSIX style locale name "<collation>.<characterset>"
|
||||
* or
|
||||
* c) A simple <characterset> name (using default collation)
|
||||
* d) A simple <collation> name (use charset for collation)
|
||||
*
|
||||
*
|
||||
* Given an ASCII7 string which could be any of the above, try to
|
||||
* resolve the name in the order b, c, d.
|
||||
* b) is only tried iff the name contains a period.
|
||||
* (in which case c) and d) are not tried).
|
||||
*
|
||||
*
|
||||
* Return:
|
||||
* true if no errors (and *id is set).
|
||||
* false if the name could not be resolved.
|
||||
*/
|
||||
*/
|
||||
|
||||
static bool get_intl_char_subtype(
|
||||
SSHORT* id,
|
||||
@ -2047,14 +2047,14 @@ static bool get_intl_char_subtype(
|
||||
gds_trans = database->dbb_transaction;
|
||||
|
||||
const UCHAR* const end_name = name + length;
|
||||
/* Force key to uppercase, following C locale rules for uppercasing
|
||||
/* Force key to uppercase, following C locale rules for uppercasing
|
||||
* At the same time, search for the first period in the string (if any)
|
||||
*/
|
||||
UCHAR* period = NULL;
|
||||
UCHAR* p;
|
||||
for (p = buffer;
|
||||
name < end_name && p < (buffer + sizeof(buffer) - 1);
|
||||
p++, name++)
|
||||
p++, name++)
|
||||
{
|
||||
*p = UPPER7(*name);
|
||||
if ((*p == '.') && !period)
|
||||
@ -2079,35 +2079,35 @@ static bool get_intl_char_subtype(
|
||||
|
||||
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Given ASCII7 name of charset & collation
|
||||
* resolve the specification to a ttype (id) that implements
|
||||
* it.
|
||||
*
|
||||
*
|
||||
* Inputs:
|
||||
* (charset)
|
||||
* (charset)
|
||||
* ASCII7z name of characterset.
|
||||
* NULL (implying unspecified) means use the character set
|
||||
* for defined for (collation).
|
||||
*
|
||||
*
|
||||
* (collation)
|
||||
* ASCII7z name of collation.
|
||||
* NULL means use the default collation for (charset).
|
||||
*
|
||||
*
|
||||
* Outputs:
|
||||
* (*id)
|
||||
* (*id)
|
||||
* Set to subtype specified by this name.
|
||||
*
|
||||
*
|
||||
* Return:
|
||||
* true if no errors (and *id is set).
|
||||
* false if either name not found.
|
||||
* or if names found, but the collation isn't for the specified
|
||||
* character set.
|
||||
*/
|
||||
*/
|
||||
|
||||
static bool resolve_charset_and_collation(
|
||||
SSHORT* id,
|
||||
const UCHAR* charset,
|
||||
const UCHAR* charset,
|
||||
const UCHAR* collation)
|
||||
{
|
||||
fb_assert(id != NULL);
|
||||
@ -2117,7 +2117,7 @@ static bool resolve_charset_and_collation(
|
||||
|
||||
bool found = false;
|
||||
FB_API_HANDLE request = 0;
|
||||
|
||||
|
||||
if (collation == NULL) {
|
||||
if (charset == NULL) {
|
||||
FOR(REQUEST_HANDLE request)
|
||||
@ -2129,7 +2129,7 @@ static bool resolve_charset_and_collation(
|
||||
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
// Assume V3 DB, without default character set
|
||||
// Assume V3 DB, without default character set
|
||||
END_ERROR;
|
||||
|
||||
isc_release_request(gds_status, &request);
|
||||
@ -2204,7 +2204,7 @@ static bool resolve_charset_and_collation(
|
||||
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
/*____________________________________________________________
|
||||
*
|
||||
*
|
||||
* Upcase a string into another string. Return
|
||||
* length of string.
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h> // isdigit
|
||||
#include <ctype.h> // isdigit
|
||||
#include "../jrd/common.h"
|
||||
#include "../jrd/constants.h"
|
||||
#include "../jrd/ibase.h"
|
||||
@ -336,7 +336,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
END_ERROR;
|
||||
}
|
||||
|
||||
// Query to obtain relation detail information
|
||||
// Query to obtain relation detail information
|
||||
|
||||
FOR REL IN RDB$RELATIONS CROSS
|
||||
RFR IN RDB$RELATION_FIELDS CROSS
|
||||
@ -352,7 +352,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
// Do we need to print domains
|
||||
// Do we need to print domains
|
||||
if (domain_flag)
|
||||
list_domain_table (relation_name, default_char_set_id);
|
||||
|
||||
@ -362,7 +362,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
relation_name,
|
||||
REL.RDB$OWNER_NAME,
|
||||
NEWLINE);
|
||||
|
||||
|
||||
if (rel_type == rel_global_temp_preserve ||
|
||||
rel_type == rel_global_temp_delete)
|
||||
{
|
||||
@ -372,7 +372,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
{
|
||||
isqlGlob.printf("CREATE TABLE ");
|
||||
}
|
||||
|
||||
|
||||
if (isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION)
|
||||
{
|
||||
if (new_name)
|
||||
@ -381,11 +381,11 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
ISQL_copy_SQL_id (relation_name, SQL_identifier, DBL_QUOTE);
|
||||
isqlGlob.printf("%s ", SQL_identifier);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
isqlGlob.printf("%s ", new_name ? new_name : relation_name);
|
||||
}
|
||||
|
||||
|
||||
if (!REL.RDB$EXTERNAL_FILE.NULL)
|
||||
{
|
||||
ISQL_copy_SQL_id (REL.RDB$EXTERNAL_FILE, SQL_identifier2,
|
||||
@ -447,7 +447,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
}
|
||||
else
|
||||
{
|
||||
// Look through types array
|
||||
// Look through types array
|
||||
for (int i = 0; Column_types[i].type; i++)
|
||||
{
|
||||
if (FLD.RDB$FIELD_TYPE == Column_types[i].type)
|
||||
@ -456,7 +456,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
|
||||
if (isqlGlob.major_ods >= ODS_VERSION10)
|
||||
{
|
||||
// Handle Integral subtypes NUMERIC and DECIMAL
|
||||
// Handle Integral subtypes NUMERIC and DECIMAL
|
||||
if ((FLD.RDB$FIELD_TYPE == SMALLINT) ||
|
||||
(FLD.RDB$FIELD_TYPE == INTEGER) ||
|
||||
(FLD.RDB$FIELD_TYPE == BIGINT))
|
||||
@ -489,7 +489,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
if (!precision_known)
|
||||
{
|
||||
|
||||
// Take a stab at numerics and decimals
|
||||
// Take a stab at numerics and decimals
|
||||
if ((FLD.RDB$FIELD_TYPE == SMALLINT) &&
|
||||
(FLD.RDB$FIELD_SCALE < 0))
|
||||
{
|
||||
@ -530,7 +530,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
}
|
||||
}
|
||||
|
||||
// Catch arrays after printing the type
|
||||
// Catch arrays after printing the type
|
||||
|
||||
if (!FLD.RDB$DIMENSIONS.NULL)
|
||||
ISQL_array_dimensions (FLD.RDB$FIELD_NAME);
|
||||
@ -549,14 +549,14 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
(USHORT) FLD.RDB$SEGMENT_LENGTH);
|
||||
}
|
||||
|
||||
// International character sets
|
||||
// International character sets
|
||||
if ((FLD.RDB$FIELD_TYPE == T_CHAR || FLD.RDB$FIELD_TYPE == VARCHAR ||
|
||||
FLD.RDB$FIELD_TYPE == BLOB) &&
|
||||
!FLD.RDB$CHARACTER_SET_ID.NULL)
|
||||
{
|
||||
char_sets[0] = '\0';
|
||||
|
||||
// Override rdb$fields id with relation_fields if present
|
||||
// Override rdb$fields id with relation_fields if present
|
||||
|
||||
if (!RFR.RDB$COLLATION_ID.NULL)
|
||||
collation = RFR.RDB$COLLATION_ID;
|
||||
@ -577,7 +577,7 @@ int EXTRACT_list_table(const SCHAR* relation_name,
|
||||
}
|
||||
|
||||
|
||||
// Handle defaults for columns
|
||||
// Handle defaults for columns
|
||||
|
||||
if (!RFR.RDB$DEFAULT_SOURCE.NULL)
|
||||
{
|
||||
@ -711,7 +711,7 @@ static bool extract_rel_constraints(const char* relation_name)
|
||||
isqlGlob.printf("PRIMARY KEY (%s)", collist);
|
||||
else //if (!strncmp (RELC.RDB$CONSTRAINT_TYPE, "UNIQUE", 6)) // redundant
|
||||
isqlGlob.printf("UNIQUE (%s)", collist);
|
||||
|
||||
|
||||
// Yes, the same RDB$... naming convention is used for both domains and indices.
|
||||
const bool explicit_index = (isPK && !fb_utils::implicit_pk(IDX.RDB$INDEX_NAME) ||
|
||||
!isPK && !fb_utils::implicit_domain(IDX.RDB$INDEX_NAME)) &&
|
||||
@ -734,7 +734,7 @@ static bool extract_rel_constraints(const char* relation_name)
|
||||
ISQL_errmsg(gds_status);
|
||||
return false;
|
||||
END_ERROR;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -754,7 +754,7 @@ static void get_procedure_args(const char* proc_name)
|
||||
**************************************/
|
||||
SCHAR char_sets[86];
|
||||
|
||||
// query to retrieve the parameters.
|
||||
// query to retrieve the parameters.
|
||||
|
||||
|
||||
/* placed the two identical code blocks into one
|
||||
@ -762,8 +762,8 @@ static void get_procedure_args(const char* proc_name)
|
||||
FSG 18.Nov.2000
|
||||
*/
|
||||
|
||||
// Parameter types 0 = input
|
||||
// Parameter types 1 = return
|
||||
// Parameter types 0 = input
|
||||
// Parameter types 1 = return
|
||||
|
||||
for (SSHORT ptype = 0; ptype < 2; ptype++)
|
||||
{
|
||||
@ -804,7 +804,7 @@ static void get_procedure_args(const char* proc_name)
|
||||
|
||||
if (!PRM2.RDB$PARAMETER_MECHANISM.NULL)
|
||||
prm_mech = (prm_mech_t) PRM2.RDB$PARAMETER_MECHANISM;
|
||||
END_FOR
|
||||
END_FOR
|
||||
}
|
||||
|
||||
char relationName[BUFFER_LENGTH128] = "";
|
||||
@ -834,18 +834,18 @@ static void get_procedure_args(const char* proc_name)
|
||||
strcpy(relationField, PRM2.RDB$FIELD_NAME);
|
||||
}
|
||||
|
||||
END_FOR
|
||||
END_FOR
|
||||
}
|
||||
|
||||
if (first_time)
|
||||
{
|
||||
first_time = false;
|
||||
if (ptype == 0)
|
||||
{ // this is the input part
|
||||
{ // this is the input part
|
||||
isqlGlob.printf("(");
|
||||
}
|
||||
else
|
||||
{ // we are in the output part
|
||||
{ // we are in the output part
|
||||
isqlGlob.printf("RETURNS (");
|
||||
}
|
||||
}
|
||||
@ -856,7 +856,7 @@ static void get_procedure_args(const char* proc_name)
|
||||
|
||||
fb_utils::exact_name(PRM.RDB$PARAMETER_NAME);
|
||||
|
||||
// CVC: Parameter names need check for dialect 3, too.
|
||||
// CVC: Parameter names need check for dialect 3, too.
|
||||
|
||||
if (isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION)
|
||||
ISQL_copy_SQL_id (PRM.RDB$PARAMETER_NAME, SQL_identifier, DBL_QUOTE);
|
||||
@ -908,7 +908,7 @@ static void get_procedure_args(const char* proc_name)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get column type name to print
|
||||
// Get column type name to print
|
||||
for (int i = 0; Column_types[i].type; i++)
|
||||
{
|
||||
if (FLD.RDB$FIELD_TYPE == Column_types[i].type)
|
||||
@ -917,7 +917,7 @@ static void get_procedure_args(const char* proc_name)
|
||||
|
||||
if (isqlGlob.major_ods >= ODS_VERSION10)
|
||||
{
|
||||
// Handle Integral subtypes NUMERIC and DECIMAL
|
||||
// Handle Integral subtypes NUMERIC and DECIMAL
|
||||
if ((FLD.RDB$FIELD_TYPE == SMALLINT) ||
|
||||
(FLD.RDB$FIELD_TYPE == INTEGER) ||
|
||||
(FLD.RDB$FIELD_TYPE == BIGINT))
|
||||
@ -949,7 +949,7 @@ static void get_procedure_args(const char* proc_name)
|
||||
}
|
||||
if (!precision_known)
|
||||
{
|
||||
// Take a stab at numerics and decimals
|
||||
// Take a stab at numerics and decimals
|
||||
if ((FLD.RDB$FIELD_TYPE == SMALLINT) &&
|
||||
(FLD.RDB$FIELD_SCALE < 0))
|
||||
{
|
||||
@ -996,7 +996,7 @@ static void get_procedure_args(const char* proc_name)
|
||||
}
|
||||
}
|
||||
|
||||
// Show international character sets and collations
|
||||
// Show international character sets and collations
|
||||
if (!FLD.RDB$COLLATION_ID.NULL || !FLD.RDB$CHARACTER_SET_ID.NULL)
|
||||
{
|
||||
char_sets[0] = 0;
|
||||
@ -1040,14 +1040,14 @@ static void get_procedure_args(const char* proc_name)
|
||||
return;
|
||||
END_ERROR;
|
||||
|
||||
// If there was at least one param, close parens
|
||||
// If there was at least one param, close parens
|
||||
|
||||
if (!first_time)
|
||||
{
|
||||
isqlGlob.printf(")%s", NEWLINE);
|
||||
}
|
||||
|
||||
} // end for ptype
|
||||
} // end for ptype
|
||||
isqlGlob.printf("AS %s", NEWLINE);
|
||||
}
|
||||
|
||||
@ -1087,7 +1087,7 @@ static processing_state list_all_grants2(bool show_role_list,
|
||||
**************************************/
|
||||
bool first_role = true;
|
||||
TEXT prev_owner[44];
|
||||
|
||||
|
||||
// Only extract (not show) wants the role list and with escaped quoted identifiers.
|
||||
const bool mangle = show_role_list;
|
||||
|
||||
@ -1100,14 +1100,14 @@ static processing_state list_all_grants2(bool show_role_list,
|
||||
SORTED BY XX.RDB$ROLE_NAME
|
||||
|
||||
bool system_flag = false;
|
||||
if (isqlGlob.major_ods >= ODS_VERSION11)
|
||||
if (isqlGlob.major_ods >= ODS_VERSION11)
|
||||
{
|
||||
FOR SF IN RDB$ROLES
|
||||
WITH SF.RDB$ROLE_NAME = XX.RDB$ROLE_NAME
|
||||
WITH SF.RDB$ROLE_NAME = XX.RDB$ROLE_NAME
|
||||
AND SF.RDB$SYSTEM_FLAG > 0
|
||||
|
||||
|
||||
system_flag = true;
|
||||
|
||||
|
||||
END_FOR
|
||||
}
|
||||
|
||||
@ -1156,7 +1156,7 @@ static processing_state list_all_grants2(bool show_role_list,
|
||||
|
||||
// This version of cursor gets only sql tables identified by security class
|
||||
// and misses views, getting only null view_source
|
||||
|
||||
|
||||
char banner[100];
|
||||
sprintf(banner, "%s/* Grant permissions for this database */%s",
|
||||
NEWLINE,
|
||||
@ -1317,7 +1317,7 @@ static void list_all_procs()
|
||||
PRC.RDB$PROCEDURE_NAME);
|
||||
get_procedure_args (PRC.RDB$PROCEDURE_NAME);
|
||||
|
||||
// Print the procedure body
|
||||
// Print the procedure body
|
||||
|
||||
if (!PRC.RDB$PROCEDURE_SOURCE.NULL)
|
||||
SHOW_print_metadata_text_blob (isqlGlob.Out, &PRC.RDB$PROCEDURE_SOURCE);
|
||||
@ -1367,10 +1367,10 @@ static void list_all_tables(LegacyTables flag,
|
||||
REL.RDB$VIEW_BLR MISSING
|
||||
SORTED BY REL.RDB$RELATION_NAME
|
||||
|
||||
// If this is not an SQL table and we aren't doing ALL objects
|
||||
// If this is not an SQL table and we aren't doing ALL objects
|
||||
if ((REL.RDB$FLAGS.NULL || !(REL.RDB$FLAGS & REL_sql)) && (flag != ALL_objects) )
|
||||
continue;
|
||||
// Null terminate name string
|
||||
// Null terminate name string
|
||||
|
||||
fb_utils::exact_name(REL.RDB$RELATION_NAME);
|
||||
|
||||
@ -1423,7 +1423,7 @@ static void list_all_triggers()
|
||||
if (TRG.RDB$TRIGGER_INACTIVE.NULL)
|
||||
TRG.RDB$TRIGGER_INACTIVE = 0;
|
||||
|
||||
// If trigger is not SQL put it in comments
|
||||
// If trigger is not SQL put it in comments
|
||||
if (!(TRG.RDB$FLAGS & TRG_sql))
|
||||
isqlGlob.printf("/* ");
|
||||
|
||||
@ -1478,7 +1478,7 @@ static void list_all_triggers()
|
||||
if (TRG.RDB$TRIGGER_INACTIVE.NULL)
|
||||
TRG.RDB$TRIGGER_INACTIVE = 0;
|
||||
|
||||
// If trigger is not SQL put it in comments
|
||||
// If trigger is not SQL put it in comments
|
||||
if (!(TRG.RDB$FLAGS & TRG_sql))
|
||||
isqlGlob.printf("/* ");
|
||||
|
||||
@ -1537,7 +1537,7 @@ static void list_check()
|
||||
*
|
||||
**************************************/
|
||||
|
||||
// Query gets the check clauses for triggers stored for check constraints
|
||||
// Query gets the check clauses for triggers stored for check constraints
|
||||
|
||||
FOR TRG IN RDB$TRIGGERS CROSS
|
||||
CHK IN RDB$CHECK_CONSTRAINTS WITH
|
||||
@ -1792,7 +1792,7 @@ static void list_create_db()
|
||||
}
|
||||
isqlGlob.printf("CREATE DATABASE '%s'", isqlGlob.global_Target_db);
|
||||
|
||||
// Get the page size from db_info call
|
||||
// Get the page size from db_info call
|
||||
SCHAR info_buf[20];
|
||||
// CVC: Finally I got the idea: translate is associated with WISQL that
|
||||
// no longer exists. Localizing the messages means also not printing
|
||||
@ -1824,10 +1824,10 @@ static void list_create_db()
|
||||
isqlGlob.printf("%s%s", isqlGlob.global_Term, NEWLINE);
|
||||
}
|
||||
|
||||
// List secondary files and shadows as alter db and create shadow in comment
|
||||
// List secondary files and shadows as alter db and create shadow in comment
|
||||
|
||||
bool first = true;
|
||||
|
||||
|
||||
FOR FIL IN RDB$FILES
|
||||
SORTED BY FIL.RDB$SHADOW_NUMBER, FIL.RDB$FILE_SEQUENCE
|
||||
|
||||
@ -1839,7 +1839,7 @@ static void list_create_db()
|
||||
}
|
||||
|
||||
first = false;
|
||||
// reset nulls to zero
|
||||
// reset nulls to zero
|
||||
|
||||
if (FIL.RDB$FILE_FLAGS.NULL)
|
||||
FIL.RDB$FILE_FLAGS = 0;
|
||||
@ -1851,7 +1851,7 @@ static void list_create_db()
|
||||
FIL.RDB$FILE_START = 0;
|
||||
fb_utils::exact_name(FIL.RDB$FILE_NAME);
|
||||
|
||||
// Pure secondary files
|
||||
// Pure secondary files
|
||||
if (FIL.RDB$FILE_FLAGS == 0)
|
||||
{
|
||||
isqlGlob.printf("%sALTER DATABASE ADD FILE '%s'",
|
||||
@ -1969,7 +1969,7 @@ static void list_domain_table(const SCHAR* table_name,
|
||||
|
||||
if (isqlGlob.major_ods >= ODS_VERSION10)
|
||||
{
|
||||
// Handle Integral subtypes NUMERIC and DECIMAL
|
||||
// Handle Integral subtypes NUMERIC and DECIMAL
|
||||
if ((FLD.RDB$FIELD_TYPE == SMALLINT) ||
|
||||
(FLD.RDB$FIELD_TYPE == INTEGER) ||
|
||||
(FLD.RDB$FIELD_TYPE == BIGINT))
|
||||
@ -2001,7 +2001,7 @@ static void list_domain_table(const SCHAR* table_name,
|
||||
|
||||
if (!precision_known)
|
||||
{
|
||||
// Take a stab at numerics and decimals
|
||||
// Take a stab at numerics and decimals
|
||||
if ((FLD.RDB$FIELD_TYPE == SMALLINT) && (FLD.RDB$FIELD_SCALE < 0))
|
||||
{
|
||||
sprintf (Print_buffer, "NUMERIC(4, %d)", -FLD.RDB$FIELD_SCALE);
|
||||
@ -2042,7 +2042,7 @@ static void list_domain_table(const SCHAR* table_name,
|
||||
|
||||
else if ((FLD.RDB$FIELD_TYPE == T_CHAR) || (FLD.RDB$FIELD_TYPE == VARCHAR))
|
||||
{
|
||||
// Length for chars
|
||||
// Length for chars
|
||||
isqlGlob.printf("(%d)", ISQL_get_field_length(FLD.RDB$FIELD_NAME));
|
||||
}
|
||||
|
||||
@ -2080,7 +2080,7 @@ static void list_domain_table(const SCHAR* table_name,
|
||||
if (FLD.RDB$NULL_FLAG == 1)
|
||||
isqlGlob.printf(" NOT NULL");
|
||||
|
||||
// Bug 8261: Now show the collation order information
|
||||
// Bug 8261: Now show the collation order information
|
||||
/* Show the collation order if one has been specified. If the collation
|
||||
order is the default for the character set being used, then no collation
|
||||
order will be shown ( because it isn't needed ).
|
||||
@ -2152,7 +2152,7 @@ static void list_domains(SSHORT default_char_set_id)
|
||||
|
||||
if (isqlGlob.major_ods >= ODS_VERSION10)
|
||||
{
|
||||
// Handle Integral subtypes NUMERIC and DECIMAL
|
||||
// Handle Integral subtypes NUMERIC and DECIMAL
|
||||
if ((FLD.RDB$FIELD_TYPE == SMALLINT) ||
|
||||
(FLD.RDB$FIELD_TYPE == INTEGER) ||
|
||||
(FLD.RDB$FIELD_TYPE == BIGINT))
|
||||
@ -2184,7 +2184,7 @@ static void list_domains(SSHORT default_char_set_id)
|
||||
|
||||
if (!precision_known)
|
||||
{
|
||||
// Take a stab at numerics and decimals
|
||||
// Take a stab at numerics and decimals
|
||||
if ((FLD.RDB$FIELD_TYPE == SMALLINT) && (FLD.RDB$FIELD_SCALE < 0))
|
||||
{
|
||||
sprintf (Print_buffer, "NUMERIC(4, %d)", -FLD.RDB$FIELD_SCALE);
|
||||
@ -2225,7 +2225,7 @@ static void list_domains(SSHORT default_char_set_id)
|
||||
|
||||
else if ((FLD.RDB$FIELD_TYPE == T_CHAR) || (FLD.RDB$FIELD_TYPE == VARCHAR))
|
||||
{
|
||||
// Length for chars
|
||||
// Length for chars
|
||||
isqlGlob.printf("(%d)", ISQL_get_field_length(FLD.RDB$FIELD_NAME));
|
||||
}
|
||||
|
||||
@ -2262,7 +2262,7 @@ static void list_domains(SSHORT default_char_set_id)
|
||||
if (FLD.RDB$NULL_FLAG == 1)
|
||||
isqlGlob.printf(" NOT NULL");
|
||||
|
||||
// Bug 8261: Now show the collation order information
|
||||
// Bug 8261: Now show the collation order information
|
||||
/* Show the collation order if one has been specified. If the collation
|
||||
order is the default for the character set being used, then no collation
|
||||
order will be shown ( because it isn't needed
|
||||
@ -2465,13 +2465,13 @@ static void list_foreign()
|
||||
collist,
|
||||
RELC2.RDB$RELATION_NAME);
|
||||
|
||||
// Get the column list for the primary key
|
||||
// Get the column list for the primary key
|
||||
|
||||
ISQL_get_index_segments (collist, sizeof(collist), RELC2.RDB$INDEX_NAME, true);
|
||||
|
||||
isqlGlob.printf("(%s)", collist);
|
||||
|
||||
// Add the referential actions, if any
|
||||
// Add the referential actions, if any
|
||||
if (!REFC.RDB$UPDATE_RULE.NULL)
|
||||
{
|
||||
ISQL_truncate_term (REFC.RDB$UPDATE_RULE,
|
||||
@ -2539,7 +2539,7 @@ static void list_functions()
|
||||
else
|
||||
strcpy(SQL_identifier, FUN.RDB$FUNCTION_NAME);
|
||||
|
||||
// Start new function declaration
|
||||
// Start new function declaration
|
||||
isqlGlob.printf("DECLARE EXTERNAL FUNCTION %s%s", SQL_identifier, NEWLINE);
|
||||
|
||||
bool firstarg = true;
|
||||
@ -2548,12 +2548,12 @@ static void list_functions()
|
||||
FUN.RDB$FUNCTION_NAME EQ FNA.RDB$FUNCTION_NAME
|
||||
SORTED BY FNA.RDB$ARGUMENT_POSITION
|
||||
|
||||
// Find parameter type
|
||||
// Find parameter type
|
||||
int i = 0;
|
||||
while (FNA.RDB$FIELD_TYPE != Column_types[i].type)
|
||||
i++;
|
||||
|
||||
// Print length where appropriate
|
||||
// Print length where appropriate
|
||||
if ((FNA.RDB$FIELD_TYPE == T_CHAR) ||
|
||||
(FNA.RDB$FIELD_TYPE == VARCHAR) ||
|
||||
(FNA.RDB$FIELD_TYPE == CSTRING))
|
||||
@ -2605,7 +2605,7 @@ static void list_functions()
|
||||
-FNA1.RDB$FIELD_SCALE);
|
||||
precision_known = true;
|
||||
}
|
||||
} // if field_precision is not null
|
||||
} // if field_precision is not null
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
ISQL_errmsg (isc_status);
|
||||
@ -2615,7 +2615,7 @@ static void list_functions()
|
||||
|
||||
if (!precision_known)
|
||||
{
|
||||
// Take a stab at numerics and decimals
|
||||
// Take a stab at numerics and decimals
|
||||
if ((FNA.RDB$FIELD_TYPE == SMALLINT) &&
|
||||
(FNA.RDB$FIELD_SCALE < 0))
|
||||
{
|
||||
@ -2637,10 +2637,10 @@ static void list_functions()
|
||||
else
|
||||
sprintf (type_buffer, "%s",
|
||||
Column_types[i].type_name);
|
||||
} // if !precision_known
|
||||
} // if T_CHAR or VARCHAR or CSTRING ... else
|
||||
} // if !precision_known
|
||||
} // if T_CHAR or VARCHAR or CSTRING ... else
|
||||
|
||||
// If a return argument, save it for the end, otherwise print
|
||||
// If a return argument, save it for the end, otherwise print
|
||||
|
||||
/*
|
||||
* Changed the following to not return a BLOB by value.
|
||||
@ -2674,7 +2674,7 @@ static void list_functions()
|
||||
}
|
||||
|
||||
if (printarg) {
|
||||
// First arg needs no comma
|
||||
// First arg needs no comma
|
||||
isqlGlob.printf("%s%s%s", (firstarg ? "" : ", "), type_buffer,
|
||||
UDF_param_types[ptype]);
|
||||
firstarg = false;
|
||||
@ -2686,13 +2686,13 @@ static void list_functions()
|
||||
return;
|
||||
END_ERROR;
|
||||
|
||||
// Print the return type -- All functions return a type
|
||||
// Print the return type -- All functions return a type
|
||||
isqlGlob.printf("%s%s%s",
|
||||
NEWLINE,
|
||||
return_buffer,
|
||||
NEWLINE);
|
||||
|
||||
// Print out entrypoint information
|
||||
// Print out entrypoint information
|
||||
ISQL_copy_SQL_id(FUN.RDB$ENTRYPOINT, SQL_identifier, SINGLE_QUOTE);
|
||||
ISQL_copy_SQL_id(FUN.RDB$MODULE_NAME, SQL_identifier2, SINGLE_QUOTE);
|
||||
|
||||
@ -2782,7 +2782,7 @@ static void list_index()
|
||||
char collist[BUFFER_LENGTH512 * 2];
|
||||
|
||||
bool first = true;
|
||||
|
||||
|
||||
FOR IDX IN RDB$INDICES CROSS RELC IN RDB$RELATIONS
|
||||
OVER RDB$RELATION_NAME
|
||||
WITH (RELC.RDB$SYSTEM_FLAG NE 1 OR RELC.RDB$SYSTEM_FLAG MISSING)
|
||||
@ -2820,7 +2820,7 @@ static void list_index()
|
||||
IDX.RDB$INDEX_NAME,
|
||||
IDX.RDB$RELATION_NAME);
|
||||
|
||||
// Get index expression or column names
|
||||
// Get index expression or column names
|
||||
|
||||
if (!IDX.RDB$EXPRESSION_BLR.NULL)
|
||||
{
|
||||
@ -2857,7 +2857,7 @@ static void list_views()
|
||||
*
|
||||
**************************************/
|
||||
|
||||
// If this is a view, use print_blob to print the view text
|
||||
// If this is a view, use print_blob to print the view text
|
||||
|
||||
FOR REL IN RDB$RELATIONS WITH
|
||||
(REL.RDB$SYSTEM_FLAG NE 1 OR REL.RDB$SYSTEM_FLAG MISSING) AND
|
||||
@ -2882,7 +2882,7 @@ static void list_views()
|
||||
NEWLINE);
|
||||
isqlGlob.printf("CREATE VIEW %s (", SQL_identifier);
|
||||
|
||||
// Get column list
|
||||
// Get column list
|
||||
FOR RFR IN RDB$RELATION_FIELDS WITH
|
||||
RFR.RDB$RELATION_NAME = REL.RDB$RELATION_NAME
|
||||
SORTED BY RFR.RDB$FIELD_POSITION
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -154,7 +154,7 @@ const SCHAR* Db_trigger_types[] = {
|
||||
};
|
||||
|
||||
|
||||
enum priv_flag {
|
||||
enum priv_flag {
|
||||
priv_UNKNOWN = 1,
|
||||
priv_SELECT = 2,
|
||||
priv_INSERT = 4,
|
||||
@ -409,7 +409,7 @@ bool SHOW_dbb_parameters(FB_API_HANDLE db_handle,
|
||||
break;
|
||||
case isc_info_ods_minor_version:
|
||||
value_out = isc_vax_integer(d, length);
|
||||
sprintf(info, "ODS = %"SLONGFORMAT".%"SLONGFORMAT"%s",
|
||||
sprintf(info, "ODS = %"SLONGFORMAT".%"SLONGFORMAT"%s",
|
||||
(SLONG) isqlGlob.major_ods, value_out, NEWLINE);
|
||||
break;
|
||||
|
||||
@ -433,7 +433,7 @@ bool SHOW_dbb_parameters(FB_API_HANDLE db_handle,
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
case isc_info_truncated:
|
||||
return info > info_buf; // If we got some items, we are (partially) successful.
|
||||
}
|
||||
@ -514,7 +514,7 @@ static const char* granted_by(char* buffer, const char* grantor)
|
||||
fb_utils::exact_name(owner);
|
||||
reReadDbOwner = false;
|
||||
}
|
||||
|
||||
|
||||
strcpy(buffer, grantor);
|
||||
fb_utils::exact_name(buffer);
|
||||
if (!strcmp(buffer, owner))
|
||||
@ -631,8 +631,8 @@ processing_state SHOW_grants2 (const SCHAR* object,
|
||||
strcpy (SQL_identifier, object);
|
||||
|
||||
isqlGlob.printf("GRANT %s%s ON %s TO %s%s%s%s%s",
|
||||
priv_string, col_string,
|
||||
SQL_identifier,
|
||||
priv_string, col_string,
|
||||
SQL_identifier,
|
||||
user_string, with_option, granted_by(buf_grantor, prev_grantor), terminator, NEWLINE);
|
||||
|
||||
// re-initialize strings
|
||||
@ -761,9 +761,9 @@ processing_state SHOW_grants2 (const SCHAR* object,
|
||||
else
|
||||
strcpy (SQL_identifier, object);
|
||||
|
||||
isqlGlob.printf("GRANT %s%s ON %s TO %s%s%s%s%s",
|
||||
priv_string, col_string,
|
||||
SQL_identifier,
|
||||
isqlGlob.printf("GRANT %s%s ON %s TO %s%s%s%s%s",
|
||||
priv_string, col_string,
|
||||
SQL_identifier,
|
||||
user_string, with_option, granted_by(buf_grantor, prev_grantor), terminator, NEWLINE);
|
||||
}
|
||||
|
||||
@ -856,7 +856,7 @@ processing_state SHOW_grants2 (const SCHAR* object,
|
||||
strcpy (SQL_identifier, object);
|
||||
|
||||
isqlGlob.printf("GRANT EXECUTE ON PROCEDURE %s TO %s%s%s%s%s",
|
||||
SQL_identifier, user_string, with_option,
|
||||
SQL_identifier, user_string, with_option,
|
||||
granted_by(buf_grantor, PRV.RDB$GRANTOR), terminator, NEWLINE);
|
||||
first = false;
|
||||
|
||||
@ -1153,7 +1153,7 @@ processing_state SHOW_metadata(const SCHAR* const* cmd,
|
||||
{ShowOptions::security_class, "SECCLASSES", 6},
|
||||
{ShowOptions::users, "USERS", 0}
|
||||
};
|
||||
|
||||
|
||||
const ShowOptions showoptions(options, FB_NELEM(options), ShowOptions::wrong);
|
||||
|
||||
|
||||
@ -1167,7 +1167,7 @@ processing_state SHOW_metadata(const SCHAR* const* cmd,
|
||||
showoptions.showCommands(isqlGlob.Out);
|
||||
return ps_ERR;
|
||||
}
|
||||
|
||||
|
||||
processing_state ret = SKIP;
|
||||
// Only show version and show sql dialect work if there is no db attached
|
||||
bool handled = true;
|
||||
@ -1196,10 +1196,10 @@ processing_state SHOW_metadata(const SCHAR* const* cmd,
|
||||
if (!ISQL_dbcheck())
|
||||
ret = ps_ERR;
|
||||
}
|
||||
|
||||
|
||||
if (ret == ps_ERR || handled)
|
||||
return ret;
|
||||
|
||||
|
||||
TEXT SQL_id_for_grant[BUFFER_LENGTH128];
|
||||
int key = 0;
|
||||
|
||||
@ -1414,7 +1414,7 @@ processing_state SHOW_metadata(const SCHAR* const* cmd,
|
||||
key = NO_FUNCTIONS;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ShowOptions::generator:
|
||||
if (*cmd[2] == '"') {
|
||||
remove_delimited_double_quotes(lcmd[2]);
|
||||
@ -1483,7 +1483,7 @@ processing_state SHOW_metadata(const SCHAR* const* cmd,
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ShowOptions::procedure:
|
||||
if (*cmd[2] == '"') {
|
||||
remove_delimited_double_quotes(lcmd[2]);
|
||||
@ -1499,7 +1499,7 @@ processing_state SHOW_metadata(const SCHAR* const* cmd,
|
||||
key = NO_PROCS;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ShowOptions::trigger:
|
||||
if (*cmd[2] == '"') {
|
||||
remove_delimited_double_quotes(lcmd[2]);
|
||||
@ -1527,7 +1527,7 @@ processing_state SHOW_metadata(const SCHAR* const* cmd,
|
||||
key = NO_TRIGGERS;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ShowOptions::check:
|
||||
if (*cmd[2] == '"') {
|
||||
remove_delimited_double_quotes(lcmd[2]);
|
||||
@ -1549,11 +1549,11 @@ processing_state SHOW_metadata(const SCHAR* const* cmd,
|
||||
key = NO_TABLE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ShowOptions::database:
|
||||
show_db();
|
||||
break;
|
||||
|
||||
|
||||
case ShowOptions::comment:
|
||||
ret = show_comments(cmmShow, 0);
|
||||
if (ret == OBJECT_NOT_FOUND)
|
||||
@ -1575,7 +1575,7 @@ processing_state SHOW_metadata(const SCHAR* const* cmd,
|
||||
key = NO_COLLATIONS;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ShowOptions::dependency:
|
||||
if (*cmd[2] == '"')
|
||||
{
|
||||
@ -1584,11 +1584,11 @@ processing_state SHOW_metadata(const SCHAR* const* cmd,
|
||||
}
|
||||
else
|
||||
ret = show_dependencies(cmd[2]);
|
||||
|
||||
|
||||
if (ret == OBJECT_NOT_FOUND)
|
||||
key = NO_DEPENDENCIES;
|
||||
break;
|
||||
|
||||
|
||||
case ShowOptions::security_class:
|
||||
if (*cmd[2] == '"')
|
||||
{
|
||||
@ -1776,7 +1776,7 @@ static void show_charsets(
|
||||
const SSHORT default_char_set_id = ISQL_get_default_char_set_id();
|
||||
|
||||
// If there is a relation_name, this is a real column, look up collation
|
||||
// in rdb$relation_fields
|
||||
// in rdb$relation_fields
|
||||
|
||||
if (relation_name) {
|
||||
FOR RRF IN RDB$RELATION_FIELDS CROSS
|
||||
@ -1877,7 +1877,7 @@ static void show_proc_charsets(
|
||||
prp_collation_null = PRP2.RDB$COLLATION_ID.NULL;
|
||||
if (!prp_collation_null)
|
||||
collation = PRP2.RDB$COLLATION_ID;
|
||||
END_FOR
|
||||
END_FOR
|
||||
}
|
||||
|
||||
if (prp_collation_null &&
|
||||
@ -1893,7 +1893,7 @@ static void show_proc_charsets(
|
||||
prp_collation_null = RFL.RDB$COLLATION_ID.NULL;
|
||||
if (!prp_collation_null)
|
||||
collation = RFL.RDB$COLLATION_ID;
|
||||
END_FOR
|
||||
END_FOR
|
||||
}
|
||||
|
||||
if (prp_collation_null && !FLD.RDB$COLLATION_ID.NULL)
|
||||
@ -1937,7 +1937,7 @@ static void show_proc_charsets(
|
||||
else
|
||||
ISQL_get_character_sets(char_set_id, collation, false, char_sets);
|
||||
}
|
||||
|
||||
|
||||
if (char_sets[0])
|
||||
{
|
||||
if (doIndent)
|
||||
@ -2107,7 +2107,7 @@ static void show_comment(const char* objtype, char* name1, char* name2,
|
||||
fb_utils::exact_name(name1);
|
||||
if (name2)
|
||||
fb_utils::exact_name(name2);
|
||||
|
||||
|
||||
char SQL_identifier2[BUFFER_LENGTH128];
|
||||
if (escape_quotes && isqlGlob.db_SQL_dialect > SQL_DIALECT_V6_TRANSITION)
|
||||
{
|
||||
@ -2131,7 +2131,7 @@ static void show_comment(const char* objtype, char* name1, char* name2,
|
||||
isqlGlob.printf("COMMENT ON %-12s %s IS %s", objtype, name1, quot);
|
||||
else
|
||||
isqlGlob.printf("COMMENT ON %-12s %s.%s IS %s", objtype, name1, name2, quot);
|
||||
|
||||
|
||||
SHOW_print_metadata_text_blob(isqlGlob.Out, blobfld, escape_quotes);
|
||||
isqlGlob.printf("%s%s%s", quot, isqlGlob.global_Term, NEWLINE);
|
||||
}
|
||||
@ -2558,7 +2558,7 @@ static processing_state show_dependencies(const char* object)
|
||||
{
|
||||
if (!object || !object[0])
|
||||
return ps_ERR;
|
||||
|
||||
|
||||
bool missing = true;
|
||||
|
||||
for (int i = 0; i < FB_NELEM(Object_types); ++i)
|
||||
@ -2569,7 +2569,7 @@ static processing_state show_dependencies(const char* object)
|
||||
isqlGlob.printf("+++%s", NEWLINE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return missing ? OBJECT_NOT_FOUND : SKIP;
|
||||
}
|
||||
|
||||
@ -2609,7 +2609,7 @@ static processing_state show_dependencies(const char* object, int obj_type)
|
||||
ISQL_errmsg(isc_status);
|
||||
return ps_ERR;
|
||||
END_ERROR;
|
||||
|
||||
|
||||
if (!missing1)
|
||||
{
|
||||
const char* type_name = Object_types[obj_type];
|
||||
@ -2618,7 +2618,7 @@ static processing_state show_dependencies(const char* object, int obj_type)
|
||||
}
|
||||
|
||||
bool missing2 = true;
|
||||
|
||||
|
||||
FOR DEP2 IN RDB$DEPENDENCIES
|
||||
WITH DEP2.RDB$DEPENDENT_NAME EQ object AND
|
||||
DEP2.RDB$DEPENDENT_TYPE EQ obj_type
|
||||
@ -2636,7 +2636,7 @@ static processing_state show_dependencies(const char* object, int obj_type)
|
||||
}
|
||||
else
|
||||
isqlGlob.prints(", ");
|
||||
|
||||
|
||||
fb_utils::exact_name(DEP2.RDB$DEPENDED_ON_NAME);
|
||||
const char* type_name = Object_types[DEP2.RDB$DEPENDED_ON_TYPE];
|
||||
if (DEP2.RDB$FIELD_NAME.NULL)
|
||||
@ -2651,10 +2651,10 @@ static processing_state show_dependencies(const char* object, int obj_type)
|
||||
ISQL_errmsg(isc_status);
|
||||
return ps_ERR;
|
||||
END_ERROR;
|
||||
|
||||
|
||||
bool missing3 = true;
|
||||
bool is_table = false;
|
||||
|
||||
|
||||
FOR REL IN RDB$RELATIONS
|
||||
WITH REL.RDB$RELATION_NAME = object AND
|
||||
REL.RDB$VIEW_BLR MISSING AND
|
||||
@ -2679,7 +2679,7 @@ static processing_state show_dependencies(const char* object, int obj_type)
|
||||
|
||||
if (FLD.RDB$COMPUTED_BLR.NULL) // redundant
|
||||
continue;
|
||||
|
||||
|
||||
if (missing3)
|
||||
{
|
||||
if (!target_done)
|
||||
@ -2688,7 +2688,7 @@ static processing_state show_dependencies(const char* object, int obj_type)
|
||||
isqlGlob.printf("%s[%s:%s]", TAB_AS_SPACES, object, type_name);
|
||||
target_done = true;
|
||||
}
|
||||
|
||||
|
||||
isqlGlob.prints(NEWLINE);
|
||||
missing3 = false;
|
||||
}
|
||||
@ -3201,7 +3201,7 @@ static processing_state show_functions(const SCHAR* object, const SSHORT sys_fla
|
||||
else
|
||||
return OBJECT_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
FOR FUN IN RDB$FUNCTIONS CROSS
|
||||
FNA IN RDB$FUNCTION_ARGUMENTS WITH
|
||||
FUN.RDB$FUNCTION_NAME EQ FNA.RDB$FUNCTION_NAME AND
|
||||
@ -3768,7 +3768,7 @@ static processing_state show_proc(const SCHAR* procname)
|
||||
prm_default_source_null = PRM2.RDB$DEFAULT_SOURCE.NULL;
|
||||
prm_default_source = PRM2.RDB$DEFAULT_SOURCE;
|
||||
}
|
||||
END_FOR
|
||||
END_FOR
|
||||
}
|
||||
|
||||
char relationName[BUFFER_LENGTH128] = "";
|
||||
@ -3792,7 +3792,7 @@ static processing_state show_proc(const SCHAR* procname)
|
||||
fb_utils::exact_name(relationField);
|
||||
}
|
||||
|
||||
END_FOR
|
||||
END_FOR
|
||||
}
|
||||
|
||||
const bool basedOnColumn = relationName[0] && relationField[0];
|
||||
@ -3821,7 +3821,7 @@ static processing_state show_proc(const SCHAR* procname)
|
||||
{
|
||||
show_proc_charsets(PRM.RDB$PROCEDURE_NAME, PRM.RDB$PARAMETER_NAME, true, true, false);
|
||||
}
|
||||
|
||||
|
||||
if (PRM.RDB$PARAMETER_TYPE == 0) // input, try to show default and make Vlad happy.
|
||||
{
|
||||
if (!prm_default_source_null)
|
||||
@ -3872,14 +3872,14 @@ static processing_state show_role(const SCHAR* object)
|
||||
SORTED BY X.RDB$ROLE_NAME
|
||||
|
||||
bool system_flag = false;
|
||||
if (isqlGlob.major_ods >= ODS_VERSION11)
|
||||
if (isqlGlob.major_ods >= ODS_VERSION11)
|
||||
{
|
||||
FOR SF IN RDB$ROLES
|
||||
WITH SF.RDB$ROLE_NAME = X.RDB$ROLE_NAME
|
||||
WITH SF.RDB$ROLE_NAME = X.RDB$ROLE_NAME
|
||||
AND SF.RDB$SYSTEM_FLAG > 0
|
||||
|
||||
|
||||
system_flag = true;
|
||||
|
||||
|
||||
END_FOR
|
||||
}
|
||||
|
||||
@ -3942,7 +3942,7 @@ static processing_state show_role(const SCHAR* object)
|
||||
ISQL_errmsg (isc_status);
|
||||
return ps_ERR;
|
||||
END_ERROR
|
||||
|
||||
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
@ -3980,14 +3980,14 @@ static processing_state show_secclass(const char* object, const char* opt)
|
||||
{
|
||||
if (!object || !*object)
|
||||
return ps_ERR;
|
||||
|
||||
|
||||
const bool detail = opt &&
|
||||
(fb_utils::stricmp(opt, "DETAIL") == 0 ||
|
||||
fb_utils::stricmp(opt, "DET") == 0);
|
||||
XSQLVAR var; // To trick ISQL_print_item_blob()
|
||||
memset(&var, 0, sizeof(var));
|
||||
var.sqlsubtype = isc_blob_acl;
|
||||
|
||||
|
||||
int count = 0;
|
||||
|
||||
if (strcmp(object, "*") == 0)
|
||||
@ -4008,10 +4008,10 @@ static processing_state show_secclass(const char* object, const char* opt)
|
||||
ISQL_errmsg(isc_status);
|
||||
return ps_ERR;
|
||||
END_ERROR
|
||||
|
||||
|
||||
return count ? SKIP : OBJECT_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
FOR REL IN RDB$RELATIONS
|
||||
CROSS SC IN RDB$SECURITY_CLASSES
|
||||
OVER RDB$SECURITY_CLASS
|
||||
@ -4068,7 +4068,7 @@ static processing_state show_secclass(const char* object, const char* opt)
|
||||
ISQL_errmsg(isc_status);
|
||||
return ps_ERR;
|
||||
END_ERROR
|
||||
|
||||
|
||||
FOR PR IN RDB$PROCEDURES
|
||||
CROSS SC IN RDB$SECURITY_CLASSES
|
||||
OVER RDB$SECURITY_CLASS
|
||||
@ -4274,7 +4274,7 @@ static processing_state show_table(
|
||||
continue;
|
||||
}
|
||||
|
||||
// The null flag is either 1 or null (for nullable)
|
||||
// The null flag is either 1 or null (for nullable)
|
||||
|
||||
if (RFR.RDB$NULL_FLAG == 1 || FLD.RDB$NULL_FLAG == 1 ||
|
||||
(!RFR.RDB$BASE_FIELD.NULL &&
|
||||
@ -4395,7 +4395,7 @@ static processing_state show_table(
|
||||
return ps_ERR;
|
||||
END_ERROR;
|
||||
}
|
||||
|
||||
|
||||
if (isPK || isUK) // Special handling for PRIMARY KEY and UNIQUE constraints.
|
||||
{
|
||||
FOR IDX IN RDB$INDICES
|
||||
@ -4413,7 +4413,7 @@ static processing_state show_table(
|
||||
}
|
||||
if (explicit_index)
|
||||
isqlGlob.printf(" %s", RELC1.RDB$INDEX_NAME);
|
||||
|
||||
|
||||
isqlGlob.prints(NEWLINE);
|
||||
END_FOR
|
||||
ON_ERROR
|
||||
@ -4662,7 +4662,7 @@ static processing_state show_users()
|
||||
* Show users logged in the database (not users defined for this database).
|
||||
*
|
||||
**************************************/
|
||||
|
||||
|
||||
const SCHAR user_items[] =
|
||||
{
|
||||
isc_info_user_names,
|
||||
@ -4684,7 +4684,7 @@ static processing_state show_users()
|
||||
ovar.sqllen = sizeof(my_user) - 3;
|
||||
const char* getuser = isqlGlob.major_ods < ODS_VERSION10 ?
|
||||
"select user from rdb$database" : "select current_user from rdb$database";
|
||||
|
||||
|
||||
/*
|
||||
#ifdef TRUSTED_AUTH
|
||||
//if (Trusted_auth)
|
||||
@ -4758,11 +4758,11 @@ static processing_state show_users()
|
||||
newline = !newline;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case isc_info_truncated:
|
||||
if (newline)
|
||||
isqlGlob.printf("\n");
|
||||
|
||||
|
||||
ISQL_msg_get(OUTPUT_TRUNCATED, msg);
|
||||
isqlGlob.printf("%s\n", msg);
|
||||
return rc; // If we got some items, we are (partially) successful.
|
||||
@ -4775,7 +4775,7 @@ static processing_state show_users()
|
||||
|
||||
if (newline) // Last line was without newline.
|
||||
isqlGlob.printf("\n");
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -180,9 +180,9 @@ int CLIB_ROUTINE main( int argc, char** argv)
|
||||
pathname[len + 1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const size_t separator_pos = pathname ? strlen(pathname) : 0;
|
||||
|
||||
|
||||
/* check for the locale option */
|
||||
|
||||
if (!locale) { // no locale given: do the regular US msgs
|
||||
@ -337,7 +337,7 @@ static USHORT do_msgs( const TEXT* filename, const TEXT* locale, bool sw_warning
|
||||
write_bucket((msgnod*) &header, sizeof(header));
|
||||
|
||||
// Write out messages building B-tree
|
||||
|
||||
|
||||
int warning_counter = 0;
|
||||
USHORT n = 0;
|
||||
ULONG position = 0, prior_code = 0;
|
||||
@ -499,7 +499,7 @@ static SLONG write_bucket( const msgnod* bucket, USHORT length)
|
||||
fprintf(stderr, "IO error on write()\n");
|
||||
exit(FINI_ERROR);
|
||||
}
|
||||
|
||||
|
||||
const SLONG zero_bytes = 0;
|
||||
n = write(global_file, &zero_bytes, padded_length - length);
|
||||
if (n == -1) {
|
||||
|
@ -64,7 +64,7 @@ int main( int argc, char **argv)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Top level routine.
|
||||
* Top level routine.
|
||||
*
|
||||
**************************************/
|
||||
char facility[20], text[256], module[32], routine[32];
|
||||
|
@ -59,7 +59,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Top level routine.
|
||||
* Top level routine.
|
||||
*
|
||||
**************************************/
|
||||
TEXT *p, **end_args, db_file[256];
|
||||
@ -127,7 +127,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
|
||||
isc_encode_date(localtime(&file_stat.st_mtime), (ISC_QUAD*) &date_loc);
|
||||
flag_loc = false;
|
||||
}
|
||||
/* Earlier the following fclose was closing ind_msg again, due to which
|
||||
/* Earlier the following fclose was closing ind_msg again, due to which
|
||||
check_messages was crashing with SEGV signal - */
|
||||
fclose(ind_loc); /* A bug in check_messages is fixed */
|
||||
}
|
||||
@ -138,7 +138,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
|
||||
|
||||
if (!flag_jrd) {
|
||||
FOR FIRST 1 X IN FACILITIES WITH
|
||||
X.FACILITY EQ 'JRD' AND X.LAST_CHANGE GE date_jrd
|
||||
X.FACILITY EQ 'JRD' AND X.LAST_CHANGE GE date_jrd
|
||||
|
||||
flag_jrd = true;
|
||||
END_FOR;
|
||||
@ -146,7 +146,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
|
||||
|
||||
if (!flag_msg) {
|
||||
FOR FIRST 1 X IN FACILITIES WITH
|
||||
X.LAST_CHANGE GE date_msg
|
||||
X.LAST_CHANGE GE date_msg
|
||||
|
||||
flag_msg = true;
|
||||
END_FOR;
|
||||
@ -154,7 +154,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
|
||||
|
||||
if (!flag_loc) {
|
||||
FOR FIRST 1 T IN TRANSMSGS WITH
|
||||
T.TRANS_DATE GE date_loc
|
||||
T.TRANS_DATE GE date_loc
|
||||
|
||||
flag_loc = true;
|
||||
END_FOR;
|
||||
|
@ -68,7 +68,7 @@ int main( int argc, char **argv)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Top level routine.
|
||||
* Top level routine.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
@ -338,7 +338,7 @@ static bool get_sql_code( SSHORT * sql_code)
|
||||
if (sql_num < 0) {
|
||||
srch_num = 1000 + sql_num;
|
||||
FOR M IN MESSAGES WITH M.FAC_CODE = FAC_SQL_NEGATIVE
|
||||
AND M.NUMBER = srch_num
|
||||
AND M.NUMBER = srch_num
|
||||
|
||||
got_it = true;
|
||||
END_FOR;
|
||||
@ -346,7 +346,7 @@ static bool get_sql_code( SSHORT * sql_code)
|
||||
else {
|
||||
srch_num = sql_num;
|
||||
FOR M IN MESSAGES WITH M.FAC_CODE = FAC_SQL_POSITIVE
|
||||
AND M.NUMBER = srch_num
|
||||
AND M.NUMBER = srch_num
|
||||
|
||||
got_it = true;
|
||||
END_FOR;
|
||||
|
@ -61,7 +61,7 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
|
||||
* This is used to add and delete users from the user information
|
||||
* database (security2.fdb). It also displays information
|
||||
* about current users and allows modification of current
|
||||
* users' parameters.
|
||||
* users' parameters.
|
||||
* Returns 0 on success, otherwise returns a Gsec message number
|
||||
* and the status vector containing the error info.
|
||||
* The syntax is:
|
||||
@ -189,7 +189,7 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
|
||||
changes the current value to the null value */
|
||||
|
||||
found = false;
|
||||
FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN USERS
|
||||
FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN USERS
|
||||
WITH U.USER_NAME EQ io_user_data->user_name
|
||||
found = true;
|
||||
MODIFY U USING
|
||||
@ -257,7 +257,7 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
|
||||
if (!fb_utils::stricmp(io_user_data->user_name, SYSDBA_USER_NAME))
|
||||
ret = GsecMsg23;
|
||||
else {
|
||||
FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN USERS
|
||||
FOR (TRANSACTION_HANDLE trans REQUEST_HANDLE request) U IN USERS
|
||||
WITH U.USER_NAME EQ io_user_data->user_name
|
||||
found = true;
|
||||
ERASE U
|
||||
@ -354,7 +354,7 @@ SSHORT SECURITY_exec_line(ISC_STATUS* isc_status,
|
||||
|
||||
SSHORT ret = SECURITY_exec_line(isc_status, DB, gds_trans, io_user_data, display_func, callback_arg);
|
||||
|
||||
// rollback if we have an error using tmp_status to avoid
|
||||
// rollback if we have an error using tmp_status to avoid
|
||||
// overwriting the error status which the caller wants to see
|
||||
|
||||
if (ret) {
|
||||
|
@ -183,7 +183,7 @@ struct dba_mem {
|
||||
|
||||
/* threading declarations for thread data */
|
||||
|
||||
class tdba : public ThreadData
|
||||
class tdba : public ThreadData
|
||||
{
|
||||
public:
|
||||
explicit tdba(Firebird::UtilSvc* us)
|
||||
@ -352,7 +352,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
break;
|
||||
}
|
||||
//in_sw_tab->in_sw_state = true;
|
||||
|
||||
|
||||
switch (in_sw_tab->in_sw)
|
||||
{
|
||||
case 0:
|
||||
@ -560,7 +560,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
/* print continuation file sequence */
|
||||
|
||||
dba_print(7);
|
||||
// msg 7: \n\nDatabase file sequence:
|
||||
// msg 7: \n\nDatabase file sequence:
|
||||
for (current = tddba->files; current->fil_next; current = current->fil_next)
|
||||
{
|
||||
dba_print(8, SafeArg() << current->fil_string << current->fil_next->fil_string);
|
||||
@ -572,22 +572,22 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
|
||||
/* Check to make sure that the user accessing the database is either
|
||||
* SYSDBA or owner of the database */
|
||||
|
||||
|
||||
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
|
||||
uSvc->getAddressPath(dpb);
|
||||
dpb.insertTag(isc_dpb_gstat_attach);
|
||||
dpb.insertTag(isc_dpb_no_garbage_collect);
|
||||
|
||||
if (*username)
|
||||
if (*username)
|
||||
{
|
||||
dpb.insertString(isc_dpb_user_name, username, strlen(username));
|
||||
}
|
||||
if (*password)
|
||||
if (*password)
|
||||
{
|
||||
dpb.insertString(uSvc->isService() ? isc_dpb_password_enc : isc_dpb_password,
|
||||
password, strlen(password));
|
||||
}
|
||||
if (*tr_user)
|
||||
if (*tr_user)
|
||||
{
|
||||
uSvc->checkService();
|
||||
dpb.insertString(isc_dpb_trusted_auth, tr_user, strlen(tr_user));
|
||||
@ -603,7 +603,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
}
|
||||
#endif
|
||||
|
||||
isc_attach_database(status_vector, 0, connName.c_str(), &DB, dpb.getBufferLength(),
|
||||
isc_attach_database(status_vector, 0, connName.c_str(), &DB, dpb.getBufferLength(),
|
||||
reinterpret_cast<const char*>(dpb.getBuffer()));
|
||||
if (status_vector[1])
|
||||
dba_exit(FINI_ERROR, tddba);
|
||||
@ -630,7 +630,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
if (!X.RDB$VIEW_BLR.NULL || !X.RDB$EXTERNAL_FILE.NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
dba_rel* relation;
|
||||
if (sw_relation)
|
||||
{
|
||||
@ -658,7 +658,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
|
||||
FOR(TRANSACTION_HANDLE transact1 REQUEST_HANDLE request2)
|
||||
Y IN RDB$PAGES WITH Y.RDB$RELATION_ID EQ relation->rel_id AND
|
||||
Y.RDB$PAGE_SEQUENCE EQ 0
|
||||
Y.RDB$PAGE_SEQUENCE EQ 0
|
||||
|
||||
if (Y.RDB$PAGE_TYPE == pag_pointer) {
|
||||
relation->rel_pointer_page = Y.RDB$PAGE_NUMBER;
|
||||
@ -670,7 +670,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
ON_ERROR
|
||||
dba_exit(FINI_ERROR, tddba);
|
||||
END_ERROR
|
||||
|
||||
|
||||
if (sw_index)
|
||||
{
|
||||
FOR(TRANSACTION_HANDLE transact1 REQUEST_HANDLE request3)
|
||||
@ -715,7 +715,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
END_ERROR
|
||||
|
||||
dba_print(10);
|
||||
// msg 10: \nAnalyzing database pages ...\n
|
||||
// msg 10: \nAnalyzing database pages ...\n
|
||||
|
||||
for (dba_rel* relation = tddba->relations; relation;
|
||||
relation = relation->rel_next)
|
||||
@ -747,7 +747,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
{
|
||||
dba_print(11, SafeArg() << relation->rel_pointer_page <<
|
||||
relation->rel_index_root);
|
||||
// msg 11: " Primary pointer page: %ld, Index root page: %ld"
|
||||
// msg 11: " Primary pointer page: %ld, Index root page: %ld"
|
||||
if (sw_record) {
|
||||
double average = (relation->rel_records) ?
|
||||
(double) relation->rel_record_space /
|
||||
@ -757,7 +757,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
" Average record length: %s, total records: %ld\n",
|
||||
buf, relation->rel_records);
|
||||
// dba_print(18, SafeArg() << buf << relation->rel_records);
|
||||
// msg 18: " Average record length: %s, total records: %ld
|
||||
// msg 18: " Average record length: %s, total records: %ld
|
||||
average = (relation->rel_versions) ?
|
||||
(double) relation->rel_version_space /
|
||||
relation->rel_versions : 0.0;
|
||||
@ -768,7 +768,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
relation->rel_max_versions);
|
||||
// dba_print(19, SafeArg() << buf << relation->rel_versions <<
|
||||
// relation->rel_max_versions);
|
||||
// msg 19: " Average version length: %s, total versions: %ld, max versions: %ld
|
||||
// msg 19: " Average version length: %s, total versions: %ld, max versions: %ld
|
||||
}
|
||||
|
||||
const double average = (relation->rel_data_pages) ?
|
||||
@ -777,20 +777,20 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
(tddba->page_size - DPG_SIZE)) : 0.0;
|
||||
sprintf((char*) buf, "%.0f%%", average);
|
||||
dba_print(12, SafeArg() << relation->rel_data_pages <<
|
||||
relation->rel_slots << buf);
|
||||
relation->rel_slots << buf);
|
||||
/* msg 12: " Data pages: %ld, data page slots: %ld, average fill: %s */
|
||||
dba_print(13); /* msg 13: " Fill distribution:" */
|
||||
print_distribution("\t", relation->rel_fill_distribution);
|
||||
}
|
||||
uSvc->printf("\n");
|
||||
|
||||
|
||||
for (const dba_idx* index = relation->rel_indexes; index; index = index->idx_next)
|
||||
{
|
||||
dba_print(14, SafeArg() << index->idx_name << index->idx_id);
|
||||
// msg 14: " Index %s (%d)"
|
||||
// msg 14: " Index %s (%d)"
|
||||
dba_print(15, SafeArg() << index->idx_depth <<
|
||||
index->idx_leaf_buckets << index->idx_nodes);
|
||||
// msg 15: \tDepth: %d, leaf buckets: %ld, nodes: %ld
|
||||
// msg 15: \tDepth: %d, leaf buckets: %ld, nodes: %ld
|
||||
const double average = (index->idx_nodes) ?
|
||||
(double) index->idx_data_length / index->idx_nodes : 0;
|
||||
sprintf((char*) buf, "%.2f", average);
|
||||
@ -1069,12 +1069,12 @@ static void analyze_index( dba_rel* relation, dba_idx* index)
|
||||
**************************************/
|
||||
tdba* tddba = tdba::getSpecific();
|
||||
|
||||
const index_root_page* index_root =
|
||||
const index_root_page* index_root =
|
||||
(const index_root_page*) db_read(relation->rel_index_root);
|
||||
|
||||
SLONG page;
|
||||
if (index_root->irt_count <= index->idx_id ||
|
||||
!(page = index_root->irt_rpt[index->idx_id].irt_root))
|
||||
!(page = index_root->irt_rpt[index->idx_id].irt_root))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1086,7 +1086,7 @@ static void analyze_index( dba_rel* relation, dba_idx* index)
|
||||
|
||||
UCHAR* pointer;
|
||||
IndexNode node;
|
||||
while (bucket->btr_level)
|
||||
while (bucket->btr_level)
|
||||
{
|
||||
pointer = BTreeNode::getPointerFirstNode(const_cast<btree_page*>(bucket));
|
||||
BTreeNode::readNode(&node, pointer, bucket->btr_header.pag_flags, false);
|
||||
@ -1108,7 +1108,7 @@ static void analyze_index( dba_rel* relation, dba_idx* index)
|
||||
const UCHAR* const firstNode = pointer;
|
||||
while (true)
|
||||
{
|
||||
pointer = BTreeNode::readNode(&node, pointer,
|
||||
pointer = BTreeNode::readNode(&node, pointer,
|
||||
bucket->btr_header.pag_flags, true);
|
||||
|
||||
if (node.isEndBucket || node.isEndLevel) {
|
||||
@ -1118,7 +1118,7 @@ static void analyze_index( dba_rel* relation, dba_idx* index)
|
||||
++index->idx_nodes;
|
||||
index->idx_data_length += node.length;
|
||||
const USHORT l = node.length + node.prefix;
|
||||
|
||||
|
||||
bool dup;
|
||||
if (node.nodePointer == firstNode) {
|
||||
dup = BTreeNode::keyEquality(key_length, key, &node);
|
||||
@ -1272,7 +1272,7 @@ static void db_error( SLONG status)
|
||||
{
|
||||
sprintf(s, "unknown Windows NT error %ld", status);
|
||||
}
|
||||
|
||||
|
||||
tddba->uSvc->printf("%s\n", s);
|
||||
dba_exit(FINI_ERROR, tddba);
|
||||
}
|
||||
@ -1294,7 +1294,7 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
|
||||
*
|
||||
**************************************/
|
||||
tdba* tddba = tdba::getSpecific();
|
||||
|
||||
|
||||
dba_fil* fil;
|
||||
|
||||
if (tddba->files) {
|
||||
@ -1373,7 +1373,7 @@ static const pag* db_read( SLONG page_number)
|
||||
|
||||
dba_fil* fil;
|
||||
for (fil = tddba->files; page_number > (SLONG) fil->fil_max_page
|
||||
&& fil->fil_next;)
|
||||
&& fil->fil_next;)
|
||||
{
|
||||
fil = fil->fil_next;
|
||||
}
|
||||
@ -1404,13 +1404,13 @@ static const pag* db_read( SLONG page_number)
|
||||
NULL))
|
||||
{
|
||||
tddba->uSvc->setServiceStatus(GSTAT_MSG_FAC, 30, SafeArg());
|
||||
// msg 30: Can't read a database page
|
||||
// msg 30: Can't read a database page
|
||||
db_error(GetLastError());
|
||||
}
|
||||
if (actual_length != tddba->page_size) {
|
||||
tddba->uSvc->setServiceStatus(GSTAT_MSG_FAC, 4, SafeArg());
|
||||
dba_error(4);
|
||||
// msg 4: Unexpected end of database file.
|
||||
// msg 4: Unexpected end of database file.
|
||||
}
|
||||
|
||||
return tddba->global_buffer;
|
||||
@ -1498,7 +1498,7 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
|
||||
if ((fil->fil_desc = open(file_name, O_RDONLY)) == -1)
|
||||
{
|
||||
tddba->uSvc->setServiceStatus(GSTAT_MSG_FAC, 29, SafeArg() << file_name);
|
||||
// msg 29: Can't open database file %s
|
||||
// msg 29: Can't open database file %s
|
||||
db_error(errno);
|
||||
}
|
||||
|
||||
@ -1542,7 +1542,7 @@ static const pag* db_read( SLONG page_number)
|
||||
|
||||
dba_fil* fil;
|
||||
for (fil = tddba->files; page_number > (SLONG) fil->fil_max_page
|
||||
&& fil->fil_next;)
|
||||
&& fil->fil_next;)
|
||||
{
|
||||
fil = fil->fil_next;
|
||||
}
|
||||
@ -1551,7 +1551,7 @@ static const pag* db_read( SLONG page_number)
|
||||
const FB_UINT64 offset = ((FB_UINT64) page_number) * ((FB_UINT64) tddba->page_size);
|
||||
if (lseek (fil->fil_desc, offset, 0) == -1) {
|
||||
tddba->uSvc->setServiceStatus(GSTAT_MSG_FAC, 30, SafeArg());
|
||||
// msg 30: Can't read a database page
|
||||
// msg 30: Can't read a database page
|
||||
db_error(errno);
|
||||
}
|
||||
|
||||
@ -1561,13 +1561,13 @@ static const pag* db_read( SLONG page_number)
|
||||
const SSHORT l = read(fil->fil_desc, p, length);
|
||||
if (l < 0) {
|
||||
tddba->uSvc->setServiceStatus(GSTAT_MSG_FAC, 30, SafeArg());
|
||||
// msg 30: Can't read a database page
|
||||
// msg 30: Can't read a database page
|
||||
db_error(errno);
|
||||
}
|
||||
if (!l) {
|
||||
tddba->uSvc->setServiceStatus(GSTAT_MSG_FAC, 4, SafeArg());
|
||||
dba_error(4);
|
||||
// msg 4: Unexpected end of database file.
|
||||
// msg 4: Unexpected end of database file.
|
||||
}
|
||||
p += l;
|
||||
length -= l;
|
||||
|
@ -135,7 +135,7 @@ int stats_fetch(SLONG *status_vector, int **db_handle, STATS *stats_ptr)
|
||||
|
||||
if (isc_database_info(status_vector, db_handle, sizeof(info_request),
|
||||
info_request, sizeof(info_buffer),
|
||||
info_buffer))
|
||||
info_buffer))
|
||||
{
|
||||
return status_vector[1];
|
||||
}
|
||||
@ -152,7 +152,7 @@ int stats_fetch(SLONG *status_vector, int **db_handle, STATS *stats_ptr)
|
||||
status_vector[2] = isc_arg_end;
|
||||
return status_vector[1];
|
||||
}
|
||||
|
||||
|
||||
const SCHAR* const end = info_buffer + sizeof(info_buffer);
|
||||
for (const SCHAR* p = info_buffer; p < end && *p != isc_info_end;) {
|
||||
const SSHORT length = gds__vax_integer(p + 1, 2);
|
||||
@ -352,7 +352,7 @@ static int zap_longs(SLONG* ptr, SSHORT count)
|
||||
*ptr++ = 0;
|
||||
} while (--count);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user