8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 23:23:04 +01:00

-Macro cleaning.

-remove FB_FROM_ALICE_CPP, it is unused (set_thread_data is only used in alice.cpp) and contains uncompilable code inside.
This commit is contained in:
brodsom 2003-09-18 10:56:32 +00:00
parent 19543db576
commit a93ae54602
8 changed files with 313 additions and 277 deletions

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: alice.cpp,v 1.34 2003-09-15 16:25:49 brodsom Exp $
// $Id: alice.cpp,v 1.35 2003-09-18 10:56:32 brodsom Exp $
//
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports
@ -41,8 +41,6 @@
#include <string.h>
#include <stdarg.h>
#define FB_FROM_ALICE_CPP
#include "../alice/alice.h"
#include "../alice/aliceswi.h"
#include "../alice/all.h"
@ -94,10 +92,12 @@ static const USHORT val_err_table[] = {
struct tgbl *gdgbl;
#endif
#define ALICE_MSG_FAC 3
const int ALICE_MSG_FAC = 3;
#define EXIT(code) { tdgbl->exit_code = (code); \
Firebird::status_exception::raise(1); }
static inline void exit_local(int code, volatile tgbl* tdgbl){
tdgbl->exit_code = code;
Firebird::status_exception::raise(1);
}
#if defined (WIN95)
static bool fAnsiCP = false;
@ -524,7 +524,7 @@ int common_main(int argc,
// catch the case where -z is only command line option
// switches is unset since sw_z == 0
if (!switches && !error && table->in_sw_value == sw_z) {
EXIT(FINI_OK);
exit_local(FINI_OK, tdgbl);
}
if (!switches || !(switches & ~(sw_user | sw_password))) {
@ -546,7 +546,7 @@ int common_main(int argc,
ALICE_print(table->in_sw_msg, 0, 0, 0, 0, 0);
ALICE_print(22, 0, 0, 0, 0, 0); /* msg 22: \n qualifiers show the major option in parenthesis */
#endif
EXIT(FINI_ERROR);
exit_local(FINI_ERROR, tdgbl);
}
if (!database) {
@ -598,19 +598,19 @@ int common_main(int argc,
ALICE_print_status(tdgbl->status);
}
EXIT(FINI_OK);
exit_local(FINI_OK, tdgbl);
} // try
catch (const std::exception&)
{
/* All "calls" to EXIT(), normal and error exits, wind up here */
/* All "calls" to exit_local(), normal and error exits, wind up here */
SVC_STARTED(tdgbl->service_blk);
int exit_code = tdgbl->exit_code;
/* Close the status output file */
if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) {
if (tdgbl->sw_redirect == REDIRECT && tdgbl->output_file != NULL) {
ib_fclose(tdgbl->output_file);
tdgbl->output_file = NULL;
}
@ -743,7 +743,7 @@ void ALICE_error(USHORT number,
arg2, arg3, arg4, arg5);
translate_cp(buffer);
alice_output("%s\n", buffer);
EXIT(FINI_ERROR);
exit_local(FINI_ERROR, tdgbl);
}
@ -773,7 +773,7 @@ static void alice_output(const SCHAR * format, ...)
if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') {
exit_code = tdgbl->output_proc(tdgbl->output_data, (UCHAR *)(""));
}
else if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) {
else if (tdgbl->sw_redirect == REDIRECT && tdgbl->output_file != NULL) {
VA_START(arglist, format);
ib_vfprintf(tdgbl->output_file, format, arglist);
va_end(arglist);
@ -788,7 +788,7 @@ static void alice_output(const SCHAR * format, ...)
}
if (exit_code != 0) {
EXIT(exit_code);
exit_local(exit_code, tdgbl);
}
}

View File

@ -36,25 +36,20 @@
#include <vector>
#define BLKDEF(type, root, tail) type,
enum alice_blk_t
{
alice_type_MIN = 0,
#include "../alice/blk.h"
alice_type_MAX
};
#undef BLKDEF
#define VAL_INVALID_DB_VERSION 0
#define VAL_RECORD_ERRORS 1
#define VAL_BLOB_PAGE_ERRORS 2
#define VAL_DATA_PAGE_ERRORS 3
#define VAL_INDEX_PAGE_ERRORS 4
#define VAL_POINTER_PAGE_ERRORS 5
#define VAL_TIP_PAGE_ERRORS 6
#define VAL_PAGE_ERRORS 7
#define MAX_VAL_ERRORS 8
enum val_values
{
VAL_INVALID_DB_VERSION = 0,
VAL_RECORD_ERRORS = 1,
VAL_BLOB_PAGE_ERRORS = 2,
VAL_DATA_PAGE_ERRORS = 3,
VAL_INDEX_PAGE_ERRORS = 4,
VAL_POINTER_PAGE_ERRORS = 5,
VAL_TIP_PAGE_ERRORS = 6,
VAL_PAGE_ERRORS = 7,
MAX_VAL_ERRORS = 8
};
typedef struct user_action
{
@ -105,25 +100,32 @@ typedef struct tdr : public pool_alloc<alice_type_tdr>
/* Transaction Description Record */
#define TDR_VERSION 1
#define TDR_HOST_SITE 1
#define TDR_DATABASE_PATH 2
#define TDR_TRANSACTION_ID 3
#define TDR_REMOTE_SITE 4
const int TDR_VERSION = 1;
enum tdr_vals
{
TDR_HOST_SITE = 1,
TDR_DATABASE_PATH = 2,
TDR_TRANSACTION_ID = 3,
TDR_REMOTE_SITE = 4,
TDR_PROTOCOL = 5
};
/* flags for tdr_db_caps */
#define CAP_none 0
#define CAP_transactions 1 /* db has a RDB$TRANSACTIONS relation */
enum tdr_db_caps_vals {
CAP_none = 0,
CAP_transactions = 1
};
/* db has a RDB$TRANSACTIONS relation */
/* flags for tdr_state */
#define TRA_none 0 /* transaction description record is missing */
#define TRA_limbo 1 /* has been prepared */
#define TRA_commit 2 /* has committed */
#define TRA_rollback 3 /* has rolled back */
#define TRA_unknown 4 /* database couldn't be reattached, state is unknown */
enum tdr_state_vals {
TRA_none = 0, /* transaction description record is missing */
TRA_limbo = 1, /* has been prepared */
TRA_commit = 2, /* has committed */
TRA_rollback = 3, /* has rolled back */
TRA_unknown = 4 /* database couldn't be reattached, state is unknown */
};
/* a couple of obscure blocks used only in data allocator routines */
@ -147,6 +149,12 @@ typedef vcl *VCL;
#include "../jrd/svc.h"
enum redirect_vals {
NOREDIRECT = 0,
REDIRECT = 1,
NOOUTPUT = 2
};
class tgbl
{
public:
@ -168,7 +176,7 @@ public:
isc_db_handle db_handle;
isc_tr_handle tr_handle;
ISC_STATUS* status;
USHORT sw_redirect;
redirect_vals sw_redirect;
bool sw_service;
bool sw_service_thd;
};
@ -180,16 +188,9 @@ typedef tgbl *TGBL;
#ifdef SUPERSERVER
#define GET_THREAD_DATA ((TGBL) THD_get_specific())
#ifdef FB_FROM_ALICE_CPP
#define SET_THREAD_DATA THD_put_specific ((THDD) tdgbl); \
tdgbl->tgbl_thd_data.thdd_type = \
THDD_TYPE_TALICE
#else /* FB_FROM_ALICE_CPP */
#define SET_THREAD_DATA THD_put_specific ((THDD) tdgbl); \
tdgbl->tgbl_thd_data.thdd_type = \
reinterpret_cast<tgbl*>(THDD_TYPE_TALICE)
#endif /* FB_FROM_ALICE_CPP */
#define RESTORE_THREAD_DATA THD_restore_specific();
#else
extern tgbl *gdgbl;
@ -200,6 +201,4 @@ extern tgbl *gdgbl;
#define RESTORE_THREAD_DATA
#endif
#define NOOUTPUT 2
#endif // ALICE_ALICE_H

View File

@ -27,7 +27,7 @@
*
*____________________________________________________________
*
* $Id: alice_meta.epp,v 1.17 2003-09-15 13:11:01 brodsom Exp $
* $Id: alice_meta.epp,v 1.18 2003-09-18 10:56:32 brodsom Exp $
*/
#include "firebird.h"
@ -47,15 +47,6 @@
#include <string.h>
/* Transaction Description Record */
#define TDR_VERSION 1
#define TDR_HOST_SITE 1
#define TDR_DATABASE_PATH 2
#define TDR_TRANSACTION_ID 3
#define TDR_REMOTE_SITE 4
#define TDR_PROTOCOL 5
/* For service APIs the follow DB handle is #defined to be a value stored
* in thread data. This is also done for other statics generated by
* GPRE. This is to avoid multiple threading problems with module
@ -63,9 +54,6 @@
*/
DATABASE DB = STATIC FILENAME "yachts.lnk";
#define DB tdgbl->db_handle
#define gds_trans tdgbl->tr_handle
static STR alloc_string(TEXT **);
static USHORT get_capabilities(ISC_STATUS *);
static TDR get_description(SLONG[2]);
@ -89,10 +77,18 @@ static rfr_tab_t rfr_table[] = {
{ 0, 0, 0 }
};
#define RETURN_ERROR(user_status) \
{ ALICE_print_status (gds_status); \
Firebird::status_exception::raise(0); }
static inline void return_error(ISC_STATUS *user_status){
ALICE_print_status(gds_status);
Firebird::status_exception::raise(0);
}
static inline TGBL get_data(void)
{
TGBL temp = GET_THREAD_DATA;
DB = temp->db_handle;
gds_trans = temp->tr_handle;
return temp;
}
/*____________________________________________________________
*
@ -105,15 +101,22 @@ void MET_disable_wal(ISC_STATUS * user_status, isc_db_handle handle)
FRBRD *request = NULL;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
tdgbl = get_data();
if (!(DB = handle))
return;
START_TRANSACTION ON_ERROR RETURN_ERROR(user_status) END_ERROR;
START_TRANSACTION
ON_ERROR
return_error(user_status);
END_ERROR;
FOR(REQUEST_HANDLE request)
X IN RDB$LOG_FILES ERASE X;
END_FOR COMMIT ON_ERROR RETURN_ERROR(user_status) END_ERROR;
END_FOR
COMMIT
ON_ERROR
return_error(user_status);
END_ERROR;
}
@ -129,7 +132,7 @@ void MET_get_state(ISC_STATUS * user_status, TDR trans)
FRBRD *request = NULL;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
tdgbl = get_data();
if (!(DB = trans->tdr_db_handle) ||
!(trans->tdr_db_caps & CAP_transactions)) {
@ -137,20 +140,29 @@ void MET_get_state(ISC_STATUS * user_status, TDR trans)
return;
}
START_TRANSACTION ON_ERROR RETURN_ERROR(user_status) END_ERROR;
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 RETURN_ERROR(user_status) END_ERROR;
END_FOR
ON_ERROR
return_error(user_status);
END_ERROR;
gds__release_request(gds_status, &request);
if (gds_status[1]) {
RETURN_ERROR(user_status)
return_error(user_status);
}
ROLLBACK ON_ERROR RETURN_ERROR(user_status) END_ERROR;
ROLLBACK
ON_ERROR
return_error(user_status);
END_ERROR;
}
@ -168,12 +180,15 @@ TDR MET_get_transaction(ISC_STATUS * user_status, isc_db_handle handle, SLONG id
USHORT capabilities;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
tdgbl = get_data();
if (!(DB = handle))
return 0;
START_TRANSACTION ON_ERROR RETURN_ERROR(user_status) END_ERROR;
START_TRANSACTION
ON_ERROR
return_error(user_status);
END_ERROR;
capabilities = get_capabilities(user_status);
@ -183,15 +198,21 @@ 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((SLONG*)&TRA.RDB$TRANSACTION_DESCRIPTION);
END_FOR ON_ERROR RETURN_ERROR(user_status) END_ERROR;
END_FOR
ON_ERROR
return_error(user_status);
END_ERROR;
gds__release_request(gds_status, &request);
if (gds_status[1]) {
RETURN_ERROR(user_status)
return_error(user_status);
}
}
ROLLBACK ON_ERROR RETURN_ERROR(user_status) END_ERROR;
ROLLBACK
ON_ERROR
return_error(user_status);
END_ERROR;
if (trans)
trans->tdr_db_caps = capabilities;
@ -210,16 +231,22 @@ void MET_set_capabilities(ISC_STATUS * user_status, TDR trans)
{
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
tdgbl = get_data();
if (!(DB = trans->tdr_db_handle))
return;
START_TRANSACTION ON_ERROR RETURN_ERROR(user_status) END_ERROR;
START_TRANSACTION
ON_ERROR
return_error(user_status);
END_ERROR;
trans->tdr_db_caps = get_capabilities(user_status);
ROLLBACK ON_ERROR RETURN_ERROR(user_status) END_ERROR;
ROLLBACK
ON_ERROR
return_error(user_status);
END_ERROR;
}
@ -235,7 +262,7 @@ static STR alloc_string(TEXT ** ptr)
STR string;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
tdgbl = get_data();
p = *ptr;
@ -267,7 +294,7 @@ static USHORT get_capabilities(ISC_STATUS * user_status)
USHORT capabilities = CAP_none;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
tdgbl = get_data();
req = NULL;
@ -279,12 +306,15 @@ static USHORT get_capabilities(ISC_STATUS * user_status)
RDB$RELATION_FIELDS 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 RETURN_ERROR(user_status) END_ERROR;
END_FOR
ON_ERROR
return_error(user_status);
END_ERROR;
}
gds__release_request(gds_status, &req);
if (gds_status[1]) {
RETURN_ERROR(user_status)
return_error(user_status);
}
return capabilities;
@ -307,7 +337,7 @@ static TDR get_description(SLONG blob_id[2])
STR host_site, database_path;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
tdgbl = get_data();
p = buffer;
if (length = snarf_blob(blob_id, (USHORT) sizeof(buffer), buffer)) {
@ -377,7 +407,7 @@ static void parse_fullpath(TDR trans)
USHORT length;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
tdgbl = get_data();
/* start at the end of the full pathname */
@ -457,7 +487,7 @@ static USHORT snarf_blob(SLONG blob_id[2],
FRBRD *blob;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
tdgbl = get_data();
if (buffer_length)
buffer[0] = 0;

View File

@ -28,91 +28,92 @@
/* switch definitions */
#define sw_list 0x00000001L /* Byte 0, Bit 0 */
#define sw_prompt 0x00000002L
#define sw_commit 0x00000004L
#define sw_rollback 0x00000008L
#define sw_sweep 0x00000010L
#define sw_validate 0x00000020L
#define sw_no_update 0x00000040L
#define sw_full 0x00000080L
#define sw_mend 0x00000100L /* Byte 1, Bit 0 */
#define sw_all 0x00000200L
#define sw_enable 0x00000400L
#define sw_disable 0x00000800L
#define sw_ignore 0x00001000L
#define sw_activate 0x00002000L
#define sw_two_phase 0x00004000L
#define sw_housekeeping 0x00008000L
#define sw_kill 0x00010000L /* Byte 2, Bit 0 */
#define sw_begin_log 0x00020000L
#define sw_quit_log 0x00040000L
#define sw_write 0x00080000L
#define sw_use 0x00100000L
#define sw_user 0x00200000L
#define sw_password 0x00400000L
#define sw_shut 0x00800000L
#define sw_online 0x01000000L /* Byte 3, Bit 0 */
#define sw_cache 0x02000000L
#define sw_attach 0x04000000L
#define sw_force 0x08000000L
#define sw_tran 0x10000000L
#define sw_buffers 0x20000000L
#define sw_mode 0x40000000L
#define sw_set_db_dialect 0x80000000L
#define sw_z 0x0L
const long sw_list = 0x00000001L; /* Byte 0, Bit 0 */
const long sw_prompt = 0x00000002L;
const long sw_commit = 0x00000004L;
const long sw_rollback = 0x00000008L;
const long sw_sweep = 0x00000010L;
const long sw_validate = 0x00000020L;
const long sw_no_update = 0x00000040L;
const long sw_full = 0x00000080L;
const long sw_mend = 0x00000100L; /* Byte 1, Bit 0 */
const long sw_all = 0x00000200L;
const long sw_enable = 0x00000400L;
const long sw_disable = 0x00000800L;
const long sw_ignore = 0x00001000L;
const long sw_activate = 0x00002000L;
const long sw_two_phase = 0x00004000L;
const long sw_housekeeping = 0x00008000L;
const long sw_kill = 0x00010000L; /* Byte 2, Bit 0 */
const long sw_begin_log = 0x00020000L;
const long sw_quit_log = 0x00040000L;
const long sw_write = 0x00080000L;
const long sw_use = 0x00100000L;
const long sw_user = 0x00200000L;
const long sw_password = 0x00400000L;
const long sw_shut = 0x00800000L;
const long sw_online = 0x01000000L; /* Byte 3, Bit 0 */
const long sw_cache = 0x02000000L;
const long sw_attach = 0x04000000L;
const long sw_force = 0x08000000L;
const long sw_tran = 0x10000000L;
const long sw_buffers = 0x20000000L;
const long sw_mode = 0x40000000L;
const long sw_set_db_dialect= 0x80000000L;
const long sw_z = 0x0L;
#define SW_MEND sw_mend | sw_validate | sw_full
enum alice_switches
{
IN_SW_ALICE_0 = 0, /* not a known switch */
IN_SW_ALICE_LIST = 1,
IN_SW_ALICE_PROMPT = 2,
IN_SW_ALICE_COMMIT = 3,
IN_SW_ALICE_ROLLBACK = 4,
IN_SW_ALICE_SWEEP = 5,
IN_SW_ALICE_VALIDATE = 6,
IN_SW_ALICE_NO_UPDATE = 7,
IN_SW_ALICE_FULL = 8,
IN_SW_ALICE_MEND = 9,
IN_SW_ALICE_ALL = 10,
IN_SW_ALICE_ENABLE = 11,
IN_SW_ALICE_DISABLE = 12,
IN_SW_ALICE_IGNORE = 13,
IN_SW_ALICE_ACTIVATE = 14,
IN_SW_ALICE_TWO_PHASE = 15,
IN_SW_ALICE_HOUSEKEEPING = 16,
IN_SW_ALICE_KILL = 17,
IN_SW_ALICE_BEGIN_LOG = 18,
IN_SW_ALICE_QUIT_LOG = 19,
IN_SW_ALICE_WRITE = 20,
IN_SW_ALICE_USE = 21,
IN_SW_ALICE_USER = 22,
IN_SW_ALICE_PASSWORD = 23,
IN_SW_ALICE_SHUT = 24,
IN_SW_ALICE_ONLINE = 25,
IN_SW_ALICE_CACHE = 26,
IN_SW_ALICE_ATTACH = 27,
IN_SW_ALICE_FORCE = 28,
IN_SW_ALICE_TRAN = 29,
IN_SW_ALICE_BUFFERS = 30,
IN_SW_ALICE_Z = 31,
IN_SW_ALICE_X = 32, /* set debug mode on */
IN_SW_ALICE_HIDDEN_ASYNC = 33,
IN_SW_ALICE_HIDDEN_SYNC = 34,
IN_SW_ALICE_HIDDEN_USEALL = 35,
IN_SW_ALICE_HIDDEN_RESERVE = 36,
IN_SW_ALICE_HIDDEN_RDONLY = 37,
IN_SW_ALICE_HIDDEN_RDWRITE = 38,
IN_SW_ALICE_MODE = 39,
IN_SW_ALICE_HIDDEN_FORCE = 40,
IN_SW_ALICE_HIDDEN_TRAN = 41,
IN_SW_ALICE_HIDDEN_ATTACH = 42,
IN_SW_ALICE_SET_DB_SQL_DIALECT = 43
};
#define IN_SW_ALICE_0 0 /* not a known switch */
#define IN_SW_ALICE_LIST 1
#define IN_SW_ALICE_PROMPT 2
#define IN_SW_ALICE_COMMIT 3
#define IN_SW_ALICE_ROLLBACK 4
#define IN_SW_ALICE_SWEEP 5
#define IN_SW_ALICE_VALIDATE 6
#define IN_SW_ALICE_NO_UPDATE 7
#define IN_SW_ALICE_FULL 8
#define IN_SW_ALICE_MEND 9
#define IN_SW_ALICE_ALL 10
#define IN_SW_ALICE_ENABLE 11
#define IN_SW_ALICE_DISABLE 12
#define IN_SW_ALICE_IGNORE 13
#define IN_SW_ALICE_ACTIVATE 14
#define IN_SW_ALICE_TWO_PHASE 15
#define IN_SW_ALICE_HOUSEKEEPING 16
#define IN_SW_ALICE_KILL 17
#define IN_SW_ALICE_BEGIN_LOG 18
#define IN_SW_ALICE_QUIT_LOG 19
#define IN_SW_ALICE_WRITE 20
#define IN_SW_ALICE_USE 21
#define IN_SW_ALICE_USER 22
#define IN_SW_ALICE_PASSWORD 23
#define IN_SW_ALICE_SHUT 24
#define IN_SW_ALICE_ONLINE 25
#define IN_SW_ALICE_CACHE 26
#define IN_SW_ALICE_ATTACH 27
#define IN_SW_ALICE_FORCE 28
#define IN_SW_ALICE_TRAN 29
#define IN_SW_ALICE_BUFFERS 30
#define IN_SW_ALICE_Z 31
#define IN_SW_ALICE_X 32 /* set debug mode on */
#define IN_SW_ALICE_HIDDEN_ASYNC 33
#define IN_SW_ALICE_HIDDEN_SYNC 34
#define IN_SW_ALICE_HIDDEN_USEALL 35
#define IN_SW_ALICE_HIDDEN_RESERVE 36
#define IN_SW_ALICE_HIDDEN_RDONLY 37
#define IN_SW_ALICE_HIDDEN_RDWRITE 38
#define IN_SW_ALICE_MODE 39
#define IN_SW_ALICE_HIDDEN_FORCE 40
#define IN_SW_ALICE_HIDDEN_TRAN 41
#define IN_SW_ALICE_HIDDEN_ATTACH 42
#define IN_SW_ALICE_SET_DB_SQL_DIALECT 43
#define ALICE_SW_ASYNC "async"
#define ALICE_SW_SYNC "sync"
#define ALICE_SW_MODE_RO "read_only"
#define ALICE_SW_MODE_RW "read_write"
static const char* ALICE_SW_ASYNC = "async";
static const char* ALICE_SW_SYNC = "sync";
static const char* ALICE_SW_MODE_RO = "read_only";
static const char* ALICE_SW_MODE_RW = "read_write";
/* Switch table */
static in_sw_tab_t alice_in_sw_table[] =
@ -161,7 +162,7 @@ static in_sw_tab_t alice_in_sw_table[] =
{IN_SW_ALICE_LIST, isc_spb_rpr_list_limbo_trans, "list", sw_list,
0, ~(sw_list | sw_user | sw_password), FALSE, 37, 0, NULL},
/* msg 37: \t-list\t\tshow limbo transactions */
{IN_SW_ALICE_MEND, isc_spb_rpr_mend_db, "mend", SW_MEND,
{IN_SW_ALICE_MEND, isc_spb_rpr_mend_db, "mend", sw_mend | sw_validate | sw_full,
0, ~(sw_no_update | sw_user | sw_password), FALSE, 38, 0, NULL},
/* msg 38: \t-mend\t\tprepare corrupt database for backup */
{IN_SW_ALICE_MODE, 0, "mode", sw_mode,

View File

@ -21,11 +21,16 @@
* Contributor(s): ______________________________________.
*/
BLKDEF(alice_type_frb, frb, 0)
BLKDEF(alice_type_hnk, hnk, 0)
BLKDEF(alice_type_plb, plb, 0)
BLKDEF(alice_type_vec, vec, sizeof(((VEC) NULL)->vec_object[0]))
BLKDEF(alice_type_vcl, vcl, sizeof(((VCL) NULL)->vcl_long[0]))
BLKDEF(alice_type_tdr, tdr, 0) /* transaction description */
BLKDEF(alice_type_str, str, 1) /* general string block */
BLKDEF(alice_type_lls, lls, 0)
enum alice_blk_t
{
alice_type_MIN = 0,
alice_type_frb,
alice_type_hnk,
alice_type_plb,
alice_type_vec,
alice_type_vcl,
alice_type_tdr,
alice_type_str,
alice_type_lls,
alice_type_MAX
};

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: exe.cpp,v 1.16 2003-09-15 13:11:01 brodsom Exp $
// $Id: exe.cpp,v 1.17 2003-09-18 10:56:32 brodsom Exp $
//
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports
@ -61,13 +61,18 @@ static TEXT val_errors[] =
isc_info_tpage_errors, gds_info_end
};
#define STUFF_DPB(blr) {*d++ = (UCHAR)(blr);}
#define STUFF_DPB_INT(blr) \
{ \
STUFF_DPB(blr); \
STUFF_DPB((blr) >> 8); \
STUFF_DPB((blr) >> 16); \
STUFF_DPB((blr) >> 24); \
static inline void stuff_dpb(UCHAR **d, int blr)
{
UCHAR *ptr = *d;
*ptr++ = (UCHAR)(blr);
*d = ptr;
}
static inline void stuff_dpb_int(UCHAR **d, int blr)
{
stuff_dpb(d, blr);
stuff_dpb(d, (blr) >> 8);
stuff_dpb(d, (blr) >> 16);
stuff_dpb(d, (blr) >> 24);
}
@ -190,7 +195,7 @@ int EXE_two_phase(TEXT * database, ULONG switches)
static USHORT build_dpb(UCHAR * dpb, ULONG switches)
{
UCHAR *d;
UCHAR *dpb2;
USHORT dpb_length;
SSHORT i;
TEXT *q;
@ -198,146 +203,145 @@ static USHORT build_dpb(UCHAR * dpb, ULONG switches)
tdgbl = GET_THREAD_DATA;
d = dpb;
*d++ = gds_dpb_version1;
*d++ = isc_dpb_gfix_attach;
*d++ = 0;
dpb2 = dpb;
*dpb2++ = gds_dpb_version1;
*dpb2++ = isc_dpb_gfix_attach;
*dpb2++ = 0;
if (switches & sw_sweep) {
*d++ = gds_dpb_sweep;
*d++ = 1;
*d++ = gds_dpb_records;
*dpb2++ = gds_dpb_sweep;
*dpb2++ = 1;
*dpb2++ = gds_dpb_records;
}
else if (switches & sw_activate) {
*d++ = gds_dpb_activate_shadow;
*d++ = 0;
*dpb2++ = gds_dpb_activate_shadow;
*dpb2++ = 0;
}
else if (switches & sw_validate) {
*d++ = gds_dpb_verify;
*d++ = 1;
*d = gds_dpb_pages;
*dpb2++ = gds_dpb_verify;
*dpb2++ = 1;
*dpb2 = gds_dpb_pages;
if (switches & sw_full)
*d |= gds_dpb_records;
*dpb2 |= gds_dpb_records;
if (switches & sw_no_update)
*d |= gds_dpb_no_update;
*dpb2 |= gds_dpb_no_update;
if (switches & sw_mend)
*d |= gds_dpb_repair;
*dpb2 |= gds_dpb_repair;
if (switches & sw_ignore)
*d |= gds_dpb_ignore;
d++;
*dpb2 |= gds_dpb_ignore;
dpb2++;
}
else if (switches & sw_housekeeping) {
*d++ = gds_dpb_sweep_interval;
*d++ = 4;
*dpb2++ = gds_dpb_sweep_interval;
*dpb2++ = 4;
for (i = 0; i < 4;
i++, tdgbl->ALICE_data.ua_sweep_interval =
tdgbl->ALICE_data.ua_sweep_interval >> 8)
{
/* TMN: Here we should really have the following assert */
/* assert(tdgbl->ALICE_data.ua_sweep_interval <= MAX_UCHAR); */
*d++ = (UCHAR) tdgbl->ALICE_data.ua_sweep_interval;
*dpb2++ = (UCHAR) tdgbl->ALICE_data.ua_sweep_interval;
}
}
else if (switches & sw_begin_log) {
*d++ = gds_dpb_begin_log;
*d++ = strlen(tdgbl->ALICE_data.ua_log_file);
*dpb2++ = gds_dpb_begin_log;
*dpb2++ = strlen(tdgbl->ALICE_data.ua_log_file);
for (q = tdgbl->ALICE_data.ua_log_file; *q;)
*d++ = *q++;
*dpb2++ = *q++;
}
else if (switches & sw_buffers) {
*d++ = isc_dpb_set_page_buffers;
*d++ = 4;
*dpb2++ = isc_dpb_set_page_buffers;
*dpb2++ = 4;
for (i = 0; i < 4;
i++, tdgbl->ALICE_data.ua_page_buffers =
tdgbl->ALICE_data.ua_page_buffers >> 8)
{
/* TMN: Here we should really have the following assert */
/* assert(tdgbl->ALICE_data.ua_page_buffers <= MAX_UCHAR); */
*d++ = (UCHAR) tdgbl->ALICE_data.ua_page_buffers;
*dpb2++ = (UCHAR) tdgbl->ALICE_data.ua_page_buffers;
}
}
else if (switches & sw_quit_log) {
*d++ = gds_dpb_quit_log;
*d++ = 0;
*dpb2++ = gds_dpb_quit_log;
*dpb2++ = 0;
}
else if (switches & sw_kill) {
*d++ = gds_dpb_delete_shadow;
*d++ = 0;
*dpb2++ = gds_dpb_delete_shadow;
*dpb2++ = 0;
}
else if (switches & sw_write) {
*d++ = gds_dpb_force_write;
*d++ = 1;
*d++ = tdgbl->ALICE_data.ua_force ? 1 : 0;
*dpb2++ = gds_dpb_force_write;
*dpb2++ = 1;
*dpb2++ = tdgbl->ALICE_data.ua_force ? 1 : 0;
}
else if (switches & sw_use) {
*d++ = gds_dpb_no_reserve;
*d++ = 1;
*d++ = tdgbl->ALICE_data.ua_use ? 1 : 0;
*dpb2++ = gds_dpb_no_reserve;
*dpb2++ = 1;
*dpb2++ = tdgbl->ALICE_data.ua_use ? 1 : 0;
}
else if (switches & sw_mode) {
*d++ = isc_dpb_set_db_readonly;
*d++ = 1;
*d++ = (tdgbl->ALICE_data.ua_read_only) ? 1 : 0;
*dpb2++ = isc_dpb_set_db_readonly;
*dpb2++ = 1;
*dpb2++ = (tdgbl->ALICE_data.ua_read_only) ? 1 : 0;
}
else if (switches & sw_shut) {
*d++ = gds_dpb_shutdown;
*d++ = 1;
*d = 0;
*dpb2++ = gds_dpb_shutdown;
*dpb2++ = 1;
*dpb2 = 0;
if (switches & sw_attach)
*d |= gds_dpb_shut_attachment;
*dpb2 |= gds_dpb_shut_attachment;
else if (switches & sw_cache)
*d |= gds_dpb_shut_cache;
*dpb2 |= gds_dpb_shut_cache;
else if (switches & sw_force)
*d |= gds_dpb_shut_force;
*dpb2 |= gds_dpb_shut_force;
else if (switches & sw_tran)
*d |= gds_dpb_shut_transaction;
d++;
*d++ = gds_dpb_shutdown_delay;
*d++ = 2; /* Build room for shutdown delay */
*dpb2 |= gds_dpb_shut_transaction;
dpb2++;
*dpb2++ = gds_dpb_shutdown_delay;
*dpb2++ = 2; /* Build room for shutdown delay */
/* TMN: Here we should really have the following assert */
/* assert(tdgbl->ALICE_data.ua_page_buffers <= MAX_USHORT); */
/* or maybe even compare with MAX_SSHORT */
*d++ = (UCHAR) tdgbl->ALICE_data.ua_shutdown_delay;
*d++ = (UCHAR) (tdgbl->ALICE_data.ua_shutdown_delay >> 8);
*dpb2++ = (UCHAR) tdgbl->ALICE_data.ua_shutdown_delay;
*dpb2++ = (UCHAR) (tdgbl->ALICE_data.ua_shutdown_delay >> 8);
}
else if (switches & sw_online) {
*d++ = gds_dpb_online;
*d++ = 0;
*dpb2++ = gds_dpb_online;
*dpb2++ = 0;
}
else if (switches & sw_disable) {
*d++ = isc_dpb_disable_wal;
*d++ = 0;
*dpb2++ = isc_dpb_disable_wal;
*dpb2++ = 0;
}
else if (switches & (sw_list | sw_commit | sw_rollback | sw_two_phase)) {
*d++ = gds_dpb_no_garbage_collect;
*d++ = 0;
*dpb2++ = gds_dpb_no_garbage_collect;
*dpb2++ = 0;
}
else if (switches & sw_set_db_dialect) {
STUFF_DPB(isc_dpb_set_db_sql_dialect);
STUFF_DPB(4);
STUFF_DPB_INT(tdgbl->ALICE_data.ua_db_SQL_dialect);
stuff_dpb(&dpb2, isc_dpb_set_db_sql_dialect);
stuff_dpb(&dpb2, 4);
stuff_dpb_int(&dpb2, tdgbl->ALICE_data.ua_db_SQL_dialect);
}
if (tdgbl->ALICE_data.ua_user) {
*d++ = gds_dpb_user_name;
*d++ =
strlen(reinterpret_cast <
const char *>(tdgbl->ALICE_data.ua_user));
*dpb2++ = gds_dpb_user_name;
*dpb2++ = strlen(reinterpret_cast <const char *>(tdgbl->ALICE_data.ua_user));
for (q = reinterpret_cast <TEXT *>(tdgbl->ALICE_data.ua_user); *q;)
*d++ = *q++;
*dpb2++ = *q++;
}
if (tdgbl->ALICE_data.ua_password) {
if (!tdgbl->sw_service)
*d++ = gds_dpb_password;
*dpb2++ = gds_dpb_password;
else
*d++ = gds_dpb_password_enc;
*d++ =
strlen(reinterpret_cast <
const char *>(tdgbl->ALICE_data.ua_password));
for (q = reinterpret_cast < TEXT * >(tdgbl->ALICE_data.ua_password);
*q;)
*d++ = *q++;
*dpb2++ = gds_dpb_password_enc;
*dpb2++ = strlen(reinterpret_cast <const char *>(tdgbl->ALICE_data.ua_password));
for (q = reinterpret_cast < TEXT * >(tdgbl->ALICE_data.ua_password); *q;)
*dpb2++ = *q++;
}
dpb_length = d - dpb;
dpb_length = dpb2 - dpb;
if (dpb_length == 1)
dpb_length = 0;

View File

@ -24,9 +24,6 @@
#ifndef ALICE_LLS_H
#define ALICE_LLS_H
#define LLS_PUSH(object, stack) AliceMemoryPool::ALLA_push(object, stack)
#define LLS_POP(stack) AliceMemoryPool::ALLA_pop(stack)
typedef struct lls {
struct blk *lls_object;
struct lls *lls_next;

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: tdr.cpp,v 1.21 2003-09-15 16:25:49 brodsom Exp $
// $Id: tdr.cpp,v 1.22 2003-09-18 10:56:32 brodsom Exp $
//
// 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete "Apollo" port
//
@ -56,7 +56,7 @@ static void reattach_databases(TDR);
static bool reconnect(FRBRD *, SLONG, TEXT *, ULONG);
#define NEWLINE "\n"
const char* NEWLINE="\n";
static UCHAR limbo_info[] = { gds_info_limbo, gds_info_end };