mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 21:23:03 +01:00
The flags field is SINT64, not ULONG (upgrade it).
"switches" changed to "flags" in tdr.cpp to allow code that resembles other utilities (need also for impending commit after 2.5).
This commit is contained in:
parent
0e47d58f97
commit
c65d7cca2a
@ -141,7 +141,7 @@ int alice(Firebird::UtilSvc* uSvc)
|
|||||||
// Start by parsing switches
|
// Start by parsing switches
|
||||||
|
|
||||||
bool error = false, help = false;
|
bool error = false, help = false;
|
||||||
ULONG switches = 0;
|
SINT64 flags = 0;
|
||||||
tdgbl->ALICE_data.ua_shutdown_delay = 0;
|
tdgbl->ALICE_data.ua_shutdown_delay = 0;
|
||||||
const TEXT* database = NULL;
|
const TEXT* database = NULL;
|
||||||
TEXT string[512];
|
TEXT string[512];
|
||||||
@ -226,14 +226,14 @@ int alice(Firebird::UtilSvc* uSvc)
|
|||||||
if (table->in_sw_value == sw_z) {
|
if (table->in_sw_value == sw_z) {
|
||||||
ALICE_print(3, SafeArg() << GDS_VERSION); // msg 3: gfix version %s
|
ALICE_print(3, SafeArg() << GDS_VERSION); // msg 3: gfix version %s
|
||||||
}
|
}
|
||||||
if ((table->in_sw_incompatibilities & switches) ||
|
if ((table->in_sw_incompatibilities & flags) ||
|
||||||
(table->in_sw_requires && !(table->in_sw_requires & switches)))
|
(table->in_sw_requires && !(table->in_sw_requires & flags)))
|
||||||
{
|
{
|
||||||
ALICE_print(4); // msg 4: incompatible switch combination
|
ALICE_print(4); // msg 4: incompatible switch combination
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switches |= table->in_sw_value;
|
flags |= table->in_sw_value;
|
||||||
|
|
||||||
if ((table->in_sw_value & (sw_shut | sw_online)) && (argc > 1))
|
if ((table->in_sw_value & (sw_shut | sw_online)) && (argc > 1))
|
||||||
{
|
{
|
||||||
@ -333,7 +333,7 @@ int alice(Firebird::UtilSvc* uSvc)
|
|||||||
ALICE_error(10); // msg 10: transaction number or "all" required
|
ALICE_error(10); // msg 10: transaction number or "all" required
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switches |= sw_list;
|
flags |= sw_list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -463,18 +463,18 @@ int alice(Firebird::UtilSvc* uSvc)
|
|||||||
|
|
||||||
// put this here since to put it above overly complicates the parsing
|
// put this here since to put it above overly complicates the parsing
|
||||||
// can't use tbl_requires since it only looks backwards on command line
|
// can't use tbl_requires since it only looks backwards on command line
|
||||||
if ((switches & sw_shut) && !(switches & ((sw_attach | sw_force | sw_tran | sw_cache))))
|
if ((flags & sw_shut) && !(flags & ((sw_attach | sw_force | sw_tran | sw_cache))))
|
||||||
{
|
{
|
||||||
ALICE_error(19); // msg 19: must specify type of shutdown
|
ALICE_error(19); // msg 19: must specify type of shutdown
|
||||||
}
|
}
|
||||||
|
|
||||||
// catch the case where -z is only command line option
|
// catch the case where -z is only command line option
|
||||||
// switches is unset since sw_z == 0
|
// flags is unset since sw_z == 0
|
||||||
if (!switches && !error && table->in_sw_value == sw_z) {
|
if (!flags && !error && table->in_sw_value == sw_z) {
|
||||||
ALICE_exit(FINI_OK, tdgbl);
|
ALICE_exit(FINI_OK, tdgbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!switches || !(switches & ~(sw_user | sw_password | sw_fetch_password |
|
if (!flags || !(flags & ~(sw_user | sw_password | sw_fetch_password |
|
||||||
sw_trusted_auth | sw_trusted_svc | sw_trusted_role)))
|
sw_trusted_auth | sw_trusted_svc | sw_trusted_role)))
|
||||||
{
|
{
|
||||||
if (!help && !uSvc->isService())
|
if (!help && !uSvc->isService())
|
||||||
@ -511,17 +511,17 @@ int alice(Firebird::UtilSvc* uSvc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// generate the database parameter block for the attach,
|
// generate the database parameter block for the attach,
|
||||||
// based on the various switches
|
// based on the various flags
|
||||||
|
|
||||||
USHORT ret;
|
USHORT ret;
|
||||||
|
|
||||||
if (switches & (sw_list | sw_commit | sw_rollback | sw_two_phase))
|
if (flags & (sw_list | sw_commit | sw_rollback | sw_two_phase))
|
||||||
{
|
{
|
||||||
ret = EXE_two_phase(database, switches);
|
ret = EXE_two_phase(database, flags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = EXE_action(database, switches);
|
ret = EXE_action(database, flags);
|
||||||
|
|
||||||
const SLONG* ua_val_errors = tdgbl->ALICE_data.ua_val_errors;
|
const SLONG* ua_val_errors = tdgbl->ALICE_data.ua_val_errors;
|
||||||
|
|
||||||
@ -616,8 +616,7 @@ void ALICE_down_case(const TEXT* in, TEXT* out, const size_t buf_size)
|
|||||||
// Display a formatted error message
|
// Display a formatted error message
|
||||||
//
|
//
|
||||||
|
|
||||||
void ALICE_print(USHORT number,
|
void ALICE_print(USHORT number, const SafeArg& arg)
|
||||||
const SafeArg& arg)
|
|
||||||
{
|
{
|
||||||
TEXT buffer[256];
|
TEXT buffer[256];
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
#include "../common/classes/ClumpletWriter.h"
|
#include "../common/classes/ClumpletWriter.h"
|
||||||
|
|
||||||
|
|
||||||
static void buildDpb(Firebird::ClumpletWriter&, const ULONG);
|
static void buildDpb(Firebird::ClumpletWriter&, const SINT64);
|
||||||
static void extract_db_info(const UCHAR*, size_t);
|
static void extract_db_info(const UCHAR*, size_t);
|
||||||
|
|
||||||
// Keep always in sync with function extract_db_info()
|
// Keep always in sync with function extract_db_info()
|
||||||
@ -64,7 +64,7 @@ static const TEXT val_errors[] =
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
int EXE_action(const TEXT* database, const ULONG switches)
|
int EXE_action(const TEXT* database, const SINT64 switches)
|
||||||
{
|
{
|
||||||
bool error = false;
|
bool error = false;
|
||||||
Firebird::AutoMemoryPool newPool(MemoryPool::createPool());
|
Firebird::AutoMemoryPool newPool(MemoryPool::createPool());
|
||||||
@ -136,7 +136,7 @@ int EXE_action(const TEXT* database, const ULONG switches)
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
int EXE_two_phase(const TEXT* database, const ULONG switches)
|
int EXE_two_phase(const TEXT* database, const SINT64 switches)
|
||||||
{
|
{
|
||||||
bool error = false;
|
bool error = false;
|
||||||
Firebird::AutoMemoryPool newPool(MemoryPool::createPool());
|
Firebird::AutoMemoryPool newPool(MemoryPool::createPool());
|
||||||
@ -194,7 +194,7 @@ int EXE_two_phase(const TEXT* database, const ULONG switches)
|
|||||||
// based on the various switches
|
// based on the various switches
|
||||||
//
|
//
|
||||||
|
|
||||||
static void buildDpb(Firebird::ClumpletWriter& dpb, const ULONG switches)
|
static void buildDpb(Firebird::ClumpletWriter& dpb, const SINT64 switches)
|
||||||
{
|
{
|
||||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||||
dpb.reset(isc_dpb_version1);
|
dpb.reset(isc_dpb_version1);
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#ifndef ALICE_EXE_PROTO_H
|
#ifndef ALICE_EXE_PROTO_H
|
||||||
#define ALICE_EXE_PROTO_H
|
#define ALICE_EXE_PROTO_H
|
||||||
|
|
||||||
int EXE_action(const TEXT*, const ULONG);
|
int EXE_action(const TEXT*, const SINT64);
|
||||||
int EXE_two_phase(const TEXT*, const ULONG);
|
int EXE_two_phase(const TEXT*, const SINT64);
|
||||||
|
|
||||||
#endif // ALICE_EXE_PROTO_H
|
#endif // ALICE_EXE_PROTO_H
|
||||||
|
|
||||||
|
@ -49,11 +49,11 @@
|
|||||||
using MsgFormat::SafeArg;
|
using MsgFormat::SafeArg;
|
||||||
|
|
||||||
|
|
||||||
static ULONG ask();
|
static SINT64 ask();
|
||||||
static void print_description(const tdr*);
|
static void print_description(const tdr*);
|
||||||
static void reattach_database(tdr*);
|
static void reattach_database(tdr*);
|
||||||
static void reattach_databases(tdr*);
|
static void reattach_databases(tdr*);
|
||||||
static bool reconnect(FB_API_HANDLE, SLONG, const TEXT*, ULONG);
|
static bool reconnect(FB_API_HANDLE, SLONG, const TEXT*, SINT64);
|
||||||
|
|
||||||
|
|
||||||
//const char* const NEWLINE = "\n";
|
//const char* const NEWLINE = "\n";
|
||||||
@ -286,7 +286,7 @@ void TDR_shutdown_databases(tdr* trans)
|
|||||||
// prompt for commit, rollback, or leave well enough alone.
|
// prompt for commit, rollback, or leave well enough alone.
|
||||||
//
|
//
|
||||||
|
|
||||||
void TDR_list_limbo(FB_API_HANDLE handle, const TEXT* name, const ULONG switches)
|
void TDR_list_limbo(FB_API_HANDLE handle, const TEXT* name, const SINT64 switches)
|
||||||
{
|
{
|
||||||
UCHAR buffer[1024];
|
UCHAR buffer[1024];
|
||||||
ISC_STATUS_ARRAY status_vector;
|
ISC_STATUS_ARRAY status_vector;
|
||||||
@ -378,7 +378,7 @@ void TDR_list_limbo(FB_API_HANDLE handle, const TEXT* name, const ULONG switches
|
|||||||
// gfix user.
|
// gfix user.
|
||||||
//
|
//
|
||||||
|
|
||||||
bool TDR_reconnect_multiple(FB_API_HANDLE handle, SLONG id, const TEXT* name, ULONG switches)
|
bool TDR_reconnect_multiple(FB_API_HANDLE handle, SLONG id, const TEXT* name, SINT64 switches)
|
||||||
{
|
{
|
||||||
ISC_STATUS_ARRAY status_vector;
|
ISC_STATUS_ARRAY status_vector;
|
||||||
|
|
||||||
@ -655,16 +655,16 @@ static void print_description(const tdr* trans)
|
|||||||
// Ask the user whether to commit or rollback.
|
// Ask the user whether to commit or rollback.
|
||||||
//
|
//
|
||||||
|
|
||||||
static ULONG ask()
|
static SINT64 ask()
|
||||||
{
|
{
|
||||||
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
|
||||||
if (tdgbl->uSvc->isService())
|
if (tdgbl->uSvc->isService())
|
||||||
{
|
{
|
||||||
return ~0;
|
return ~SINT64(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
char response[32];
|
char response[32];
|
||||||
ULONG switches = 0;
|
SINT64 switches = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -820,7 +820,7 @@ static void reattach_databases(tdr* trans)
|
|||||||
// Commit or rollback a named transaction.
|
// Commit or rollback a named transaction.
|
||||||
//
|
//
|
||||||
|
|
||||||
static bool reconnect(FB_API_HANDLE handle, SLONG number, const TEXT* name, ULONG switches)
|
static bool reconnect(FB_API_HANDLE handle, SLONG number, const TEXT* name, SINT64 switches)
|
||||||
{
|
{
|
||||||
ISC_STATUS_ARRAY status_vector;
|
ISC_STATUS_ARRAY status_vector;
|
||||||
|
|
||||||
@ -840,7 +840,7 @@ static bool reconnect(FB_API_HANDLE handle, SLONG number, const TEXT* name, ULON
|
|||||||
ALICE_print(91, SafeArg() << number);
|
ALICE_print(91, SafeArg() << number);
|
||||||
// msg 91: Transaction %ld:
|
// msg 91: Transaction %ld:
|
||||||
switches = ask();
|
switches = ask();
|
||||||
if (switches == ULONG(~0))
|
if (switches == ~SINT64(0))
|
||||||
{
|
{
|
||||||
ALICE_print(84);
|
ALICE_print(84);
|
||||||
// msg 84: unexpected end of input
|
// msg 84: unexpected end of input
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#ifndef ALICE_TDR_PROTO_H
|
#ifndef ALICE_TDR_PROTO_H
|
||||||
#define ALICE_TDR_PROTO_H
|
#define ALICE_TDR_PROTO_H
|
||||||
|
|
||||||
void TDR_list_limbo(FB_API_HANDLE, const TEXT*, const ULONG);
|
void TDR_list_limbo(FB_API_HANDLE, const TEXT*, const SINT64);
|
||||||
bool TDR_reconnect_multiple(FB_API_HANDLE, SLONG, const TEXT*, ULONG);
|
bool TDR_reconnect_multiple(FB_API_HANDLE, SLONG, const TEXT*, SINT64);
|
||||||
void TDR_shutdown_databases(tdr*);
|
void TDR_shutdown_databases(tdr*);
|
||||||
USHORT TDR_analyze(const tdr*);
|
USHORT TDR_analyze(const tdr*);
|
||||||
bool TDR_attach_database(ISC_STATUS*, tdr*, const TEXT*);
|
bool TDR_attach_database(ISC_STATUS*, tdr*, const TEXT*);
|
||||||
|
Loading…
Reference in New Issue
Block a user