2001-05-23 15:26:42 +02:00
|
|
|
//____________________________________________________________
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
// PROGRAM: Alice (All Else) Utility
|
|
|
|
// MODULE: exe.cpp
|
|
|
|
// DESCRIPTION: Does the database calls
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
// 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
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
// 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.
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
// The Original Code was created by Inprise Corporation
|
|
|
|
// and its predecessors. Portions created by Inprise Corporation are
|
|
|
|
// Copyright (C) Inprise Corporation.
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
// All Rights Reserved.
|
|
|
|
// Contributor(s): ______________________________________.
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
//
|
|
|
|
//____________________________________________________________
|
|
|
|
//
|
2003-09-22 10:49:45 +02:00
|
|
|
// $Id: exe.cpp,v 1.18 2003-09-22 08:49:45 brodsom Exp $
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
|
|
|
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
|
|
|
// conditionals, as the engine now fully supports
|
|
|
|
// readonly databases.
|
2001-05-23 15:26:42 +02:00
|
|
|
//
|
2002-10-31 06:06:02 +01:00
|
|
|
// 2002.10.30 Sean Leyne - Removed obsolete "PC_PLATFORM" define
|
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2001-07-30 01:43:24 +02:00
|
|
|
#include "firebird.h"
|
2001-05-23 15:26:42 +02:00
|
|
|
#include "../jrd/ib_stdio.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2001-07-30 01:43:24 +02:00
|
|
|
#include "../jrd/gds.h"
|
2001-05-23 15:26:42 +02:00
|
|
|
#include "../jrd/common.h"
|
|
|
|
#include "../jrd/ibsetjmp.h"
|
|
|
|
#include "../alice/alice.h"
|
2003-09-15 15:13:45 +02:00
|
|
|
#include "../alice/alice_proto.h"
|
2001-05-23 15:26:42 +02:00
|
|
|
#include "../alice/aliceswi.h"
|
|
|
|
#include "../alice/all.h"
|
|
|
|
#include "../alice/all_proto.h"
|
|
|
|
#include "../alice/alice_meta.h"
|
|
|
|
#include "../alice/tdr_proto.h"
|
|
|
|
#include "../jrd/gds_proto.h"
|
|
|
|
#include "../jrd/thd_proto.h"
|
|
|
|
|
|
|
|
|
|
|
|
static USHORT build_dpb(UCHAR *, ULONG);
|
|
|
|
static void extract_db_info(UCHAR *);
|
|
|
|
|
|
|
|
static TEXT val_errors[] =
|
|
|
|
{
|
|
|
|
isc_info_page_errors, isc_info_record_errors, isc_info_bpage_errors,
|
|
|
|
isc_info_dpage_errors, isc_info_ipage_errors, isc_info_ppage_errors,
|
|
|
|
isc_info_tpage_errors, gds_info_end
|
|
|
|
};
|
|
|
|
|
2003-09-18 12:56:32 +02:00
|
|
|
static inline void stuff_dpb(UCHAR **d, int blr)
|
|
|
|
{
|
|
|
|
UCHAR *ptr = *d;
|
2003-09-22 10:49:45 +02:00
|
|
|
*ptr++ = (UCHAR)blr;
|
2003-09-18 12:56:32 +02:00
|
|
|
*d = ptr;
|
|
|
|
}
|
2003-09-22 10:49:45 +02:00
|
|
|
|
|
|
|
static inline void stuff_dpb_long(UCHAR **d, int blr)
|
2003-09-18 12:56:32 +02:00
|
|
|
{
|
|
|
|
stuff_dpb(d, blr);
|
2003-09-22 10:49:45 +02:00
|
|
|
stuff_dpb(d, blr >> 8);
|
|
|
|
stuff_dpb(d, blr >> 16);
|
|
|
|
stuff_dpb(d, blr >> 24);
|
2003-09-18 12:56:32 +02:00
|
|
|
}
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//____________________________________________________________
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
int EXE_action(TEXT * database, ULONG switches)
|
|
|
|
{
|
|
|
|
UCHAR dpb[128];
|
2003-09-10 19:52:12 +02:00
|
|
|
USHORT dpb_length;
|
|
|
|
bool error;
|
2003-01-12 19:16:50 +01:00
|
|
|
FRBRD *handle;
|
2001-05-23 15:26:42 +02:00
|
|
|
UCHAR error_string[128];
|
|
|
|
USHORT i;
|
|
|
|
TGBL tdgbl;
|
|
|
|
|
|
|
|
tdgbl = GET_THREAD_DATA;
|
|
|
|
|
|
|
|
ALLA_init();
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_VAL_ERRORS; i++)
|
|
|
|
tdgbl->ALICE_data.ua_val_errors[i] = 0;
|
|
|
|
|
|
|
|
// generate the database parameter block for the attach,
|
2001-07-10 19:35:13 +02:00
|
|
|
// based on the various switches
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
dpb_length = build_dpb(dpb, switches);
|
|
|
|
|
2003-09-10 19:52:12 +02:00
|
|
|
error = false;
|
2001-05-23 15:26:42 +02:00
|
|
|
handle = NULL;
|
2003-08-30 04:02:36 +02:00
|
|
|
gds__attach_database(tdgbl->status, 0, database, &handle, dpb_length,
|
|
|
|
reinterpret_cast <SCHAR *>(dpb));
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
SVC_STARTED(tdgbl->service_blk);
|
|
|
|
|
|
|
|
if (tdgbl->status[1])
|
2003-09-10 19:52:12 +02:00
|
|
|
error = true;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
if (tdgbl->status[2] == isc_arg_warning)
|
|
|
|
ALICE_print_status(tdgbl->status);
|
|
|
|
|
|
|
|
if (handle != NULL) {
|
|
|
|
if ((switches & sw_validate) && (tdgbl->status[1] != isc_bug_check)) {
|
2003-08-30 04:02:36 +02:00
|
|
|
gds__database_info(tdgbl->status, &handle, sizeof(val_errors),
|
|
|
|
val_errors, sizeof(error_string),
|
2001-05-23 15:26:42 +02:00
|
|
|
reinterpret_cast < char *>(error_string));
|
|
|
|
|
|
|
|
extract_db_info(error_string);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (switches & sw_disable)
|
|
|
|
MET_disable_wal(tdgbl->status, handle);
|
|
|
|
|
2003-08-30 04:02:36 +02:00
|
|
|
gds__detach_database(tdgbl->status, &handle);
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ALLA_fini();
|
|
|
|
|
|
|
|
return ((error) ? FINI_ERROR : FINI_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//____________________________________________________________
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
int EXE_two_phase(TEXT * database, ULONG switches)
|
|
|
|
{
|
|
|
|
UCHAR dpb[128];
|
2003-09-10 19:52:12 +02:00
|
|
|
USHORT dpb_length;
|
|
|
|
bool error;
|
2003-01-12 19:16:50 +01:00
|
|
|
FRBRD *handle;
|
2001-05-23 15:26:42 +02:00
|
|
|
USHORT i;
|
|
|
|
TGBL tdgbl;
|
|
|
|
|
|
|
|
tdgbl = GET_THREAD_DATA;
|
|
|
|
|
|
|
|
ALLA_init();
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_VAL_ERRORS; i++)
|
|
|
|
tdgbl->ALICE_data.ua_val_errors[i] = 0;
|
|
|
|
|
|
|
|
// generate the database parameter block for the attach,
|
2001-07-10 19:35:13 +02:00
|
|
|
// based on the various switches
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
dpb_length = build_dpb(dpb, switches);
|
|
|
|
|
2003-09-10 19:52:12 +02:00
|
|
|
error = false;
|
2001-05-23 15:26:42 +02:00
|
|
|
handle = NULL;
|
2003-08-30 04:02:36 +02:00
|
|
|
gds__attach_database(tdgbl->status, 0, database, &handle,
|
|
|
|
dpb_length, reinterpret_cast < char *>(dpb));
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
SVC_STARTED(tdgbl->service_blk);
|
|
|
|
|
|
|
|
if (tdgbl->status[1])
|
2003-09-10 19:52:12 +02:00
|
|
|
error = true;
|
2001-05-23 15:26:42 +02:00
|
|
|
else if (switches & sw_list)
|
2002-12-16 16:16:32 +01:00
|
|
|
TDR_list_limbo((handle), database, switches);
|
2001-05-23 15:26:42 +02:00
|
|
|
else if (switches & (sw_commit | sw_rollback | sw_two_phase))
|
2003-09-10 19:52:12 +02:00
|
|
|
error = TDR_reconnect_multiple((handle),
|
|
|
|
tdgbl->ALICE_data.ua_transaction, database,
|
|
|
|
switches);
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
if (handle)
|
2003-08-30 04:02:36 +02:00
|
|
|
gds__detach_database(tdgbl->status, &handle);
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
ALLA_fini();
|
|
|
|
|
|
|
|
return ((error) ? FINI_ERROR : FINI_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
//____________________________________________________________
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
|
|
|
//
|
|
|
|
// generate the database parameter block for the attach,
|
|
|
|
// based on the various switches
|
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
static USHORT build_dpb(UCHAR * dpb, ULONG switches)
|
|
|
|
{
|
2003-09-18 12:56:32 +02:00
|
|
|
UCHAR *dpb2;
|
2001-05-23 15:26:42 +02:00
|
|
|
USHORT dpb_length;
|
|
|
|
SSHORT i;
|
|
|
|
TEXT *q;
|
|
|
|
TGBL tdgbl;
|
|
|
|
|
|
|
|
tdgbl = GET_THREAD_DATA;
|
|
|
|
|
2003-09-18 12:56:32 +02:00
|
|
|
dpb2 = dpb;
|
|
|
|
*dpb2++ = gds_dpb_version1;
|
|
|
|
*dpb2++ = isc_dpb_gfix_attach;
|
|
|
|
*dpb2++ = 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
if (switches & sw_sweep) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_sweep;
|
|
|
|
*dpb2++ = 1;
|
|
|
|
*dpb2++ = gds_dpb_records;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_activate) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_activate_shadow;
|
|
|
|
*dpb2++ = 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_validate) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_verify;
|
|
|
|
*dpb2++ = 1;
|
|
|
|
*dpb2 = gds_dpb_pages;
|
2001-05-23 15:26:42 +02:00
|
|
|
if (switches & sw_full)
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2 |= gds_dpb_records;
|
2001-05-23 15:26:42 +02:00
|
|
|
if (switches & sw_no_update)
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2 |= gds_dpb_no_update;
|
2001-05-23 15:26:42 +02:00
|
|
|
if (switches & sw_mend)
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2 |= gds_dpb_repair;
|
2001-05-23 15:26:42 +02:00
|
|
|
if (switches & sw_ignore)
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2 |= gds_dpb_ignore;
|
|
|
|
dpb2++;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_housekeeping) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_sweep_interval;
|
|
|
|
*dpb2++ = 4;
|
2001-05-23 15:26:42 +02:00
|
|
|
for (i = 0; i < 4;
|
|
|
|
i++, tdgbl->ALICE_data.ua_sweep_interval =
|
|
|
|
tdgbl->ALICE_data.ua_sweep_interval >> 8)
|
2003-09-18 12:56:32 +02:00
|
|
|
{
|
2001-05-23 15:26:42 +02:00
|
|
|
/* TMN: Here we should really have the following assert */
|
|
|
|
/* assert(tdgbl->ALICE_data.ua_sweep_interval <= MAX_UCHAR); */
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = (UCHAR) tdgbl->ALICE_data.ua_sweep_interval;
|
|
|
|
}
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_begin_log) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_begin_log;
|
|
|
|
*dpb2++ = strlen(tdgbl->ALICE_data.ua_log_file);
|
2001-05-23 15:26:42 +02:00
|
|
|
for (q = tdgbl->ALICE_data.ua_log_file; *q;)
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = *q++;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_buffers) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = isc_dpb_set_page_buffers;
|
|
|
|
*dpb2++ = 4;
|
2001-05-23 15:26:42 +02:00
|
|
|
for (i = 0; i < 4;
|
|
|
|
i++, tdgbl->ALICE_data.ua_page_buffers =
|
|
|
|
tdgbl->ALICE_data.ua_page_buffers >> 8)
|
2003-09-18 12:56:32 +02:00
|
|
|
{
|
2001-05-23 15:26:42 +02:00
|
|
|
/* TMN: Here we should really have the following assert */
|
|
|
|
/* assert(tdgbl->ALICE_data.ua_page_buffers <= MAX_UCHAR); */
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = (UCHAR) tdgbl->ALICE_data.ua_page_buffers;
|
|
|
|
}
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_quit_log) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_quit_log;
|
|
|
|
*dpb2++ = 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_kill) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_delete_shadow;
|
|
|
|
*dpb2++ = 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_write) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_force_write;
|
|
|
|
*dpb2++ = 1;
|
|
|
|
*dpb2++ = tdgbl->ALICE_data.ua_force ? 1 : 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_use) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_no_reserve;
|
|
|
|
*dpb2++ = 1;
|
|
|
|
*dpb2++ = tdgbl->ALICE_data.ua_use ? 1 : 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
2001-07-10 19:35:13 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
else if (switches & sw_mode) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = isc_dpb_set_db_readonly;
|
|
|
|
*dpb2++ = 1;
|
|
|
|
*dpb2++ = (tdgbl->ALICE_data.ua_read_only) ? 1 : 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_shut) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_shutdown;
|
|
|
|
*dpb2++ = 1;
|
|
|
|
*dpb2 = 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
if (switches & sw_attach)
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2 |= gds_dpb_shut_attachment;
|
2001-05-23 15:26:42 +02:00
|
|
|
else if (switches & sw_cache)
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2 |= gds_dpb_shut_cache;
|
2001-05-23 15:26:42 +02:00
|
|
|
else if (switches & sw_force)
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2 |= gds_dpb_shut_force;
|
2001-05-23 15:26:42 +02:00
|
|
|
else if (switches & sw_tran)
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2 |= gds_dpb_shut_transaction;
|
|
|
|
dpb2++;
|
|
|
|
*dpb2++ = gds_dpb_shutdown_delay;
|
|
|
|
*dpb2++ = 2; /* Build room for shutdown delay */
|
2001-05-23 15:26:42 +02:00
|
|
|
/* 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 */
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = (UCHAR) tdgbl->ALICE_data.ua_shutdown_delay;
|
|
|
|
*dpb2++ = (UCHAR) (tdgbl->ALICE_data.ua_shutdown_delay >> 8);
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_online) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_online;
|
|
|
|
*dpb2++ = 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_disable) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = isc_dpb_disable_wal;
|
|
|
|
*dpb2++ = 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & (sw_list | sw_commit | sw_rollback | sw_two_phase)) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_no_garbage_collect;
|
|
|
|
*dpb2++ = 0;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
else if (switches & sw_set_db_dialect) {
|
2003-09-18 12:56:32 +02:00
|
|
|
stuff_dpb(&dpb2, isc_dpb_set_db_sql_dialect);
|
|
|
|
stuff_dpb(&dpb2, 4);
|
2003-09-22 10:49:45 +02:00
|
|
|
stuff_dpb_long(&dpb2, tdgbl->ALICE_data.ua_db_SQL_dialect);
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tdgbl->ALICE_data.ua_user) {
|
2003-09-18 12:56:32 +02:00
|
|
|
*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;)
|
|
|
|
*dpb2++ = *q++;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tdgbl->ALICE_data.ua_password) {
|
2003-03-13 17:54:04 +01:00
|
|
|
if (!tdgbl->sw_service)
|
2003-09-18 12:56:32 +02:00
|
|
|
*dpb2++ = gds_dpb_password;
|
2001-05-23 15:26:42 +02:00
|
|
|
else
|
2003-09-18 12:56:32 +02:00
|
|
|
*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++;
|
2001-05-23 15:26:42 +02:00
|
|
|
}
|
|
|
|
|
2003-09-18 12:56:32 +02:00
|
|
|
dpb_length = dpb2 - dpb;
|
2001-05-23 15:26:42 +02:00
|
|
|
if (dpb_length == 1)
|
|
|
|
dpb_length = 0;
|
|
|
|
|
|
|
|
return dpb_length;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//____________________________________________________________
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
// Extract database info from string
|
2001-07-10 19:35:13 +02:00
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
static void extract_db_info(UCHAR * db_info_buffer)
|
|
|
|
{
|
|
|
|
UCHAR item;
|
|
|
|
UCHAR *p;
|
|
|
|
SLONG length;
|
|
|
|
TGBL tdgbl;
|
|
|
|
|
|
|
|
tdgbl = GET_THREAD_DATA;
|
|
|
|
|
|
|
|
p = db_info_buffer;
|
|
|
|
|
|
|
|
while ((item = *p++) != gds_info_end) {
|
|
|
|
length = gds__vax_integer(p, 2);
|
|
|
|
p += 2;
|
|
|
|
|
|
|
|
/* TMN: Here we should really have the following assert */
|
|
|
|
/* assert(length <= MAX_SSHORT); */
|
|
|
|
/* for all cases that use 'length' as input to 'gds__vax_integer' */
|
|
|
|
switch (item) {
|
|
|
|
case isc_info_page_errors:
|
|
|
|
tdgbl->ALICE_data.ua_val_errors[VAL_PAGE_ERRORS] =
|
|
|
|
gds__vax_integer(p, (SSHORT) length);
|
|
|
|
p += length;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case isc_info_record_errors:
|
|
|
|
tdgbl->ALICE_data.ua_val_errors[VAL_RECORD_ERRORS] =
|
|
|
|
gds__vax_integer(p, (SSHORT) length);
|
|
|
|
p += length;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case isc_info_bpage_errors:
|
|
|
|
tdgbl->ALICE_data.ua_val_errors[VAL_BLOB_PAGE_ERRORS] =
|
|
|
|
gds__vax_integer(p, (SSHORT) length);
|
|
|
|
p += length;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case isc_info_dpage_errors:
|
|
|
|
tdgbl->ALICE_data.ua_val_errors[VAL_DATA_PAGE_ERRORS] =
|
|
|
|
gds__vax_integer(p, (SSHORT) length);
|
|
|
|
p += length;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case isc_info_ipage_errors:
|
|
|
|
tdgbl->ALICE_data.ua_val_errors[VAL_INDEX_PAGE_ERRORS] =
|
|
|
|
gds__vax_integer(p, (SSHORT) length);
|
|
|
|
p += length;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case isc_info_ppage_errors:
|
|
|
|
tdgbl->ALICE_data.ua_val_errors[VAL_POINTER_PAGE_ERRORS] =
|
|
|
|
gds__vax_integer(p, (SSHORT) length);
|
|
|
|
p += length;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case isc_info_tpage_errors:
|
|
|
|
tdgbl->ALICE_data.ua_val_errors[VAL_TIP_PAGE_ERRORS] =
|
|
|
|
gds__vax_integer(p, (SSHORT) length);
|
|
|
|
p += length;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case isc_info_error:
|
|
|
|
/* has to be a < V4 database. */
|
|
|
|
|
|
|
|
tdgbl->ALICE_data.ua_val_errors[VAL_INVALID_DB_VERSION] = 1;
|
|
|
|
return;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|