mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 17:23:03 +01:00
read only databases are supported unconditionally in fb2
This commit is contained in:
parent
9587c717b3
commit
baa3485651
@ -24,7 +24,11 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: alice.cpp,v 1.1.1.1 2001-05-23 13:25:33 tamlin Exp $
|
||||
// $Id: alice.cpp,v 1.2 2001-07-10 17:35:12 awharrison Exp $
|
||||
//
|
||||
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
// conditionals, as the engine now fully supports
|
||||
// readonly databases.
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -489,7 +493,6 @@ int DLL_EXPORT ALICE_gfix(
|
||||
ALICE_error(18, 0, 0, 0, 0, 0); /* msg 18: numeric value between 0 and 32767 inclusive required */
|
||||
}
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if (table->in_sw_value & sw_mode) {
|
||||
if (--argc <= 0)
|
||||
ALICE_error(110, 0, 0, 0, 0, 0); /* msg 110: "read_only" or "read_write" required */
|
||||
@ -501,7 +504,6 @@ int DLL_EXPORT ALICE_gfix(
|
||||
else
|
||||
ALICE_error(110, 0, 0, 0, 0, 0); /* msg 110: "read_only" or "read_write" required */
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
#ifndef ALICE_ALICESWI_H
|
||||
#define ALICE_ALICESWI_H
|
||||
@ -160,11 +163,9 @@ static struct in_sw_tab_t alice_in_sw_table[] =
|
||||
IN_SW_ALICE_MEND, isc_spb_rpr_mend_db, "mend", SW_MEND,
|
||||
0, ~sw_no_update, FALSE, 38, 0, NULL,
|
||||
/* msg 38: \t-mend\t\tprepare corrupt database for backup */
|
||||
#ifdef READONLY_DATABASE
|
||||
IN_SW_ALICE_MODE, 0, "mode", sw_mode,
|
||||
0, ~sw_mode, FALSE, 109, 0, NULL,
|
||||
/* msg 109: \t-mode\t\tread_only or read_write */
|
||||
#endif /* READONLY_DATABASE */
|
||||
IN_SW_ALICE_NO_UPDATE, isc_spb_rpr_check_db, "no_update", sw_no_update,
|
||||
sw_validate, 0, FALSE, 39, 0, NULL,
|
||||
/* msg 39: \t-no_update\tread-only validation (-v) */
|
||||
@ -250,12 +251,10 @@ static struct in_sw_tab_t alice_in_sw_table[] =
|
||||
0, 0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_ALICE_HIDDEN_ATTACH, isc_spb_prp_deny_new_attachments,
|
||||
"shut -attach", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
#ifdef READONLY_DATABASE
|
||||
IN_SW_ALICE_HIDDEN_RDONLY, isc_spb_prp_am_readonly, "mode read_only", 0,
|
||||
0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_ALICE_HIDDEN_RDWRITE, isc_spb_prp_am_readwrite, "mode read_write",
|
||||
0, 0, 0, FALSE, 0, 0, NULL,
|
||||
#endif /* READONLY_DATABASE */
|
||||
/************************************************************************/
|
||||
IN_SW_ALICE_0, 0, NULL, 0,
|
||||
0, 0, FALSE, 0, 0, NULL
|
||||
|
@ -24,7 +24,11 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: exe.cpp,v 1.1.1.1 2001-05-23 13:25:33 tamlin Exp $
|
||||
// $Id: exe.cpp,v 1.2 2001-07-10 17:35:12 awharrison Exp $
|
||||
//
|
||||
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
// conditionals, as the engine now fully supports
|
||||
// readonly databases.
|
||||
//
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
@ -289,13 +293,12 @@ static USHORT build_dpb(UCHAR * dpb, ULONG switches)
|
||||
*d++ = 1;
|
||||
*d++ = tdgbl->ALICE_data.ua_use;
|
||||
}
|
||||
#ifdef READONLY_DATABASE
|
||||
|
||||
else if (switches & sw_mode) {
|
||||
*d++ = isc_dpb_set_db_readonly;
|
||||
*d++ = 1;
|
||||
*d++ = tdgbl->ALICE_data.ua_read_only;
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
else if (switches & sw_shut) {
|
||||
*d++ = gds_dpb_shutdown;
|
||||
*d++ = 1;
|
||||
|
@ -20,9 +20,13 @@
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* Toni Martir: Added verbose backup records as BACKUP_VERBOSE_INTERVAL
|
||||
*
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
/*
|
||||
$Id: backup.e,v 1.1.1.1 2001-05-23 13:26:04 tamlin Exp $
|
||||
$Id: backup.e,v 1.2 2001-07-10 17:35:13 awharrison Exp $
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
@ -2812,12 +2816,10 @@ static void write_database( TEXT * dbb_file)
|
||||
PUT_NUMERIC(att_SQL_dialect, SQL_dialect);
|
||||
break;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
case isc_info_db_read_only:
|
||||
if (db_read_only = (USHORT) isc_vax_integer(d, length))
|
||||
PUT_NUMERIC(att_db_read_only, db_read_only);
|
||||
break;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
default:
|
||||
BURP_error_redirect(status_vector, 31, NULL, NULL);
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
@ -629,9 +632,7 @@ int DLL_EXPORT BURP_gbak(int argc,
|
||||
tdgbl->gbl_sw_ignore_limbo = FALSE;
|
||||
tdgbl->gbl_sw_blk_factor = 0;
|
||||
tdgbl->gbl_sw_no_reserve = FALSE;
|
||||
#ifdef READONLY_DATABASE
|
||||
tdgbl->gbl_sw_mode = FALSE;
|
||||
#endif /* READONLY_DATABASE */
|
||||
tdgbl->gbl_sw_skip_count = 0;
|
||||
tdgbl->gbl_sw_bug8183 = FALSE;
|
||||
tdgbl->action = NULL;
|
||||
@ -718,7 +719,6 @@ int DLL_EXPORT BURP_gbak(int argc,
|
||||
BURP_error(259, *argv, 0, 0, 0, 0); /* msg 259 expected page buffers, encountered "%s" */
|
||||
argv++;
|
||||
}
|
||||
#ifdef READONLY_DATABASE
|
||||
else if (in_sw_tab->in_sw == IN_SW_BURP_MODE) {
|
||||
if (argv >= end)
|
||||
BURP_error(279, 0, 0, 0, 0, 0); /* msg 279: "read_only" or "read_write" required */
|
||||
@ -731,7 +731,6 @@ int DLL_EXPORT BURP_gbak(int argc,
|
||||
BURP_error(279, 0, 0, 0, 0, 0); /* msg 279: "read_only" or "read_write" required */
|
||||
tdgbl->gbl_sw_mode = TRUE;
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
else if (in_sw_tab->in_sw == IN_SW_BURP_PASS) {
|
||||
if (argv >= end)
|
||||
BURP_error(189, 0, 0, 0, 0, 0); /* password parameter missing */
|
||||
@ -904,11 +903,9 @@ int DLL_EXPORT BURP_gbak(int argc,
|
||||
tdgbl->gbl_sw_meta = TRUE;
|
||||
break;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
case (IN_SW_BURP_MODE):
|
||||
tdgbl->gbl_sw_mode = TRUE;
|
||||
break;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
case (IN_SW_BURP_N):
|
||||
tdgbl->gbl_sw_novalidity = TRUE;
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#ifndef _BURP_BURPSWI_H_
|
||||
@ -110,10 +113,8 @@ static struct in_sw_tab_t burp_in_sw_table [] =
|
||||
IN_SW_BURP_M, isc_spb_bkp_metadata_only, "METADATA", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_BURP_M, 0, "META_DATA", 0, 0, 0, FALSE, 63, 0, NULL,
|
||||
/* msg 63: %sMETA_DATA backup metadata only */
|
||||
#ifdef READONLY_DATABASE
|
||||
IN_SW_BURP_MODE, 0, "MODE", 0, 0, 0, FALSE, 278, 0, NULL,
|
||||
/* msg 278: %sMODE read_only or read_write access */
|
||||
#endif /* READONLY_DATABASE */
|
||||
IN_SW_BURP_N, isc_spb_res_no_validity, "NO_VALIDITY", 0, 0, 0, FALSE, 187, 0, NULL,
|
||||
/* msg 187: %sN(O_VALIDITY) do not restore database validity conditions */
|
||||
IN_SW_BURP_NT, isc_spb_bkp_non_transportable, "NT", 0, 0, 0, FALSE, 239, 0, NULL,
|
||||
@ -156,7 +157,6 @@ static struct in_sw_tab_t burp_in_sw_table [] =
|
||||
#endif
|
||||
/* next switch is a hidden option in case of bug_no 8183 */
|
||||
IN_SW_BURP_BUG8183, 0, "BUG_8183", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
#ifdef READONLY_DATABASE
|
||||
/**************************************************************************/
|
||||
/* The next two 'virtual' switches are hidden from user and are needed */
|
||||
/* for services API */
|
||||
@ -164,7 +164,6 @@ static struct in_sw_tab_t burp_in_sw_table [] =
|
||||
IN_SW_BURP_HIDDEN_RDONLY, isc_spb_res_am_readonly, "mode read_only", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
IN_SW_BURP_HIDDEN_RDWRITE, isc_spb_res_am_readwrite, "mode read_write", 0, 0, 0, FALSE, 0, 0, NULL,
|
||||
/**************************************************************************/
|
||||
#endif
|
||||
IN_SW_BURP_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL
|
||||
};
|
||||
|
||||
|
@ -21,9 +21,13 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
* Toni Martir: Verbose records restored as RESTORE_VERBOSE_INTERVAL,
|
||||
* also verbose restoring indexes as DEFERRED when verbose
|
||||
*
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
/*
|
||||
$Id: restore.e,v 1.1.1.1 2001-05-23 13:26:04 tamlin Exp $
|
||||
$Id: restore.e,v 1.2 2001-07-10 17:35:13 awharrison Exp $
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
@ -581,7 +585,6 @@ int RESTORE_restore( TEXT * file_name, TEXT * database_name)
|
||||
return FINI_DB_NOT_ONLINE;
|
||||
}
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* If the database is to be restored ReadOnly, set it to read_only now! */
|
||||
if (tdgbl->gbl_sw_mode == TRUE && tdgbl->gbl_sw_mode_val == TRUE) {
|
||||
BURP_verbose(280, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
|
||||
@ -620,7 +623,6 @@ int RESTORE_restore( TEXT * file_name, TEXT * database_name)
|
||||
general_on_error();
|
||||
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
return FINI_OK;
|
||||
}
|
||||
@ -863,11 +865,9 @@ static void create_database( UCHAR * file_name)
|
||||
no_reserve = (USHORT) get_numeric();
|
||||
break;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
case att_db_read_only:
|
||||
db_read_only = (UCHAR) get_numeric();
|
||||
break;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
case att_page_buffers:
|
||||
page_buffers = get_numeric();
|
||||
@ -900,7 +900,6 @@ static void create_database( UCHAR * file_name)
|
||||
if (tdgbl->gbl_sw_no_reserve)
|
||||
no_reserve = tdgbl->gbl_sw_no_reserve;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* Override attribute setting with user requirement */
|
||||
if (tdgbl->gbl_sw_mode == TRUE)
|
||||
db_read_only = tdgbl->gbl_sw_mode_val;
|
||||
@ -911,7 +910,6 @@ static void create_database( UCHAR * file_name)
|
||||
tdgbl->gbl_sw_mode = TRUE;
|
||||
tdgbl->gbl_sw_mode_val = db_read_only;
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
if (tdgbl->gbl_sw_page_buffers)
|
||||
page_buffers = tdgbl->gbl_sw_page_buffers;
|
||||
@ -935,12 +933,8 @@ static void create_database( UCHAR * file_name)
|
||||
*d++ = (UCHAR) (sweep_interval >> 16);
|
||||
*d++ = (UCHAR) (sweep_interval >> 24);
|
||||
}
|
||||
#ifdef READONLY_DATABASE
|
||||
/* If the database is to be restored "read_only", fillup the data pages */
|
||||
if (no_reserve || db_read_only)
|
||||
#else
|
||||
if (no_reserve)
|
||||
#endif /* READONLY_DATABASE */
|
||||
{
|
||||
*d++ = (UCHAR) isc_dpb_no_reserve;
|
||||
*d++ = 1;
|
||||
|
@ -20,9 +20,13 @@
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
* $Id: ddl.cpp,v 1.1.1.1 2001-05-23 13:25:35 tamlin Exp $
|
||||
* $Id: ddl.cpp,v 1.2 2001-07-10 17:35:13 awharrison Exp $
|
||||
* 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash,
|
||||
* caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET;
|
||||
*
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
@ -271,12 +275,10 @@ void DDL_generate( REQ request, NOD node)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if (request->req_dbb->dbb_flags & DBB_read_only) {
|
||||
ERRD_post(isc_read_only_database, 0);
|
||||
return;
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
STUFF(gds_dyn_version_1);
|
||||
generate_dyn(request, node);
|
||||
|
@ -19,9 +19,12 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
/*
|
||||
$Id: dsql.cpp,v 1.2 2001-05-24 14:54:25 tamlin Exp $
|
||||
$Id: dsql.cpp,v 1.3 2001-07-10 17:35:13 awharrison Exp $
|
||||
*/
|
||||
/**************************************************************
|
||||
V4 Multi-threading changes.
|
||||
@ -157,7 +160,7 @@ static CONST SCHAR db_hdr_info_items[] = {
|
||||
isc_info_db_sql_dialect,
|
||||
gds_info_ods_version,
|
||||
gds_info_base_level,
|
||||
#ifdef READONLY_DATABASE
|
||||
#ifde_DATABASE
|
||||
isc_info_db_read_only,
|
||||
#endif /* READONLY_DATABASE */
|
||||
frb_info_att_charset,
|
||||
@ -3081,14 +3084,12 @@ static DBB init( SLONG ** db_handle)
|
||||
database->dbb_base_level = (USHORT) data[1];
|
||||
break;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
case isc_info_db_read_only:
|
||||
if ((USHORT) data[0])
|
||||
database->dbb_flags |= DBB_read_only;
|
||||
else
|
||||
database->dbb_flags &= ~DBB_read_only;
|
||||
break;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
case frb_info_att_charset:
|
||||
database->dbb_att_charset =
|
||||
|
@ -19,9 +19,12 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
/*
|
||||
$Id: blb.cpp,v 1.1.1.1 2001-05-23 13:26:22 tamlin Exp $
|
||||
$Id: blb.cpp,v 1.2 2001-07-10 17:35:13 awharrison Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@ -188,10 +191,8 @@ BLB BLB_create2(TDBB tdbb,
|
||||
dbb = tdbb->tdbb_database;
|
||||
CHECK_DBB(dbb);
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
ERR_post(isc_read_only_database, 0);
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
/* Create a blob large enough to hold a single data page */
|
||||
|
||||
@ -1824,10 +1825,8 @@ static void delete_blob(TDBB tdbb, BLB blob, ULONG prior_page)
|
||||
dbb = tdbb->tdbb_database;
|
||||
CHECK_DBB(dbb);
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
ERR_post(isc_read_only_database, 0);
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
/* Level 0 blobs don't need cleanup */
|
||||
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
#include "../jrd/ibsetjmp.h"
|
||||
#include "../jrd/ib_stdio.h"
|
||||
@ -1216,10 +1219,8 @@ BOOLEAN CCH_free_page(TDBB tdbb)
|
||||
dbb = tdbb->tdbb_database;
|
||||
bcb = dbb->dbb_bcb;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
if (bcb->bcb_flags & BCB_free_pending &&
|
||||
(bdb = get_buffer(tdbb, FREE_PAGE, LATCH_none, 1))) {
|
||||
@ -1451,9 +1452,7 @@ void CCH_init(TDBB tdbb, ULONG number)
|
||||
#endif
|
||||
|
||||
#ifdef CACHE_WRITER
|
||||
#ifdef READONLY_DATABASE
|
||||
if (!(dbb->dbb_flags & DBB_read_only))
|
||||
#endif
|
||||
{
|
||||
event = dbb->dbb_writer_event;
|
||||
ISC_event_init(event, 0, 0);
|
||||
|
@ -21,9 +21,13 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
* Added TCP_NO_DELAY option for superserver on Linux
|
||||
* FSG 16.03.2001
|
||||
*
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
/*
|
||||
$Id: common.h,v 1.1.1.1 2001-05-23 13:26:08 tamlin Exp $
|
||||
$Id: common.h,v 1.2 2001-07-10 17:35:13 awharrison Exp $
|
||||
*/
|
||||
|
||||
#ifndef JRD_COMMON_H
|
||||
@ -1139,11 +1143,6 @@ typedef struct {
|
||||
} SQUAD;
|
||||
#endif
|
||||
|
||||
/* Enable support for READONLY databases in InterBase, IB 6.0 (Kinobi) project */
|
||||
#ifndef READONLY_DATABASE
|
||||
#define READONLY_DATABASE
|
||||
#endif
|
||||
|
||||
#ifndef ATOM_DEFINED /* 32 or 64 bit */
|
||||
typedef long SATOM;
|
||||
typedef unsigned long UATOM;
|
||||
|
@ -29,6 +29,11 @@
|
||||
* Change: Corrected routine to use new variables from PAG_init.
|
||||
*/
|
||||
|
||||
/* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
#include "../jrd/ibsetjmp.h"
|
||||
#include <string.h>
|
||||
@ -1153,14 +1158,10 @@ SINT64 DPM_gen_id(TDBB tdbb, SLONG generator, USHORT initialize, SINT64 val)
|
||||
|
||||
window.win_page = vector->vcl_long[sequence];
|
||||
window.win_flags = 0;
|
||||
#ifdef READONLY_DATABASE
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
page = (GPG) CCH_FETCH(tdbb, &window, LCK_read, pag_ids);
|
||||
else
|
||||
page = (GPG) CCH_FETCH(tdbb, &window, LCK_write, pag_ids);
|
||||
#else
|
||||
page = (GPG) CCH_FETCH(tdbb, &window, LCK_write, pag_ids);
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
/* If we are in ODS >= 10, then we have a pointer to an int64 value in the
|
||||
* generator page: if earlier than 10, it's a pointer to a long value.
|
||||
@ -1175,10 +1176,9 @@ SINT64 DPM_gen_id(TDBB tdbb, SLONG generator, USHORT initialize, SINT64 val)
|
||||
lptr = ((SLONG *) (((PPG) page)->ppg_page)) + offset;
|
||||
|
||||
if (val || initialize) {
|
||||
#ifdef READONLY_DATABASE
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
ERR_post(isc_read_only_database, 0);
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
CCH_MARK(tdbb, &window);
|
||||
|
||||
/* Initialize or increment the quad value in an ODS 10 or later
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
@ -440,7 +443,6 @@ void EXT_store(RPB * rpb, int *transaction)
|
||||
/* check if file is read only if read only then
|
||||
post error we cannot write to this file */
|
||||
if (file->ext_flags & EXT_readonly) {
|
||||
#ifdef READONLY_DATABASE
|
||||
DBB dbb;
|
||||
|
||||
dbb = GET_DBB;
|
||||
@ -449,7 +451,6 @@ void EXT_store(RPB * rpb, int *transaction)
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
ERR_post(isc_read_only_database, 0);
|
||||
else
|
||||
#endif /* READONLY_DATABASE */
|
||||
ERR_post(isc_io_error,
|
||||
gds_arg_string, "insert",
|
||||
gds_arg_string, file->ext_filename,
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@ -696,13 +699,11 @@ int INF_database_info(
|
||||
length = p - buffer;
|
||||
break;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
case isc_info_db_read_only:
|
||||
*p++ = (dbb->dbb_flags & DBB_read_only) ? 1 : 0;
|
||||
length = p - buffer;
|
||||
|
||||
break;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
case isc_info_db_size_in_pages:
|
||||
CCH_flush(tdbb, (USHORT) FLUSH_ALL, 0L);
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -731,11 +734,9 @@ void INI_update_database(void)
|
||||
dbb = tdbb->tdbb_database;
|
||||
CHECK_DBB(dbb);
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* If database is ReadOnly, return without upgrading ODS */
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* check out the update version to see if we have work to do */
|
||||
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#ifdef SHLIB_DEFS
|
||||
@ -818,12 +821,6 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status,
|
||||
INI_update_database();
|
||||
}
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* Attachments to a ReadOnly database need NOT do garbage collection */
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
attachment->att_flags |= ATT_no_cleanup;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
if (options.dpb_disable_wal)
|
||||
{
|
||||
ERR_post(gds_lock_timeout, gds_arg_gds, gds_obj_in_use,
|
||||
@ -1204,19 +1201,6 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status,
|
||||
PAG_set_page_buffers(options.dpb_page_buffers);
|
||||
}
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if (options.dpb_set_db_readonly)
|
||||
{
|
||||
if (!CCH_exclusive(tdbb, LCK_EX, WAIT_PERIOD))
|
||||
{
|
||||
ERR_post(gds_lock_timeout, gds_arg_gds, gds_obj_in_use,
|
||||
gds_arg_string, ERR_string(file_name, fl), 0);
|
||||
}
|
||||
|
||||
PAG_set_db_readonly(dbb, options.dpb_db_readonly);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM
|
||||
/* don't record the attach until now in case the log is added during the attach */
|
||||
|
||||
@ -1959,6 +1943,15 @@ STATUS DLL_EXPORT GDS_CREATE_DATABASE(STATUS* user_status,
|
||||
VIO_init(tdbb);
|
||||
#endif
|
||||
|
||||
if (options.dpb_set_db_readonly)
|
||||
{
|
||||
if (!CCH_exclusive (tdbb, LCK_EX, WAIT_PERIOD))
|
||||
ERR_post (gds__lock_timeout, gds_arg_gds, gds__obj_in_use,
|
||||
gds_arg_string, ERR_string (file_name, fl), 0);
|
||||
|
||||
PAG_set_db_readonly (dbb, options.dpb_db_readonly);
|
||||
}
|
||||
|
||||
CCH_release_exclusive(tdbb);
|
||||
|
||||
/* Figure out what character set & collation this attachment prefers */
|
||||
@ -5066,13 +5059,6 @@ static void get_options(UCHAR* dpb,
|
||||
options->dpb_set_db_sql_dialect = (USHORT) get_parameter(&p);
|
||||
break;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
case isc_dpb_set_db_readonly:
|
||||
options->dpb_set_db_readonly = TRUE;
|
||||
options->dpb_db_readonly = (SSHORT) get_parameter(&p);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
l = *p++;
|
||||
p += l;
|
||||
|
@ -19,9 +19,12 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
/*
|
||||
$Id: met.e,v 1.1.1.1 2001-05-23 13:26:19 tamlin Exp $
|
||||
$Id: met.e,v 1.2 2001-07-10 17:35:13 awharrison Exp $
|
||||
*/
|
||||
|
||||
#ifdef SHLIB_DEFS
|
||||
@ -882,12 +885,10 @@ void MET_load_trigger(
|
||||
if (relation->rel_flags & REL_sys_trigs_being_loaded)
|
||||
return;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* No need to load triggers for ReadOnly databases,
|
||||
since INSERT/DELETE/UPDATE statements are not going to be allowed */
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
return;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
/* Scan RDB$TRIGGERS next */
|
||||
|
||||
@ -2101,7 +2102,6 @@ void MET_parse_sys_trigger(TDBB tdbb, REL relation)
|
||||
if (relation->rel_post_modify)
|
||||
MET_release_triggers(tdbb, &relation->rel_post_modify);
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* No need to load triggers for ReadOnly databases, since
|
||||
INSERT/DELETE/UPDATE statements are not going to be allowed */
|
||||
|
||||
@ -2109,7 +2109,6 @@ void MET_parse_sys_trigger(TDBB tdbb, REL relation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
relation->rel_flags |= REL_sys_trigs_being_loaded;
|
||||
|
||||
|
@ -15,6 +15,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
#include "../jrd/ib_stdio.h"
|
||||
#include <fcntl.h>
|
||||
@ -396,18 +399,15 @@ FIL PIO_open(dbb, string, length, trace_flag, connection, file_name,
|
||||
break;
|
||||
|
||||
if (desc == -1) {
|
||||
#ifdef READONLY_DATABASE
|
||||
/* Try opening the database file in ReadOnly mode. The database file could
|
||||
* be on a RO medium (CD-ROM etc.). If this fileopen fails, return error.
|
||||
*/
|
||||
if ((desc = NWDFS_open(ptr, O_RDONLY)) == -1) {
|
||||
#endif /* READONLY_DATABASE */
|
||||
ERR_post(isc_io_error,
|
||||
gds_arg_string, "open",
|
||||
gds_arg_cstring, file_length, ERR_string(file_name,
|
||||
file_length),
|
||||
isc_arg_gds, isc_io_open_err, gds_arg_netware, errno, 0);
|
||||
#ifdef READONLY_DATABASE
|
||||
}
|
||||
else {
|
||||
/* If this is the primary file, set DBB flag to indicate that it is
|
||||
@ -418,7 +418,6 @@ FIL PIO_open(dbb, string, length, trace_flag, connection, file_name,
|
||||
if (!dbb->dbb_file)
|
||||
dbb->dbb_flags |= DBB_being_opened_read_only;
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
}
|
||||
|
||||
return dfs_setup_file(dbb, string, length, desc);
|
||||
|
@ -30,6 +30,11 @@
|
||||
* for use in DPM_gen_id.
|
||||
*/
|
||||
|
||||
/* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
#include <string.h>
|
||||
|
||||
@ -72,11 +77,7 @@ static void find_clump_space(SLONG, WIN *, PAG *, USHORT, SSHORT, UCHAR *,
|
||||
static BOOLEAN find_type(SLONG, WIN *, PAG *, USHORT, USHORT, UCHAR **,
|
||||
UCHAR **);
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
#define ERR_POST_IF_DATABASE_IS_READONLY(dbb) {if (dbb->dbb_flags & DBB_read_only) ERR_post (isc_read_only_database, 0);}
|
||||
#else
|
||||
#define ERR_POST_IF_DATABASE_IS_READONLY
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
/* This macro enables the ability of the engine to connect to databases
|
||||
* from ODS 8 up to the latest. If this macro is undefined, the engine
|
||||
@ -729,9 +730,7 @@ SLONG PAG_attachment_id(void)
|
||||
JRNDA_SIZE, 0, 0);
|
||||
}
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
#ifdef READONLY_DATABASE
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
/* Take out lock on attachment id */
|
||||
|
||||
@ -1114,7 +1113,6 @@ if (header->hdr_implementation && header->hdr_implementation != CLASS)
|
||||
dbb->dbb_oldest_active = header->hdr_oldest_active;
|
||||
dbb->dbb_oldest_snapshot = header->hdr_oldest_snapshot;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
dbb->dbb_attachment_id = header->hdr_attachment_id;
|
||||
|
||||
if (header->hdr_flags & hdr_read_only) {
|
||||
@ -1136,13 +1134,10 @@ if (header->hdr_implementation && header->hdr_implementation != CLASS)
|
||||
gds_arg_cstring, file_length, ERR_string(file_name,
|
||||
file_length), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (header->hdr_flags & hdr_force_write) {
|
||||
dbb->dbb_flags |= DBB_force_write;
|
||||
#ifdef READONLY_DATABASE
|
||||
if (!(header->hdr_flags & hdr_read_only))
|
||||
#endif /* READONLY_DATABASE */
|
||||
PIO_force_write(dbb->dbb_file, TRUE);
|
||||
}
|
||||
|
||||
@ -1323,9 +1318,7 @@ void PAG_init2(USHORT shadow_number)
|
||||
break;
|
||||
|
||||
case HDR_sweep_interval:
|
||||
#ifdef READONLY_DATABASE
|
||||
if (!(dbb->dbb_flags & DBB_read_only))
|
||||
#endif
|
||||
MOVE_FAST(p + 2, &dbb->dbb_sweep_interval,
|
||||
sizeof(SLONG));
|
||||
break;
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include "../jrd/jrd.h"
|
||||
@ -412,10 +415,8 @@ LCK RLCK_reserve_relation(TDBB tdbb,
|
||||
USHORT result;
|
||||
if (transaction->tra_flags & TRA_system)
|
||||
return NULL;
|
||||
#ifdef READONLY_DATABASE
|
||||
if (write_flag && (tdbb->tdbb_database->dbb_flags & DBB_read_only))
|
||||
ERR_post(isc_read_only_database, 0);
|
||||
#endif /* READONLY_DATABASE */
|
||||
if (write_flag && (transaction->tra_flags & TRA_readonly))
|
||||
ERR_post(gds__read_only_trans, 0);
|
||||
lock = RLCK_transaction_relation_lock(transaction, relation);
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include "../jrd/ibsetjmp.h"
|
||||
@ -153,7 +156,6 @@ BOOLEAN TRA_active_transactions(TDBB tdbb, DBB dbb)
|
||||
oldest = dbb->dbb_oldest_transaction;
|
||||
active = MAX(dbb->dbb_oldest_active, dbb->dbb_oldest_transaction);
|
||||
#else
|
||||
#ifdef READONLY_DATABASE
|
||||
if (dbb->dbb_flags & DBB_read_only) {
|
||||
number = dbb->dbb_next_transaction;
|
||||
oldest = dbb->dbb_oldest_transaction;
|
||||
@ -168,14 +170,6 @@ BOOLEAN TRA_active_transactions(TDBB tdbb, DBB dbb)
|
||||
MAX(header->hdr_oldest_active, header->hdr_oldest_transaction);
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
}
|
||||
#else
|
||||
window.win_page = HEADER_PAGE;
|
||||
header = (HDR) CCH_FETCH(tdbb, &window, LCK_read, pag_header);
|
||||
number = header->hdr_next_transaction;
|
||||
oldest = header->hdr_oldest_transaction;
|
||||
active = MAX(header->hdr_oldest_active, header->hdr_oldest_transaction);
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
#endif /* READONLY_DATABASE */
|
||||
#endif /* SUPERSERVER_V2 */
|
||||
|
||||
base = oldest & ~TRA_MASK;
|
||||
@ -245,11 +239,9 @@ void TRA_cleanup(TDBB tdbb)
|
||||
dbb = tdbb->tdbb_database;
|
||||
CHECK_DBB(dbb);
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* Return without cleaning up the TIP's for a ReadOnly database */
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
return;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
/* First, make damn sure there are no outstanding transactions */
|
||||
|
||||
@ -1028,11 +1020,9 @@ TRA TRA_reconnect(TDBB tdbb, UCHAR * id, USHORT length)
|
||||
dbb = tdbb->tdbb_database;
|
||||
CHECK_DBB(dbb);
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* Cannot work on limbo transactions for ReadOnly database */
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
ERR_post(isc_read_only_database, 0);
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
|
||||
tdbb->tdbb_default = ALL_pool();
|
||||
@ -1287,13 +1277,11 @@ void TRA_set_state(TDBB tdbb, TRA transaction, SLONG number, SSHORT state)
|
||||
transaction->tra_number == number &&
|
||||
transaction->tra_flags & TRA_precommitted) return;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* If it is a ReadOnly DB, set the new state in the TIP cache and return */
|
||||
if ((dbb->dbb_flags & DBB_read_only) && dbb->dbb_tip_cache) {
|
||||
TPC_set_state(tdbb, number, state);
|
||||
return;
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
trans_per_tip = dbb->dbb_pcontrol->pgc_tpt;
|
||||
sequence = number / trans_per_tip;
|
||||
@ -1522,7 +1510,6 @@ TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
|
||||
oldest_snapshot = dbb->dbb_oldest_snapshot;
|
||||
|
||||
#else /* SUPERSERVER_V2 */
|
||||
#ifdef READONLY_DATABASE
|
||||
if (dbb->dbb_flags & DBB_read_only) {
|
||||
number = ++dbb->dbb_next_transaction;
|
||||
oldest = dbb->dbb_oldest_transaction;
|
||||
@ -1539,14 +1526,6 @@ TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
|
||||
oldest_active = header->hdr_oldest_active;
|
||||
oldest_snapshot = header->hdr_oldest_snapshot;
|
||||
}
|
||||
#else
|
||||
header = bump_transaction_id(tdbb, &window);
|
||||
number = header->hdr_next_transaction;
|
||||
oldest = header->hdr_oldest_transaction;
|
||||
active = MAX(header->hdr_oldest_active, header->hdr_oldest_transaction);
|
||||
oldest_active = header->hdr_oldest_active;
|
||||
oldest_snapshot = header->hdr_oldest_snapshot;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
#endif /* SUPERSERVER_V2 */
|
||||
|
||||
@ -1594,9 +1573,7 @@ TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
|
||||
|
||||
if (!LCK_lock_non_blocking(tdbb, lock, LCK_write, TRUE)) {
|
||||
#ifndef SUPERSERVER_V2
|
||||
#ifdef READONLY_DATABASE
|
||||
if (!(dbb->dbb_flags & DBB_read_only))
|
||||
#endif /* READONLY_DATABASE */
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
#endif
|
||||
ALL_release(reinterpret_cast < frb * >(trans));
|
||||
@ -1609,9 +1586,7 @@ TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
|
||||
TRA_link_transaction(tdbb, trans);
|
||||
|
||||
#ifndef SUPERSERVER_V2
|
||||
#ifdef READONLY_DATABASE
|
||||
if (!(dbb->dbb_flags & DBB_read_only))
|
||||
#endif /* READONLY_DATABASE */
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
#endif
|
||||
|
||||
@ -1619,12 +1594,10 @@ TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
|
||||
TRA_link_transaction(tdbb, trans);
|
||||
#endif
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if (dbb->dbb_flags & DBB_read_only) {
|
||||
/* Set transaction flags to TRA_precommitted, TRA_readonly */
|
||||
trans->tra_flags |= (TRA_readonly | TRA_precommitted);
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
#ifndef GATEWAY
|
||||
/* Next, take a snapshot of all transactions between the oldest interesting
|
||||
@ -1874,11 +1847,9 @@ int TRA_sweep(TDBB tdbb, TRA trans)
|
||||
dbb = tdbb->tdbb_database;
|
||||
CHECK_DBB(dbb);
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* No point trying to sweep a ReadOnly database */
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
return FALSE;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
if (dbb->dbb_flags & DBB_sweep_in_progress)
|
||||
return TRUE;
|
||||
@ -2195,11 +2166,9 @@ static SLONG bump_transaction_id(TDBB tdbb, WIN * window)
|
||||
|
||||
number = ++dbb->dbb_next_transaction;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
/* No need to write TID onto the TIP page, for a RO DB */
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
return number;
|
||||
#endif /* READONLY_DATABASE */
|
||||
|
||||
/* If this is the first transaction on a TIP, allocate the TIP now. */
|
||||
|
||||
@ -2756,17 +2725,12 @@ static void retain_context(TDBB tdbb, TRA transaction, USHORT commit)
|
||||
#ifdef SUPERSERVER_V2
|
||||
new_number = bump_transaction_id(tdbb, &window);
|
||||
#else
|
||||
#ifdef READONLY_DATABASE
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
new_number = ++dbb->dbb_next_transaction;
|
||||
else {
|
||||
header = bump_transaction_id(tdbb, &window);
|
||||
new_number = header->hdr_next_transaction;
|
||||
}
|
||||
#else
|
||||
header = bump_transaction_id(tdbb, &window);
|
||||
new_number = header->hdr_next_transaction;
|
||||
#endif /* READONLY_DATABASE */
|
||||
#endif
|
||||
|
||||
if (old_lock = transaction->tra_lock) {
|
||||
@ -2784,9 +2748,7 @@ static void retain_context(TDBB tdbb, TRA transaction, USHORT commit)
|
||||
|
||||
if (!LCK_lock_non_blocking(tdbb, new_lock, LCK_write, TRUE)) {
|
||||
#ifndef SUPERSERVER_V2
|
||||
#ifdef READONLY_DATABASE
|
||||
if (!(dbb->dbb_flags & DBB_read_only))
|
||||
#endif
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
#endif
|
||||
ERR_post(gds_lock_conflict, 0);
|
||||
@ -2794,9 +2756,7 @@ static void retain_context(TDBB tdbb, TRA transaction, USHORT commit)
|
||||
}
|
||||
|
||||
#ifndef SUPERSERVER_V2
|
||||
#ifdef READONLY_DATABASE
|
||||
if (!(dbb->dbb_flags & DBB_read_only))
|
||||
#endif
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
#endif
|
||||
|
||||
@ -2812,17 +2772,13 @@ static void retain_context(TDBB tdbb, TRA transaction, USHORT commit)
|
||||
transaction->tra_number = old_number;
|
||||
#endif
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if (!(dbb->dbb_flags & DBB_read_only)) {
|
||||
#endif /* READONLY_DATABASE */
|
||||
/* Set the state on the inventory page */
|
||||
if (commit)
|
||||
TRA_set_state(tdbb, transaction, old_number, tra_committed);
|
||||
else
|
||||
TRA_set_state(tdbb, transaction, old_number, tra_dead);
|
||||
#ifdef READONLY_DATABASE
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
transaction->tra_number = new_number;
|
||||
|
||||
/* Release transaction lock since it isn't needed
|
||||
@ -2858,9 +2814,7 @@ static void retain_context(TDBB tdbb, TRA transaction, USHORT commit)
|
||||
}
|
||||
|
||||
if (transaction->tra_flags & TRA_precommitted) {
|
||||
#ifdef READONLY_DATABASE
|
||||
if (!(dbb->dbb_flags & DBB_read_only))
|
||||
#endif
|
||||
{
|
||||
transaction->tra_flags &= ~TRA_precommitted;
|
||||
TRA_set_state(tdbb, transaction, new_number, tra_committed);
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#ifdef SHLIB_DEFS
|
||||
@ -646,20 +649,17 @@ FIL PIO_open(DBB dbb,
|
||||
}
|
||||
|
||||
if (desc == -1) {
|
||||
#ifdef READONLY_DATABASE
|
||||
/* Try opening the database file in ReadOnly mode. The database file could
|
||||
* be on a RO medium (CD-ROM etc.). If this fileopen fails, return error.
|
||||
*/
|
||||
flag &= ~O_RDWR;
|
||||
flag |= O_RDONLY;
|
||||
if ((desc = open(ptr, flag)) == -1) {
|
||||
#endif /* READONLY_DATABASE */
|
||||
ERR_post(isc_io_error,
|
||||
gds_arg_string, "open",
|
||||
gds_arg_cstring, file_length, ERR_string(file_name,
|
||||
file_length),
|
||||
isc_arg_gds, isc_io_open_err, gds_arg_unix, errno, 0);
|
||||
#ifdef READONLY_DATABASE
|
||||
}
|
||||
else {
|
||||
/* If this is the primary file, set DBB flag to indicate that it is
|
||||
@ -670,7 +670,6 @@ FIL PIO_open(DBB dbb,
|
||||
if (!dbb->dbb_file)
|
||||
dbb->dbb_flags |= DBB_being_opened_read_only;
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
}
|
||||
|
||||
return setup_file(dbb, string, length, desc);
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
@ -1787,10 +1790,8 @@ void VIO_init(TDBB tdbb)
|
||||
dbb = tdbb->tdbb_database;
|
||||
attachment = tdbb->tdbb_attachment;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if (dbb->dbb_flags & DBB_read_only)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* If there's no presence of a garbage collector running
|
||||
then start one up. */
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@ -529,7 +532,6 @@ FIL PIO_open(DBB dbb,
|
||||
FILE_FLAG_RANDOM_ACCESS | dwExtraFlags, 0);
|
||||
|
||||
if (desc == INVALID_HANDLE_VALUE) {
|
||||
#ifdef READONLY_DATABASE
|
||||
/* Try opening the database file in ReadOnly mode.
|
||||
* The database file could be on a RO medium (CD-ROM etc.).
|
||||
* If this fileopen fails, return error.
|
||||
@ -543,7 +545,6 @@ FIL PIO_open(DBB dbb,
|
||||
FILE_FLAG_RANDOM_ACCESS | dwExtraFlags, 0);
|
||||
|
||||
if (desc == INVALID_HANDLE_VALUE) {
|
||||
#endif /* READONLY_DATABASE */
|
||||
ERR_post(isc_io_error,
|
||||
gds_arg_string,
|
||||
"CreateFile (open)",
|
||||
@ -552,7 +553,6 @@ FIL PIO_open(DBB dbb,
|
||||
ERR_string(file_name, file_length),
|
||||
isc_arg_gds,
|
||||
isc_io_open_err, gds_arg_win32, GetLastError(), 0);
|
||||
#ifdef READONLY_DATABASE
|
||||
}
|
||||
else {
|
||||
/* If this is the primary file, set DBB flag to indicate that it is
|
||||
@ -563,7 +563,6 @@ FIL PIO_open(DBB dbb,
|
||||
if (!dbb->dbb_file)
|
||||
dbb->dbb_flags |= DBB_being_opened_read_only;
|
||||
}
|
||||
#endif /* READONLY_DATABASE */
|
||||
}
|
||||
|
||||
return setup_file(dbb, string, length, desc);
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
|
||||
* conditionals, as the engine now fully supports
|
||||
* readonly databases.
|
||||
*/
|
||||
|
||||
#include "../jrd/ib_stdio.h"
|
||||
@ -1307,17 +1310,10 @@ static DBA_FIL db_open( UCHAR * file_name, USHORT file_length)
|
||||
fil->fil_fudge = 0;
|
||||
fil->fil_max_page = 0L;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if (
|
||||
(fil->fil_desc =
|
||||
FEsopen(expanded_filename, O_RDONLY | O_BINARY, SH_DENYNO, 0, 0,
|
||||
PrimaryDataStream)) == -1)
|
||||
#else
|
||||
if (
|
||||
(fil->fil_desc =
|
||||
FEsopen(expanded_filename, O_RDWR | O_BINARY, SH_DENYNO, 0, 0,
|
||||
PrimaryDataStream)) == -1)
|
||||
#endif /* READONLY_DATABASE */
|
||||
{
|
||||
#ifdef SUPERSERVER
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
@ -1492,11 +1488,7 @@ static DBA_FIL db_open( UCHAR * file_name, USHORT file_length)
|
||||
fil->fil_max_page = 0L;
|
||||
|
||||
if ((fil->fil_desc = CreateFile(file_name,
|
||||
#ifdef READONLY_DATABASE
|
||||
GENERIC_READ,
|
||||
#else
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
#endif /* READONLY_DATABASE */
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
@ -1686,11 +1678,7 @@ static DBA_FIL db_open( UCHAR * file_name, USHORT file_length)
|
||||
fil->fil_fudge = 0;
|
||||
fil->fil_max_page = 0L;
|
||||
|
||||
#ifdef READONLY_DATABASE
|
||||
if ((fil->fil_desc = open(file_name, O_RDONLY)) == -1)
|
||||
#else
|
||||
if ((fil->fil_desc = open(file_name, 2)) == -1)
|
||||
#endif /* READONLY_DATABASE */
|
||||
{
|
||||
#ifdef SUPERSERVER
|
||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||
|
Loading…
Reference in New Issue
Block a user