8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:03:03 +01:00
This commit is contained in:
asfernandes 2007-08-02 02:00:37 +00:00
parent 10bf77e37e
commit 613faffafb
8 changed files with 47 additions and 35 deletions

View File

@ -1518,6 +1518,7 @@ EXPORT RM_ENTRY(rmc_ftoc)
return (0); return (0);
} }
// Convert a Cobol alpha (PIC X) field to a C string. This is done by trimming trailing spaces // Convert a Cobol alpha (PIC X) field to a C string. This is done by trimming trailing spaces
// and adding the trailing '\0'. // and adding the trailing '\0'.
EXPORT RM_ENTRY(rmc_ctos) EXPORT RM_ENTRY(rmc_ctos)
@ -1537,6 +1538,7 @@ EXPORT RM_ENTRY(rmc_ctos)
return (0); return (0);
} }
// Convert a C string to a Cobol alpha (PIC X) field. This is done by copying the original // Convert a C string to a Cobol alpha (PIC X) field. This is done by copying the original
// string and padding on the right with spaces. // string and padding on the right with spaces.
EXPORT RM_ENTRY(rmc_stoc) EXPORT RM_ENTRY(rmc_stoc)

View File

@ -1151,9 +1151,8 @@ static void gen_based( const act* action)
case dtype_sql_time: case dtype_sql_time:
if (strlen(gpreGlob.sw_cob_dformat) == 0) if (strlen(gpreGlob.sw_cob_dformat) == 0)
fprintf(gpreGlob.out_file, "%sPIC S9(10)%s", names[COLUMN], USAGE_BINARY4); fprintf(gpreGlob.out_file, "%sPIC S9(10)%s", names[COLUMN], USAGE_BINARY4);
else { else
fprintf(gpreGlob.out_file, "%sPIC X(%d)", names[COLUMN], strlen(gpreGlob.sw_cob_dformat)); fprintf(gpreGlob.out_file, "%sPIC X(%d)", names[COLUMN], strlen(gpreGlob.sw_cob_dformat));
}
break; break;
case dtype_blob: case dtype_blob:

View File

@ -2674,9 +2674,11 @@ bool SQE_resolve_fields(GPRE_NOD fields,
gpre_nod** ptr = fields->nod_arg; gpre_nod** ptr = fields->nod_arg;
int count = fields->nod_count; int count = fields->nod_count;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
gpre_nod* node = ptr[i]; gpre_nod* node = ptr[i];
if (node->nod_type == nod_asterisk) { if (node->nod_type == nod_asterisk) {
const int old_count = count; const int old_count = count;
fields = explode_asterisk(fields, i, selection); fields = explode_asterisk(fields, i, selection);
@ -2687,23 +2689,25 @@ bool SQE_resolve_fields(GPRE_NOD fields,
else { else {
aggregate |= SQE_resolve(node, NULL, selection); aggregate |= SQE_resolve(node, NULL, selection);
pair(node, 0); pair(node, 0);
switch (node->nod_type) switch (node->nod_type)
{ {
case nod_agg_count: case nod_agg_count:
case nod_agg_max: case nod_agg_max:
case nod_agg_min: case nod_agg_min:
case nod_agg_average: case nod_agg_average:
case nod_agg_total: case nod_agg_total:
if ((node->nod_arg[1]) && if ((node->nod_arg[1]) &&
(request->req_database->dbb_flags & DBB_v3)) (request->req_database->dbb_flags & DBB_v3))
{ {
selection->rse_reduced = selection->rse_reduced =
MSC_unary(nod_sort, node->nod_arg[1]); MSC_unary(nod_sort, node->nod_arg[1]);
} }
break; break;
} }
} }
} }
return aggregate; return aggregate;
} }
//____________________________________________________________ //____________________________________________________________
@ -2859,8 +2863,10 @@ static gpre_rse* par_select( gpre_req* request, gpre_rse* union_rse)
gpre_nod* into_list = NULL; gpre_nod* into_list = NULL;
if (!(request->req_flags & REQ_sql_declare_cursor)) if (!(request->req_flags & REQ_sql_declare_cursor))
{
into_list = (MSC_match(KW_INTO)) ? SQE_list(SQE_variable, request, into_list = (MSC_match(KW_INTO)) ? SQE_list(SQE_variable, request,
false) : NULL; false) : NULL;
}
gpre_rse* select = par_rse(request, s_list, distinct); gpre_rse* select = par_rse(request, s_list, distinct);

View File

@ -94,9 +94,11 @@ void SDW_add(const TEXT* file_name, USHORT shadow_number, USHORT file_flags)
jrd_file* shadow_file = PIO_create(dbb, file_name, false, false, false); jrd_file* shadow_file = PIO_create(dbb, file_name, false, false, false);
if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache))
{
PIO_force_write(shadow_file, PIO_force_write(shadow_file,
dbb->dbb_flags & DBB_force_write, dbb->dbb_flags & DBB_force_write,
dbb->dbb_flags & DBB_no_fs_cache); dbb->dbb_flags & DBB_no_fs_cache);
}
Shadow* shadow = allocate_shadow(shadow_file, shadow_number, file_flags); Shadow* shadow = allocate_shadow(shadow_file, shadow_number, file_flags);
@ -172,9 +174,11 @@ int SDW_add_file(const TEXT* file_name, SLONG start, USHORT shadow_number)
jrd_file* next = file->fil_next; jrd_file* next = file->fil_next;
if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache))
{
PIO_force_write(next, PIO_force_write(next,
dbb->dbb_flags & DBB_force_write, dbb->dbb_flags & DBB_force_write,
dbb->dbb_flags & DBB_no_fs_cache); dbb->dbb_flags & DBB_no_fs_cache);
}
/* Always write the header page, even for a conditional /* Always write the header page, even for a conditional
* shadow that hasn't been activated. * shadow that hasn't been activated.
@ -980,7 +984,8 @@ void SDW_start(const TEXT* file_name,
shadow_file = shadow_file =
PIO_open(dbb, expanded_name, false, file_name, false); PIO_open(dbb, expanded_name, false, file_name, false);
if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) { if (dbb->dbb_flags & (DBB_force_write | DBB_no_fs_cache))
{
PIO_force_write(shadow_file, PIO_force_write(shadow_file,
dbb->dbb_flags & DBB_force_write, dbb->dbb_flags & DBB_force_write,
dbb->dbb_flags & DBB_no_fs_cache); dbb->dbb_flags & DBB_no_fs_cache);

View File

@ -4384,13 +4384,12 @@ static void validate_lhb(const lhb* alhb)
#endif #endif
validate_history(alhb->lhb_history); validate_history(alhb->lhb_history);
/* validate_semaphore_mask (alhb->lhb_mask); */ // validate_semaphore_mask (alhb->lhb_mask);
CHECK(alhb->lhb_reserved[0] == 0); CHECK(alhb->lhb_reserved[0] == 0);
CHECK(alhb->lhb_reserved[1] == 0); CHECK(alhb->lhb_reserved[1] == 0);
DEBUG_MSG(0, ("validate_lhb completed:\n")); DEBUG_MSG(0, ("validate_lhb completed:\n"));
} }
#endif #endif
@ -4418,17 +4417,17 @@ static void validate_lock(const SRQ_PTR lock_ptr, USHORT freed, const SRQ_PTR lr
else else
CHECK(lock->lbl_type == type_lbl); CHECK(lock->lbl_type == type_lbl);
// The following condition is always true because UCHAR >= 0 // The following condition is always true because UCHAR >= 0
// CHECK(lock->lbl_state >= LCK_none); // CHECK(lock->lbl_state >= LCK_none);
CHECK(lock->lbl_state < LCK_max); CHECK(lock->lbl_state < LCK_max);
CHECK(lock->lbl_length <= lock->lbl_size); CHECK(lock->lbl_length <= lock->lbl_size);
/* The lbl_count's should never roll over to be negative */ // The lbl_count's should never roll over to be negative
for (ULONG i = 0; i < FB_NELEM(lock->lbl_counts); i++) for (ULONG i = 0; i < FB_NELEM(lock->lbl_counts); i++)
CHECK(!(lock->lbl_counts[i] & 0x8000)) CHECK(!(lock->lbl_counts[i] & 0x8000))
/* The count of pending locks should never roll over to be negative */ // The count of pending locks should never roll over to be negative
CHECK(!(lock->lbl_pending_lrq_count & 0x8000)); CHECK(!(lock->lbl_pending_lrq_count & 0x8000));
USHORT direct_counts[LCK_max]; USHORT direct_counts[LCK_max];

View File

@ -1565,11 +1565,12 @@ static void server_shutdown(rem_port* port)
**************************************/ **************************************/
xnet_log_error("Server shutdown detected"); xnet_log_error("Server shutdown detected");
XCC xcc = (XCC)port->port_xcc; XCC xcc = (XCC) port->port_xcc;
xcc->xcc_flags |= XCCF_SERVER_SHUTDOWN; xcc->xcc_flags |= XCCF_SERVER_SHUTDOWN;
XPM xpm = xcc->xcc_xpm; XPM xpm = xcc->xcc_xpm;
if (!(xpm->xpm_flags & XPMF_SERVER_SHUTDOWN)) { if (!(xpm->xpm_flags & XPMF_SERVER_SHUTDOWN))
{
ULONG dead_proc_id = XPS(xpm->xpm_address)->xps_server_proc_id; ULONG dead_proc_id = XPS(xpm->xpm_address)->xps_server_proc_id;
@ -1577,7 +1578,8 @@ static void server_shutdown(rem_port* port)
XNET_LOCK(); XNET_LOCK();
for (xpm = global_client_maps; xpm; xpm = xpm->xpm_next) { for (xpm = global_client_maps; xpm; xpm = xpm->xpm_next)
{
if (!(xpm->xpm_flags & XPMF_SERVER_SHUTDOWN) && if (!(xpm->xpm_flags & XPMF_SERVER_SHUTDOWN) &&
XPS(xpm->xpm_address)->xps_server_proc_id == dead_proc_id) XPS(xpm->xpm_address)->xps_server_proc_id == dead_proc_id)
{ {

View File

@ -37,7 +37,7 @@ static const char* ISCGUARD_EXECUTABLE = "bin\\fbguard";
static const char* GUARDIAN_MUTEX = "FirebirdGuardianMutex%s"; static const char* GUARDIAN_MUTEX = "FirebirdGuardianMutex%s";
static const char* FB_DEFAULT_INSTANCE = "DefaultInstance"; static const char* FB_DEFAULT_INSTANCE = "DefaultInstance";
// Starting with 128 the service params are user defined // Starting with 128 the service params are user defined
const DWORD SERVICE_CREATE_GUARDIAN_MUTEX = 128; const DWORD SERVICE_CREATE_GUARDIAN_MUTEX = 128;

View File

@ -75,10 +75,10 @@ int CLIB_ROUTINE main( int argc, char **argv)
USHORT sw_arch = ARCH_SS; USHORT sw_arch = ARCH_SS;
bool sw_interactive = false; bool sw_interactive = false;
const TEXT *instance = FB_DEFAULT_INSTANCE; const TEXT* instance = FB_DEFAULT_INSTANCE;
TEXT *username = 0; TEXT* username = 0;
TEXT *password = 0; TEXT* password = 0;
// Let's get the root directory from the instance path of this program. // Let's get the root directory from the instance path of this program.
// argv[0] is only _mostly_ guaranteed to give this info, // argv[0] is only _mostly_ guaranteed to give this info,
@ -507,21 +507,20 @@ static USHORT svc_query_ex(SC_HANDLE manager)
{ {
const DWORD dwBytes = pcbBytesNeeded + sizeof(ENUM_SERVICE_STATUS); const DWORD dwBytes = pcbBytesNeeded + sizeof(ENUM_SERVICE_STATUS);
ENUM_SERVICE_STATUS* service_data = new ENUM_SERVICE_STATUS [dwBytes]; ENUM_SERVICE_STATUS* service_data = new ENUM_SERVICE_STATUS [dwBytes];
EnumServicesStatus (manager, SERVICE_WIN32, SERVICE_STATE_ALL, service_data, dwBytes, EnumServicesStatus(manager, SERVICE_WIN32, SERVICE_STATE_ALL, service_data, dwBytes,
&pcbBytesNeeded, &lpServicesReturned, &lpResumeHandle); &pcbBytesNeeded, &lpServicesReturned, &lpResumeHandle);
if (lpServicesReturned == 0) if (lpServicesReturned == 0)
delete[] service_data; delete[] service_data;
else else
{ {
Firebird::string ServerServiceName; Firebird::string serverServiceName;
Firebird::string ServerDisplayName;
bool firebirdServicesInstalled = false; bool firebirdServicesInstalled = false;
for( int i = 0; i < lpServicesReturned; i++ ) for ( DWORD i = 0; i < lpServicesReturned; i++ )
{ {
ServerServiceName = service_data[i].lpServiceName; serverServiceName = service_data[i].lpServiceName;
if ( ServerServiceName.substr(0, 8) == "Firebird" ) if ( serverServiceName.substr(0, 8) == "Firebird" )
{ {
svc_query(service_data[i].lpServiceName, svc_query(service_data[i].lpServiceName,
service_data[i].lpDisplayName, manager); service_data[i].lpDisplayName, manager);