8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 20:43:02 +01:00

read only databases are supported unconditionally in fb2

This commit is contained in:
awharrison 2001-07-10 17:35:13 +00:00
parent 9587c717b3
commit baa3485651
26 changed files with 1216 additions and 1298 deletions

View File

@ -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> #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 */ 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 (table->in_sw_value & sw_mode) {
if (--argc <= 0) if (--argc <= 0)
ALICE_error(110, 0, 0, 0, 0, 0); /* msg 110: "read_only" or "read_write" required */ 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 else
ALICE_error(110, 0, 0, 0, 0, 0); /* msg 110: "read_only" or "read_write" required */ ALICE_error(110, 0, 0, 0, 0, 0); /* msg 110: "read_only" or "read_write" required */
} }
#endif
} }

View File

@ -15,6 +15,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 #ifndef ALICE_ALICESWI_H
#define 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, IN_SW_ALICE_MEND, isc_spb_rpr_mend_db, "mend", SW_MEND,
0, ~sw_no_update, FALSE, 38, 0, NULL, 0, ~sw_no_update, FALSE, 38, 0, NULL,
/* msg 38: \t-mend\t\tprepare corrupt database for backup */ /* msg 38: \t-mend\t\tprepare corrupt database for backup */
#ifdef READONLY_DATABASE
IN_SW_ALICE_MODE, 0, "mode", sw_mode, IN_SW_ALICE_MODE, 0, "mode", sw_mode,
0, ~sw_mode, FALSE, 109, 0, NULL, 0, ~sw_mode, FALSE, 109, 0, NULL,
/* msg 109: \t-mode\t\tread_only or read_write */ /* 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, IN_SW_ALICE_NO_UPDATE, isc_spb_rpr_check_db, "no_update", sw_no_update,
sw_validate, 0, FALSE, 39, 0, NULL, sw_validate, 0, FALSE, 39, 0, NULL,
/* msg 39: \t-no_update\tread-only validation (-v) */ /* 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, 0, 0, 0, FALSE, 0, 0, NULL,
IN_SW_ALICE_HIDDEN_ATTACH, isc_spb_prp_deny_new_attachments, IN_SW_ALICE_HIDDEN_ATTACH, isc_spb_prp_deny_new_attachments,
"shut -attach", 0, 0, 0, FALSE, 0, 0, NULL, "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, IN_SW_ALICE_HIDDEN_RDONLY, isc_spb_prp_am_readonly, "mode read_only", 0,
0, 0, FALSE, 0, 0, NULL, 0, 0, FALSE, 0, 0, NULL,
IN_SW_ALICE_HIDDEN_RDWRITE, isc_spb_prp_am_readwrite, "mode read_write", IN_SW_ALICE_HIDDEN_RDWRITE, isc_spb_prp_am_readwrite, "mode read_write",
0, 0, 0, FALSE, 0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL,
#endif /* READONLY_DATABASE */
/************************************************************************/ /************************************************************************/
IN_SW_ALICE_0, 0, NULL, 0, IN_SW_ALICE_0, 0, NULL, 0,
0, 0, FALSE, 0, 0, NULL 0, 0, FALSE, 0, 0, NULL

View File

@ -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" #include "../jrd/ib_stdio.h"
@ -289,13 +293,12 @@ static USHORT build_dpb(UCHAR * dpb, ULONG switches)
*d++ = 1; *d++ = 1;
*d++ = tdgbl->ALICE_data.ua_use; *d++ = tdgbl->ALICE_data.ua_use;
} }
#ifdef READONLY_DATABASE
else if (switches & sw_mode) { else if (switches & sw_mode) {
*d++ = isc_dpb_set_db_readonly; *d++ = isc_dpb_set_db_readonly;
*d++ = 1; *d++ = 1;
*d++ = tdgbl->ALICE_data.ua_read_only; *d++ = tdgbl->ALICE_data.ua_read_only;
} }
#endif /* READONLY_DATABASE */
else if (switches & sw_shut) { else if (switches & sw_shut) {
*d++ = gds_dpb_shutdown; *d++ = gds_dpb_shutdown;
*d++ = 1; *d++ = 1;

View File

@ -20,9 +20,13 @@
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* Toni Martir: Added verbose backup records as BACKUP_VERBOSE_INTERVAL * 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" #include "../jrd/ib_stdio.h"
@ -2812,12 +2816,10 @@ static void write_database( TEXT * dbb_file)
PUT_NUMERIC(att_SQL_dialect, SQL_dialect); PUT_NUMERIC(att_SQL_dialect, SQL_dialect);
break; break;
#ifdef READONLY_DATABASE
case isc_info_db_read_only: case isc_info_db_read_only:
if (db_read_only = (USHORT) isc_vax_integer(d, length)) if (db_read_only = (USHORT) isc_vax_integer(d, length))
PUT_NUMERIC(att_db_read_only, db_read_only); PUT_NUMERIC(att_db_read_only, db_read_only);
break; break;
#endif /* READONLY_DATABASE */
default: default:
BURP_error_redirect(status_vector, 31, NULL, NULL); BURP_error_redirect(status_vector, 31, NULL, NULL);

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 "../jrd/ib_stdio.h"
@ -629,9 +632,7 @@ int DLL_EXPORT BURP_gbak(int argc,
tdgbl->gbl_sw_ignore_limbo = FALSE; tdgbl->gbl_sw_ignore_limbo = FALSE;
tdgbl->gbl_sw_blk_factor = 0; tdgbl->gbl_sw_blk_factor = 0;
tdgbl->gbl_sw_no_reserve = FALSE; tdgbl->gbl_sw_no_reserve = FALSE;
#ifdef READONLY_DATABASE
tdgbl->gbl_sw_mode = FALSE; tdgbl->gbl_sw_mode = FALSE;
#endif /* READONLY_DATABASE */
tdgbl->gbl_sw_skip_count = 0; tdgbl->gbl_sw_skip_count = 0;
tdgbl->gbl_sw_bug8183 = FALSE; tdgbl->gbl_sw_bug8183 = FALSE;
tdgbl->action = NULL; 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" */ BURP_error(259, *argv, 0, 0, 0, 0); /* msg 259 expected page buffers, encountered "%s" */
argv++; argv++;
} }
#ifdef READONLY_DATABASE
else if (in_sw_tab->in_sw == IN_SW_BURP_MODE) { else if (in_sw_tab->in_sw == IN_SW_BURP_MODE) {
if (argv >= end) if (argv >= end)
BURP_error(279, 0, 0, 0, 0, 0); /* msg 279: "read_only" or "read_write" required */ 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 */ BURP_error(279, 0, 0, 0, 0, 0); /* msg 279: "read_only" or "read_write" required */
tdgbl->gbl_sw_mode = TRUE; tdgbl->gbl_sw_mode = TRUE;
} }
#endif /* READONLY_DATABASE */
else if (in_sw_tab->in_sw == IN_SW_BURP_PASS) { else if (in_sw_tab->in_sw == IN_SW_BURP_PASS) {
if (argv >= end) if (argv >= end)
BURP_error(189, 0, 0, 0, 0, 0); /* password parameter missing */ 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; tdgbl->gbl_sw_meta = TRUE;
break; break;
#ifdef READONLY_DATABASE
case (IN_SW_BURP_MODE): case (IN_SW_BURP_MODE):
tdgbl->gbl_sw_mode = TRUE; tdgbl->gbl_sw_mode = TRUE;
break; break;
#endif /* READONLY_DATABASE */
case (IN_SW_BURP_N): case (IN_SW_BURP_N):
tdgbl->gbl_sw_novalidity = TRUE; tdgbl->gbl_sw_novalidity = TRUE;

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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_ #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, 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, IN_SW_BURP_M, 0, "META_DATA", 0, 0, 0, FALSE, 63, 0, NULL,
/* msg 63: %sMETA_DATA backup metadata only */ /* msg 63: %sMETA_DATA backup metadata only */
#ifdef READONLY_DATABASE
IN_SW_BURP_MODE, 0, "MODE", 0, 0, 0, FALSE, 278, 0, NULL, IN_SW_BURP_MODE, 0, "MODE", 0, 0, 0, FALSE, 278, 0, NULL,
/* msg 278: %sMODE read_only or read_write access */ /* 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, 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 */ /* 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, 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 #endif
/* next switch is a hidden option in case of bug_no 8183 */ /* 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, 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 */ /* The next two 'virtual' switches are hidden from user and are needed */
/* for services API */ /* 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_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, 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 IN_SW_BURP_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL
}; };

View File

@ -21,9 +21,13 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* Toni Martir: Verbose records restored as RESTORE_VERBOSE_INTERVAL, * Toni Martir: Verbose records restored as RESTORE_VERBOSE_INTERVAL,
* also verbose restoring indexes as DEFERRED when verbose * 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" #include "../jrd/ib_stdio.h"
@ -581,7 +585,6 @@ int RESTORE_restore( TEXT * file_name, TEXT * database_name)
return FINI_DB_NOT_ONLINE; return FINI_DB_NOT_ONLINE;
} }
#ifdef READONLY_DATABASE
/* If the database is to be restored ReadOnly, set it to read_only now! */ /* 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) { 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); 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(); general_on_error();
} }
#endif /* READONLY_DATABASE */
return FINI_OK; return FINI_OK;
} }
@ -863,11 +865,9 @@ static void create_database( UCHAR * file_name)
no_reserve = (USHORT) get_numeric(); no_reserve = (USHORT) get_numeric();
break; break;
#ifdef READONLY_DATABASE
case att_db_read_only: case att_db_read_only:
db_read_only = (UCHAR) get_numeric(); db_read_only = (UCHAR) get_numeric();
break; break;
#endif /* READONLY_DATABASE */
case att_page_buffers: case att_page_buffers:
page_buffers = get_numeric(); page_buffers = get_numeric();
@ -900,7 +900,6 @@ static void create_database( UCHAR * file_name)
if (tdgbl->gbl_sw_no_reserve) if (tdgbl->gbl_sw_no_reserve)
no_reserve = tdgbl->gbl_sw_no_reserve; no_reserve = tdgbl->gbl_sw_no_reserve;
#ifdef READONLY_DATABASE
/* Override attribute setting with user requirement */ /* Override attribute setting with user requirement */
if (tdgbl->gbl_sw_mode == TRUE) if (tdgbl->gbl_sw_mode == TRUE)
db_read_only = tdgbl->gbl_sw_mode_val; 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 = TRUE;
tdgbl->gbl_sw_mode_val = db_read_only; tdgbl->gbl_sw_mode_val = db_read_only;
} }
#endif /* READONLY_DATABASE */
if (tdgbl->gbl_sw_page_buffers) if (tdgbl->gbl_sw_page_buffers)
page_buffers = 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 >> 16);
*d++ = (UCHAR) (sweep_interval >> 24); *d++ = (UCHAR) (sweep_interval >> 24);
} }
#ifdef READONLY_DATABASE
/* If the database is to be restored "read_only", fillup the data pages */ /* If the database is to be restored "read_only", fillup the data pages */
if (no_reserve || db_read_only) if (no_reserve || db_read_only)
#else
if (no_reserve)
#endif /* READONLY_DATABASE */
{ {
*d++ = (UCHAR) isc_dpb_no_reserve; *d++ = (UCHAR) isc_dpb_no_reserve;
*d++ = 1; *d++ = 1;

View File

@ -20,9 +20,13 @@
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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, * 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash,
* caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET; * 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" #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) { if (request->req_dbb->dbb_flags & DBB_read_only) {
ERRD_post(isc_read_only_database, 0); ERRD_post(isc_read_only_database, 0);
return; return;
} }
#endif /* READONLY_DATABASE */
STUFF(gds_dyn_version_1); STUFF(gds_dyn_version_1);
generate_dyn(request, node); generate_dyn(request, node);

View File

@ -19,9 +19,12 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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. V4 Multi-threading changes.
@ -157,7 +160,7 @@ static CONST SCHAR db_hdr_info_items[] = {
isc_info_db_sql_dialect, isc_info_db_sql_dialect,
gds_info_ods_version, gds_info_ods_version,
gds_info_base_level, gds_info_base_level,
#ifdef READONLY_DATABASE #ifde_DATABASE
isc_info_db_read_only, isc_info_db_read_only,
#endif /* READONLY_DATABASE */ #endif /* READONLY_DATABASE */
frb_info_att_charset, frb_info_att_charset,
@ -3081,14 +3084,12 @@ static DBB init( SLONG ** db_handle)
database->dbb_base_level = (USHORT) data[1]; database->dbb_base_level = (USHORT) data[1];
break; break;
#ifdef READONLY_DATABASE
case isc_info_db_read_only: case isc_info_db_read_only:
if ((USHORT) data[0]) if ((USHORT) data[0])
database->dbb_flags |= DBB_read_only; database->dbb_flags |= DBB_read_only;
else else
database->dbb_flags &= ~DBB_read_only; database->dbb_flags &= ~DBB_read_only;
break; break;
#endif /* READONLY_DATABASE */
case frb_info_att_charset: case frb_info_att_charset:
database->dbb_att_charset = database->dbb_att_charset =

View File

@ -19,9 +19,12 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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> #include <string.h>
@ -188,10 +191,8 @@ BLB BLB_create2(TDBB tdbb,
dbb = tdbb->tdbb_database; dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
#ifdef READONLY_DATABASE
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
ERR_post(isc_read_only_database, 0); ERR_post(isc_read_only_database, 0);
#endif /* READONLY_DATABASE */
/* Create a blob large enough to hold a single data page */ /* 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; dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
#ifdef READONLY_DATABASE
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
ERR_post(isc_read_only_database, 0); ERR_post(isc_read_only_database, 0);
#endif /* READONLY_DATABASE */
/* Level 0 blobs don't need cleanup */ /* Level 0 blobs don't need cleanup */

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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/ibsetjmp.h"
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
@ -1216,10 +1219,8 @@ BOOLEAN CCH_free_page(TDBB tdbb)
dbb = tdbb->tdbb_database; dbb = tdbb->tdbb_database;
bcb = dbb->dbb_bcb; bcb = dbb->dbb_bcb;
#ifdef READONLY_DATABASE
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
return FALSE; return FALSE;
#endif
if (bcb->bcb_flags & BCB_free_pending && if (bcb->bcb_flags & BCB_free_pending &&
(bdb = get_buffer(tdbb, FREE_PAGE, LATCH_none, 1))) { (bdb = get_buffer(tdbb, FREE_PAGE, LATCH_none, 1))) {
@ -1451,9 +1452,7 @@ void CCH_init(TDBB tdbb, ULONG number)
#endif #endif
#ifdef CACHE_WRITER #ifdef CACHE_WRITER
#ifdef READONLY_DATABASE
if (!(dbb->dbb_flags & DBB_read_only)) if (!(dbb->dbb_flags & DBB_read_only))
#endif
{ {
event = dbb->dbb_writer_event; event = dbb->dbb_writer_event;
ISC_event_init(event, 0, 0); ISC_event_init(event, 0, 0);

View File

@ -21,9 +21,13 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* Added TCP_NO_DELAY option for superserver on Linux * Added TCP_NO_DELAY option for superserver on Linux
* FSG 16.03.2001 * 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 #ifndef JRD_COMMON_H
@ -1139,11 +1143,6 @@ typedef struct {
} SQUAD; } SQUAD;
#endif #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 */ #ifndef ATOM_DEFINED /* 32 or 64 bit */
typedef long SATOM; typedef long SATOM;
typedef unsigned long UATOM; typedef unsigned long UATOM;

View File

@ -29,6 +29,11 @@
* Change: Corrected routine to use new variables from PAG_init. * 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/ib_stdio.h"
#include "../jrd/ibsetjmp.h" #include "../jrd/ibsetjmp.h"
#include <string.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_page = vector->vcl_long[sequence];
window.win_flags = 0; window.win_flags = 0;
#ifdef READONLY_DATABASE
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
page = (GPG) CCH_FETCH(tdbb, &window, LCK_read, pag_ids); page = (GPG) CCH_FETCH(tdbb, &window, LCK_read, pag_ids);
else else
page = (GPG) CCH_FETCH(tdbb, &window, LCK_write, pag_ids); 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 /* 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. * 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; lptr = ((SLONG *) (((PPG) page)->ppg_page)) + offset;
if (val || initialize) { if (val || initialize) {
#ifdef READONLY_DATABASE
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
ERR_post(isc_read_only_database, 0); ERR_post(isc_read_only_database, 0);
#endif /* READONLY_DATABASE */
CCH_MARK(tdbb, &window); CCH_MARK(tdbb, &window);
/* Initialize or increment the quad value in an ODS 10 or later /* Initialize or increment the quad value in an ODS 10 or later

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 "../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 /* check if file is read only if read only then
post error we cannot write to this file */ post error we cannot write to this file */
if (file->ext_flags & EXT_readonly) { if (file->ext_flags & EXT_readonly) {
#ifdef READONLY_DATABASE
DBB dbb; DBB dbb;
dbb = GET_DBB; dbb = GET_DBB;
@ -449,7 +451,6 @@ void EXT_store(RPB * rpb, int *transaction)
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
ERR_post(isc_read_only_database, 0); ERR_post(isc_read_only_database, 0);
else else
#endif /* READONLY_DATABASE */
ERR_post(isc_io_error, ERR_post(isc_io_error,
gds_arg_string, "insert", gds_arg_string, "insert",
gds_arg_string, file->ext_filename, gds_arg_string, file->ext_filename,

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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> #include <string.h>
@ -696,13 +699,11 @@ int INF_database_info(
length = p - buffer; length = p - buffer;
break; break;
#ifdef READONLY_DATABASE
case isc_info_db_read_only: case isc_info_db_read_only:
*p++ = (dbb->dbb_flags & DBB_read_only) ? 1 : 0; *p++ = (dbb->dbb_flags & DBB_read_only) ? 1 : 0;
length = p - buffer; length = p - buffer;
break; break;
#endif /* READONLY_DATABASE */
case isc_info_db_size_in_pages: case isc_info_db_size_in_pages:
CCH_flush(tdbb, (USHORT) FLUSH_ALL, 0L); CCH_flush(tdbb, (USHORT) FLUSH_ALL, 0L);

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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> #include <stdio.h>
@ -731,11 +734,9 @@ void INI_update_database(void)
dbb = tdbb->tdbb_database; dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
#ifdef READONLY_DATABASE
/* If database is ReadOnly, return without upgrading ODS */ /* If database is ReadOnly, return without upgrading ODS */
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
return; return;
#endif
/* check out the update version to see if we have work to do */ /* check out the update version to see if we have work to do */

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 #ifdef SHLIB_DEFS
@ -818,12 +821,6 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status,
INI_update_database(); 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) if (options.dpb_disable_wal)
{ {
ERR_post(gds_lock_timeout, gds_arg_gds, gds_obj_in_use, 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); 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 #ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM
/* don't record the attach until now in case the log is added during the attach */ /* 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); VIO_init(tdbb);
#endif #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); CCH_release_exclusive(tdbb);
/* Figure out what character set & collation this attachment prefers */ /* 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); options->dpb_set_db_sql_dialect = (USHORT) get_parameter(&p);
break; 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: default:
l = *p++; l = *p++;
p += l; p += l;

View File

@ -19,9 +19,12 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 #ifdef SHLIB_DEFS
@ -882,12 +885,10 @@ void MET_load_trigger(
if (relation->rel_flags & REL_sys_trigs_being_loaded) if (relation->rel_flags & REL_sys_trigs_being_loaded)
return; return;
#ifdef READONLY_DATABASE
/* No need to load triggers for ReadOnly databases, /* No need to load triggers for ReadOnly databases,
since INSERT/DELETE/UPDATE statements are not going to be allowed */ since INSERT/DELETE/UPDATE statements are not going to be allowed */
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
return; return;
#endif /* READONLY_DATABASE */
/* Scan RDB$TRIGGERS next */ /* Scan RDB$TRIGGERS next */
@ -2101,7 +2102,6 @@ void MET_parse_sys_trigger(TDBB tdbb, REL relation)
if (relation->rel_post_modify) if (relation->rel_post_modify)
MET_release_triggers(tdbb, &relation->rel_post_modify); MET_release_triggers(tdbb, &relation->rel_post_modify);
#ifdef READONLY_DATABASE
/* No need to load triggers for ReadOnly databases, since /* No need to load triggers for ReadOnly databases, since
INSERT/DELETE/UPDATE statements are not going to be allowed */ INSERT/DELETE/UPDATE statements are not going to be allowed */
@ -2109,7 +2109,6 @@ void MET_parse_sys_trigger(TDBB tdbb, REL relation)
{ {
return; return;
} }
#endif /* READONLY_DATABASE */
relation->rel_flags |= REL_sys_trigs_being_loaded; relation->rel_flags |= REL_sys_trigs_being_loaded;

View File

@ -15,6 +15,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 "../jrd/ib_stdio.h"
#include <fcntl.h> #include <fcntl.h>
@ -396,18 +399,15 @@ FIL PIO_open(dbb, string, length, trace_flag, connection, file_name,
break; break;
if (desc == -1) { if (desc == -1) {
#ifdef READONLY_DATABASE
/* Try opening the database file in ReadOnly mode. The database file could /* 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. * be on a RO medium (CD-ROM etc.). If this fileopen fails, return error.
*/ */
if ((desc = NWDFS_open(ptr, O_RDONLY)) == -1) { if ((desc = NWDFS_open(ptr, O_RDONLY)) == -1) {
#endif /* READONLY_DATABASE */
ERR_post(isc_io_error, ERR_post(isc_io_error,
gds_arg_string, "open", gds_arg_string, "open",
gds_arg_cstring, file_length, ERR_string(file_name, gds_arg_cstring, file_length, ERR_string(file_name,
file_length), file_length),
isc_arg_gds, isc_io_open_err, gds_arg_netware, errno, 0); isc_arg_gds, isc_io_open_err, gds_arg_netware, errno, 0);
#ifdef READONLY_DATABASE
} }
else { else {
/* If this is the primary file, set DBB flag to indicate that it is /* 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) if (!dbb->dbb_file)
dbb->dbb_flags |= DBB_being_opened_read_only; dbb->dbb_flags |= DBB_being_opened_read_only;
} }
#endif /* READONLY_DATABASE */
} }
return dfs_setup_file(dbb, string, length, desc); return dfs_setup_file(dbb, string, length, desc);

View File

@ -30,6 +30,11 @@
* for use in DPM_gen_id. * 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 "../jrd/ib_stdio.h"
#include <string.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 **, static BOOLEAN find_type(SLONG, WIN *, PAG *, USHORT, USHORT, UCHAR **,
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);} #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 /* 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 * 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); JRNDA_SIZE, 0, 0);
} }
CCH_RELEASE(tdbb, &window); CCH_RELEASE(tdbb, &window);
#ifdef READONLY_DATABASE
} }
#endif /* READONLY_DATABASE */
/* Take out lock on attachment id */ /* 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_active = header->hdr_oldest_active;
dbb->dbb_oldest_snapshot = header->hdr_oldest_snapshot; dbb->dbb_oldest_snapshot = header->hdr_oldest_snapshot;
#ifdef READONLY_DATABASE
dbb->dbb_attachment_id = header->hdr_attachment_id; dbb->dbb_attachment_id = header->hdr_attachment_id;
if (header->hdr_flags & hdr_read_only) { 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, gds_arg_cstring, file_length, ERR_string(file_name,
file_length), 0); file_length), 0);
} }
#endif
if (header->hdr_flags & hdr_force_write) { if (header->hdr_flags & hdr_force_write) {
dbb->dbb_flags |= DBB_force_write; dbb->dbb_flags |= DBB_force_write;
#ifdef READONLY_DATABASE
if (!(header->hdr_flags & hdr_read_only)) if (!(header->hdr_flags & hdr_read_only))
#endif /* READONLY_DATABASE */
PIO_force_write(dbb->dbb_file, TRUE); PIO_force_write(dbb->dbb_file, TRUE);
} }
@ -1323,9 +1318,7 @@ void PAG_init2(USHORT shadow_number)
break; break;
case HDR_sweep_interval: case HDR_sweep_interval:
#ifdef READONLY_DATABASE
if (!(dbb->dbb_flags & DBB_read_only)) if (!(dbb->dbb_flags & DBB_read_only))
#endif
MOVE_FAST(p + 2, &dbb->dbb_sweep_interval, MOVE_FAST(p + 2, &dbb->dbb_sweep_interval,
sizeof(SLONG)); sizeof(SLONG));
break; break;

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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" #include "../jrd/jrd.h"
@ -412,10 +415,8 @@ LCK RLCK_reserve_relation(TDBB tdbb,
USHORT result; USHORT result;
if (transaction->tra_flags & TRA_system) if (transaction->tra_flags & TRA_system)
return NULL; return NULL;
#ifdef READONLY_DATABASE
if (write_flag && (tdbb->tdbb_database->dbb_flags & DBB_read_only)) if (write_flag && (tdbb->tdbb_database->dbb_flags & DBB_read_only))
ERR_post(isc_read_only_database, 0); ERR_post(isc_read_only_database, 0);
#endif /* READONLY_DATABASE */
if (write_flag && (transaction->tra_flags & TRA_readonly)) if (write_flag && (transaction->tra_flags & TRA_readonly))
ERR_post(gds__read_only_trans, 0); ERR_post(gds__read_only_trans, 0);
lock = RLCK_transaction_relation_lock(transaction, relation); lock = RLCK_transaction_relation_lock(transaction, relation);

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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/ibsetjmp.h"
@ -153,7 +156,6 @@ BOOLEAN TRA_active_transactions(TDBB tdbb, DBB dbb)
oldest = dbb->dbb_oldest_transaction; oldest = dbb->dbb_oldest_transaction;
active = MAX(dbb->dbb_oldest_active, dbb->dbb_oldest_transaction); active = MAX(dbb->dbb_oldest_active, dbb->dbb_oldest_transaction);
#else #else
#ifdef READONLY_DATABASE
if (dbb->dbb_flags & DBB_read_only) { if (dbb->dbb_flags & DBB_read_only) {
number = dbb->dbb_next_transaction; number = dbb->dbb_next_transaction;
oldest = dbb->dbb_oldest_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); MAX(header->hdr_oldest_active, header->hdr_oldest_transaction);
CCH_RELEASE(tdbb, &window); 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 */ #endif /* SUPERSERVER_V2 */
base = oldest & ~TRA_MASK; base = oldest & ~TRA_MASK;
@ -245,11 +239,9 @@ void TRA_cleanup(TDBB tdbb)
dbb = tdbb->tdbb_database; dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
#ifdef READONLY_DATABASE
/* Return without cleaning up the TIP's for a ReadOnly database */ /* Return without cleaning up the TIP's for a ReadOnly database */
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
return; return;
#endif /* READONLY_DATABASE */
/* First, make damn sure there are no outstanding transactions */ /* 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; dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
#ifdef READONLY_DATABASE
/* Cannot work on limbo transactions for ReadOnly database */ /* Cannot work on limbo transactions for ReadOnly database */
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
ERR_post(isc_read_only_database, 0); ERR_post(isc_read_only_database, 0);
#endif /* READONLY_DATABASE */
tdbb->tdbb_default = ALL_pool(); 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_number == number &&
transaction->tra_flags & TRA_precommitted) return; 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 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) { if ((dbb->dbb_flags & DBB_read_only) && dbb->dbb_tip_cache) {
TPC_set_state(tdbb, number, state); TPC_set_state(tdbb, number, state);
return; return;
} }
#endif /* READONLY_DATABASE */
trans_per_tip = dbb->dbb_pcontrol->pgc_tpt; trans_per_tip = dbb->dbb_pcontrol->pgc_tpt;
sequence = number / trans_per_tip; 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; oldest_snapshot = dbb->dbb_oldest_snapshot;
#else /* SUPERSERVER_V2 */ #else /* SUPERSERVER_V2 */
#ifdef READONLY_DATABASE
if (dbb->dbb_flags & DBB_read_only) { if (dbb->dbb_flags & DBB_read_only) {
number = ++dbb->dbb_next_transaction; number = ++dbb->dbb_next_transaction;
oldest = dbb->dbb_oldest_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_active = header->hdr_oldest_active;
oldest_snapshot = header->hdr_oldest_snapshot; 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 */ #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)) { if (!LCK_lock_non_blocking(tdbb, lock, LCK_write, TRUE)) {
#ifndef SUPERSERVER_V2 #ifndef SUPERSERVER_V2
#ifdef READONLY_DATABASE
if (!(dbb->dbb_flags & DBB_read_only)) if (!(dbb->dbb_flags & DBB_read_only))
#endif /* READONLY_DATABASE */
CCH_RELEASE(tdbb, &window); CCH_RELEASE(tdbb, &window);
#endif #endif
ALL_release(reinterpret_cast < frb * >(trans)); 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); TRA_link_transaction(tdbb, trans);
#ifndef SUPERSERVER_V2 #ifndef SUPERSERVER_V2
#ifdef READONLY_DATABASE
if (!(dbb->dbb_flags & DBB_read_only)) if (!(dbb->dbb_flags & DBB_read_only))
#endif /* READONLY_DATABASE */
CCH_RELEASE(tdbb, &window); CCH_RELEASE(tdbb, &window);
#endif #endif
@ -1619,12 +1594,10 @@ TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
TRA_link_transaction(tdbb, trans); TRA_link_transaction(tdbb, trans);
#endif #endif
#ifdef READONLY_DATABASE
if (dbb->dbb_flags & DBB_read_only) { if (dbb->dbb_flags & DBB_read_only) {
/* Set transaction flags to TRA_precommitted, TRA_readonly */ /* Set transaction flags to TRA_precommitted, TRA_readonly */
trans->tra_flags |= (TRA_readonly | TRA_precommitted); trans->tra_flags |= (TRA_readonly | TRA_precommitted);
} }
#endif /* READONLY_DATABASE */
#ifndef GATEWAY #ifndef GATEWAY
/* Next, take a snapshot of all transactions between the oldest interesting /* 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; dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
#ifdef READONLY_DATABASE
/* No point trying to sweep a ReadOnly database */ /* No point trying to sweep a ReadOnly database */
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
return FALSE; return FALSE;
#endif /* READONLY_DATABASE */
if (dbb->dbb_flags & DBB_sweep_in_progress) if (dbb->dbb_flags & DBB_sweep_in_progress)
return TRUE; return TRUE;
@ -2195,11 +2166,9 @@ static SLONG bump_transaction_id(TDBB tdbb, WIN * window)
number = ++dbb->dbb_next_transaction; number = ++dbb->dbb_next_transaction;
#ifdef READONLY_DATABASE
/* No need to write TID onto the TIP page, for a RO DB */ /* No need to write TID onto the TIP page, for a RO DB */
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
return number; return number;
#endif /* READONLY_DATABASE */
/* If this is the first transaction on a TIP, allocate the TIP now. */ /* 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 #ifdef SUPERSERVER_V2
new_number = bump_transaction_id(tdbb, &window); new_number = bump_transaction_id(tdbb, &window);
#else #else
#ifdef READONLY_DATABASE
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
new_number = ++dbb->dbb_next_transaction; new_number = ++dbb->dbb_next_transaction;
else { else {
header = bump_transaction_id(tdbb, &window); header = bump_transaction_id(tdbb, &window);
new_number = header->hdr_next_transaction; new_number = header->hdr_next_transaction;
} }
#else
header = bump_transaction_id(tdbb, &window);
new_number = header->hdr_next_transaction;
#endif /* READONLY_DATABASE */
#endif #endif
if (old_lock = transaction->tra_lock) { 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)) { if (!LCK_lock_non_blocking(tdbb, new_lock, LCK_write, TRUE)) {
#ifndef SUPERSERVER_V2 #ifndef SUPERSERVER_V2
#ifdef READONLY_DATABASE
if (!(dbb->dbb_flags & DBB_read_only)) if (!(dbb->dbb_flags & DBB_read_only))
#endif
CCH_RELEASE(tdbb, &window); CCH_RELEASE(tdbb, &window);
#endif #endif
ERR_post(gds_lock_conflict, 0); ERR_post(gds_lock_conflict, 0);
@ -2794,9 +2756,7 @@ static void retain_context(TDBB tdbb, TRA transaction, USHORT commit)
} }
#ifndef SUPERSERVER_V2 #ifndef SUPERSERVER_V2
#ifdef READONLY_DATABASE
if (!(dbb->dbb_flags & DBB_read_only)) if (!(dbb->dbb_flags & DBB_read_only))
#endif
CCH_RELEASE(tdbb, &window); CCH_RELEASE(tdbb, &window);
#endif #endif
@ -2812,17 +2772,13 @@ static void retain_context(TDBB tdbb, TRA transaction, USHORT commit)
transaction->tra_number = old_number; transaction->tra_number = old_number;
#endif #endif
#ifdef READONLY_DATABASE
if (!(dbb->dbb_flags & DBB_read_only)) { if (!(dbb->dbb_flags & DBB_read_only)) {
#endif /* READONLY_DATABASE */
/* Set the state on the inventory page */ /* Set the state on the inventory page */
if (commit) if (commit)
TRA_set_state(tdbb, transaction, old_number, tra_committed); TRA_set_state(tdbb, transaction, old_number, tra_committed);
else else
TRA_set_state(tdbb, transaction, old_number, tra_dead); TRA_set_state(tdbb, transaction, old_number, tra_dead);
#ifdef READONLY_DATABASE
} }
#endif /* READONLY_DATABASE */
transaction->tra_number = new_number; transaction->tra_number = new_number;
/* Release transaction lock since it isn't needed /* 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) { if (transaction->tra_flags & TRA_precommitted) {
#ifdef READONLY_DATABASE
if (!(dbb->dbb_flags & DBB_read_only)) if (!(dbb->dbb_flags & DBB_read_only))
#endif
{ {
transaction->tra_flags &= ~TRA_precommitted; transaction->tra_flags &= ~TRA_precommitted;
TRA_set_state(tdbb, transaction, new_number, tra_committed); TRA_set_state(tdbb, transaction, new_number, tra_committed);

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 #ifdef SHLIB_DEFS
@ -646,20 +649,17 @@ FIL PIO_open(DBB dbb,
} }
if (desc == -1) { if (desc == -1) {
#ifdef READONLY_DATABASE
/* Try opening the database file in ReadOnly mode. The database file could /* 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. * be on a RO medium (CD-ROM etc.). If this fileopen fails, return error.
*/ */
flag &= ~O_RDWR; flag &= ~O_RDWR;
flag |= O_RDONLY; flag |= O_RDONLY;
if ((desc = open(ptr, flag)) == -1) { if ((desc = open(ptr, flag)) == -1) {
#endif /* READONLY_DATABASE */
ERR_post(isc_io_error, ERR_post(isc_io_error,
gds_arg_string, "open", gds_arg_string, "open",
gds_arg_cstring, file_length, ERR_string(file_name, gds_arg_cstring, file_length, ERR_string(file_name,
file_length), file_length),
isc_arg_gds, isc_io_open_err, gds_arg_unix, errno, 0); isc_arg_gds, isc_io_open_err, gds_arg_unix, errno, 0);
#ifdef READONLY_DATABASE
} }
else { else {
/* If this is the primary file, set DBB flag to indicate that it is /* 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) if (!dbb->dbb_file)
dbb->dbb_flags |= DBB_being_opened_read_only; dbb->dbb_flags |= DBB_being_opened_read_only;
} }
#endif /* READONLY_DATABASE */
} }
return setup_file(dbb, string, length, desc); return setup_file(dbb, string, length, desc);

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 "../jrd/ib_stdio.h"
@ -1787,10 +1790,8 @@ void VIO_init(TDBB tdbb)
dbb = tdbb->tdbb_database; dbb = tdbb->tdbb_database;
attachment = tdbb->tdbb_attachment; attachment = tdbb->tdbb_attachment;
#ifdef READONLY_DATABASE
if (dbb->dbb_flags & DBB_read_only) if (dbb->dbb_flags & DBB_read_only)
return; return;
#endif
/* If there's no presence of a garbage collector running /* If there's no presence of a garbage collector running
then start one up. */ then start one up. */

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 #ifdef _MSC_VER
@ -529,7 +532,6 @@ FIL PIO_open(DBB dbb,
FILE_FLAG_RANDOM_ACCESS | dwExtraFlags, 0); FILE_FLAG_RANDOM_ACCESS | dwExtraFlags, 0);
if (desc == INVALID_HANDLE_VALUE) { if (desc == INVALID_HANDLE_VALUE) {
#ifdef READONLY_DATABASE
/* Try opening the database file in ReadOnly mode. /* Try opening the database file in ReadOnly mode.
* The database file could be on a RO medium (CD-ROM etc.). * The database file could be on a RO medium (CD-ROM etc.).
* If this fileopen fails, return error. * If this fileopen fails, return error.
@ -543,7 +545,6 @@ FIL PIO_open(DBB dbb,
FILE_FLAG_RANDOM_ACCESS | dwExtraFlags, 0); FILE_FLAG_RANDOM_ACCESS | dwExtraFlags, 0);
if (desc == INVALID_HANDLE_VALUE) { if (desc == INVALID_HANDLE_VALUE) {
#endif /* READONLY_DATABASE */
ERR_post(isc_io_error, ERR_post(isc_io_error,
gds_arg_string, gds_arg_string,
"CreateFile (open)", "CreateFile (open)",
@ -552,7 +553,6 @@ FIL PIO_open(DBB dbb,
ERR_string(file_name, file_length), ERR_string(file_name, file_length),
isc_arg_gds, isc_arg_gds,
isc_io_open_err, gds_arg_win32, GetLastError(), 0); isc_io_open_err, gds_arg_win32, GetLastError(), 0);
#ifdef READONLY_DATABASE
} }
else { else {
/* If this is the primary file, set DBB flag to indicate that it is /* 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) if (!dbb->dbb_file)
dbb->dbb_flags |= DBB_being_opened_read_only; dbb->dbb_flags |= DBB_being_opened_read_only;
} }
#endif /* READONLY_DATABASE */
} }
return setup_file(dbb, string, length, desc); return setup_file(dbb, string, length, desc);

View File

@ -19,6 +19,9 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 "../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_fudge = 0;
fil->fil_max_page = 0L; fil->fil_max_page = 0L;
#ifdef READONLY_DATABASE
if ( if (
(fil->fil_desc = (fil->fil_desc =
FEsopen(expanded_filename, O_RDONLY | O_BINARY, SH_DENYNO, 0, 0, FEsopen(expanded_filename, O_RDONLY | O_BINARY, SH_DENYNO, 0, 0,
PrimaryDataStream)) == -1) 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 #ifdef SUPERSERVER
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status, 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; fil->fil_max_page = 0L;
if ((fil->fil_desc = CreateFile(file_name, if ((fil->fil_desc = CreateFile(file_name,
#ifdef READONLY_DATABASE
GENERIC_READ, GENERIC_READ,
#else
GENERIC_READ | GENERIC_WRITE,
#endif /* READONLY_DATABASE */
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, NULL,
OPEN_EXISTING, OPEN_EXISTING,
@ -1686,11 +1678,7 @@ static DBA_FIL db_open( UCHAR * file_name, USHORT file_length)
fil->fil_fudge = 0; fil->fil_fudge = 0;
fil->fil_max_page = 0L; fil->fil_max_page = 0L;
#ifdef READONLY_DATABASE
if ((fil->fil_desc = open(file_name, O_RDONLY)) == -1) 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 #ifdef SUPERSERVER
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status, CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,