2001-05-23 15:26:42 +02:00
|
|
|
/*
|
|
|
|
* PROGRAM: JRD Backup and Restore Program
|
|
|
|
* MODULE: burp.h
|
|
|
|
* DESCRIPTION: Burp file format
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Interbase Public
|
|
|
|
* License Version 1.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy
|
|
|
|
* of the License at http://www.Inprise.com/IPL.html
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an
|
|
|
|
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
|
|
|
* or implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code was created by Inprise Corporation
|
|
|
|
* and its predecessors. Portions created by Inprise Corporation are
|
|
|
|
* Copyright (C) Inprise Corporation.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
* Contributor(s): ______________________________________.
|
2002-10-30 07:40:58 +01:00
|
|
|
*
|
|
|
|
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
|
|
|
|
*
|
2002-10-31 06:06:02 +01:00
|
|
|
// 2002.10.30 Sean Leyne - Removed support for obsolete "PC_PLATFORM" define
|
|
|
|
//
|
2001-05-23 15:26:42 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-12 11:04:38 +02:00
|
|
|
#ifndef BURP_BURP_H
|
|
|
|
#define BURP_BURP_H
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#include "../jrd/ib_stdio.h"
|
|
|
|
#include "../jrd/common.h"
|
2001-07-30 01:43:24 +02:00
|
|
|
#include "../jrd/gds.h"
|
2001-05-23 15:26:42 +02:00
|
|
|
#include "../jrd/dsc.h"
|
|
|
|
#include "../burp/misc_proto.h"
|
|
|
|
#include "../jrd/gds_proto.h"
|
|
|
|
#include "../jrd/thd.h"
|
|
|
|
|
2001-07-12 07:46:06 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2003-09-22 16:13:54 +02:00
|
|
|
static inline UCHAR* BURP_alloc(ULONG size){
|
|
|
|
return MISC_alloc_burp(size);
|
2003-09-18 23:56:26 +02:00
|
|
|
}
|
2003-09-23 21:47:50 +02:00
|
|
|
|
2003-09-22 16:13:54 +02:00
|
|
|
static inline UCHAR* BURP_alloc_zero(ULONG size){
|
|
|
|
return MISC_alloc_burp(size);
|
2003-09-18 23:56:26 +02:00
|
|
|
}
|
2003-09-23 21:47:50 +02:00
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
static inline void BURP_free(void *block){
|
|
|
|
MISC_free_burp(block);
|
|
|
|
}
|
|
|
|
|
|
|
|
const int GDS_NAME_LEN = 32;
|
2001-05-23 15:26:42 +02:00
|
|
|
typedef TEXT GDS_NAME [GDS_NAME_LEN];
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
enum redirect_vals {
|
|
|
|
NOREDIRECT = 0,
|
|
|
|
REDIRECT = 1,
|
|
|
|
NOOUTPUT = 2
|
|
|
|
};
|
2003-09-08 03:51:41 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* Record types in backup file */
|
|
|
|
|
2003-09-12 11:04:38 +02:00
|
|
|
enum rec_type {
|
2003-09-18 23:56:26 +02:00
|
|
|
rec_burp, /* Restore program attributes */
|
|
|
|
rec_database, /* Logical database parameters */
|
|
|
|
rec_global_field, /* Global field description */
|
|
|
|
rec_relation, /* Relation description */
|
|
|
|
rec_field, /* Local field description */
|
|
|
|
rec_index, /* Index description */
|
|
|
|
rec_data, /* Data for relation */
|
|
|
|
rec_blob, /* Blob */
|
|
|
|
rec_relation_data, /* Standalone data header */
|
|
|
|
rec_relation_end, /* End of data for relation */
|
|
|
|
rec_end, /* End of file */
|
|
|
|
rec_view, /* View attributes */
|
|
|
|
rec_security_class, /* Security class acl */
|
|
|
|
rec_trigger, /* Trigger definition */
|
|
|
|
rec_physical_db, /* Physical database parameters */
|
|
|
|
rec_function, /* Function description */
|
|
|
|
rec_function_arg, /* Function arguement description */
|
|
|
|
rec_function_end, /* End of function and its args */
|
|
|
|
rec_gen_id, /* From blr_gen_id */
|
|
|
|
rec_system_type, /* Type of field */
|
|
|
|
rec_filter, /* Filter */
|
|
|
|
rec_trigger_message, /* Trigger message texts */
|
|
|
|
rec_user_privilege, /* User privilege */
|
|
|
|
rec_array, /* 23*/ /* Array blob */
|
|
|
|
rec_field_dimensions, /* Array field dimensions */
|
|
|
|
rec_files, /* files for shadowing */
|
|
|
|
rec_generator, /* another format for gen-ids */
|
|
|
|
rec_procedure, /* Stored procedure */
|
|
|
|
rec_procedure_prm, /* Stored procedure parameters */
|
|
|
|
rec_procedure_end, /* End of procedure and its args */
|
|
|
|
rec_exception, /* Exception */
|
|
|
|
rec_rel_constraint, /* Relation constraints */
|
|
|
|
rec_ref_constraint, /* Referential constraints */
|
|
|
|
rec_chk_constraint, /* Check constraints */
|
|
|
|
rec_charset, /* Character sets */
|
|
|
|
rec_collation, /* Collations */
|
|
|
|
rec_sql_roles /* SQL roles */
|
2003-09-12 11:04:38 +02:00
|
|
|
};
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* The order of battle for major records is:
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
[<rec_physical_database>] <rec_database> <global fields> <field dimensions> <relation> <function>
|
|
|
|
<types> <filters> <relation data> <trigger-new> <trigger messages> <user privileges> <security> rec_end
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
where each relation is:
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
<rec_relation> <rel name> <att_end> <local fields> <view> <rec_relation_end>
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
where local fields is:
|
2003-09-18 23:56:26 +02:00
|
|
|
<rec_field> <att_field_... att_field_dimensions, att_field_range_low, att_field_range_high...> <att_end>
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
where each relation data is:
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
<rec_relation_data> <rel attributes> <gen id> <indices> <data> <trigger-old> <rec_relation_end>
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
where data is:
|
2003-09-18 23:56:26 +02:00
|
|
|
<rec_data> <rec length> [<xdr_length>] <data attr> [ <blob>, <array>...]
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
and <blob> is
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
<rec_blob> <blob_field_number> <max_sigment> <blob_type> <number_segments> <blob_data>
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
and <array> is
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
<rec_array> <blob_field_number> <att_array_dimensions> <att_array_range_low>
|
2001-05-23 15:26:42 +02:00
|
|
|
<att_array_range_high> <blob_data> [<att_xdr_array>]
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
where each function is:
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
<rec_function> <function attributes> <att_end> [<function_arguments>] <rec_function_end>
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
and <function_arguments> is
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
<rec_function_arg> <function argument attributes> <att_end>
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
where trigger-old is:
|
2003-09-18 23:56:26 +02:00
|
|
|
<rec_trigger> <trig_type> <trig_blr> <trig_source> <att_end>
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
and trigger-new is:
|
2003-09-18 23:56:26 +02:00
|
|
|
<rec_trigger> <trig_type> <trig_blr> <trig_source> <trigger name> <relation name> <trig_seqence>
|
|
|
|
<description> <system flag> <att_end>
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
*/
|
2003-09-08 03:51:41 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* Attributes within major record */
|
|
|
|
|
|
|
|
/* CAREFUL not to pull the lastest version into maint version without
|
|
|
|
modifying the att_backup_format to be one version back */
|
|
|
|
|
|
|
|
/* ATT_BACKUP_FORMAT has been increased to 5. It allows us to distinguish
|
|
|
|
backup format between IB3.3/IB4.0 and IB4.5 in case of migration
|
|
|
|
problem */
|
|
|
|
/* Version 6: Supports SQL Time & Date columns.
|
|
|
|
RDB$FIELD_PRECISION
|
|
|
|
SQL Dialect from database header
|
|
|
|
SQL_INT64 columns and generator values
|
|
|
|
*/
|
2003-09-18 23:56:26 +02:00
|
|
|
const int ATT_BACKUP_FORMAT = 6;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* format version number for ranges for arrays */
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int GDS_NDA_VERSION = 1;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* max array dimension */
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int MAX_DIMENSION = 16;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int SERIES = 1;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
enum att_type {
|
2003-09-18 23:56:26 +02:00
|
|
|
att_end = 0, /* end of major record */
|
|
|
|
|
|
|
|
/* Backup program attributes */
|
|
|
|
|
|
|
|
att_backup_date = SERIES, /* date of backup */
|
|
|
|
att_backup_format, /* backup format version */
|
|
|
|
att_backup_os, /* backup operating system */
|
|
|
|
att_backup_compress,
|
|
|
|
att_backup_transportable, /* XDR datatypes for user data */
|
|
|
|
att_backup_blksize, /* backup block size */
|
|
|
|
att_backup_file, /* database file name */
|
|
|
|
att_backup_volume, /* backup volume number */
|
|
|
|
|
|
|
|
/* Database attributes */
|
|
|
|
|
|
|
|
att_file_name = SERIES, /* database file name (physical) */
|
|
|
|
att_file_size, /* size of original database (physical) */
|
|
|
|
att_jrd_version, /* jrd version (physical) */
|
|
|
|
att_creation_date, /* database creation date (physical) */
|
|
|
|
att_page_size, /* page size of original database (physical) */
|
|
|
|
att_database_description, /* description from RDB$DATABASE (logical) */
|
|
|
|
att_database_security_class, /* database level security (logical) */
|
|
|
|
att_sweep_interval, /* sweep interval */
|
|
|
|
att_no_reserve, /* don't reserve space for versions */
|
|
|
|
att_database_description2,
|
|
|
|
att_database_dfl_charset, /* default character set from RDB$DATABASE */
|
|
|
|
att_forced_writes, /* syncronous writes flag */
|
|
|
|
att_page_buffers, /* page buffers for buffer cache */
|
|
|
|
att_SQL_dialect, /* SQL dialect that it speaks */
|
|
|
|
att_db_read_only, /* Is the database ReadOnly? */
|
|
|
|
|
|
|
|
/* Relation attributes */
|
|
|
|
|
|
|
|
att_relation_name = SERIES,
|
|
|
|
att_relation_view_blr,
|
|
|
|
att_relation_description,
|
|
|
|
att_relation_record_length, /* Record length in file */
|
|
|
|
att_relation_view_relation,
|
|
|
|
att_relation_view_context,
|
|
|
|
att_relation_system_flag,
|
|
|
|
att_relation_security_class,
|
|
|
|
att_relation_view_source,
|
|
|
|
att_relation_dummy, /* this space available */
|
|
|
|
att_relation_ext_description,
|
|
|
|
att_relation_owner_name,
|
|
|
|
att_relation_description2,
|
|
|
|
att_relation_view_source2,
|
|
|
|
att_relation_ext_description2,
|
|
|
|
att_relation_flags,
|
|
|
|
att_relation_ext_file_name, /* name of file for external tables */
|
|
|
|
|
|
|
|
/* Field attributes (used for both global and local fields) */
|
|
|
|
|
|
|
|
att_field_name = SERIES, /* name of field */
|
|
|
|
att_field_source, /* Global field name for local field */
|
|
|
|
|
|
|
|
att_base_field, /* Source field for view */
|
|
|
|
att_view_context, /* Context variable for view definition */
|
|
|
|
|
|
|
|
att_field_query_name, /* Query attributes */
|
|
|
|
att_field_query_header,
|
|
|
|
att_field_edit_string,
|
|
|
|
|
|
|
|
att_field_type, /* Physical attributes */
|
|
|
|
att_field_sub_type,
|
|
|
|
att_field_length, /* 10 */
|
|
|
|
att_field_scale,
|
|
|
|
att_field_segment_length,
|
|
|
|
att_field_position, /* Field position in relation (not in file) */
|
|
|
|
att_field_offset, /* Offset in data record (local fields only) */
|
|
|
|
|
|
|
|
att_field_default_value, /* Fluff */
|
|
|
|
att_field_description,
|
|
|
|
att_field_missing_value,
|
|
|
|
att_field_computed_blr,
|
|
|
|
att_field_computed_source,
|
|
|
|
att_field_validation_blr, /* 20 */
|
|
|
|
att_field_validation_source,
|
|
|
|
att_field_number, /* Field number to match up blobs */
|
|
|
|
att_field_computed_flag, /* Field is computed, not real */
|
|
|
|
att_field_system_flag, /* Interesting system flag */
|
|
|
|
att_field_security_class,
|
|
|
|
|
|
|
|
att_field_external_length,
|
|
|
|
att_field_external_type,
|
|
|
|
att_field_external_scale,
|
|
|
|
att_field_dimensions, /* 29 */
|
|
|
|
att_field_ranges, /* this space for rent */
|
|
|
|
att_field_complex_name, /* relation field attribute */
|
|
|
|
att_field_range_low, /* low range for array */
|
|
|
|
att_field_range_high, /* high range for array */
|
|
|
|
att_field_update_flag,
|
|
|
|
att_field_description2,
|
|
|
|
att_field_validation_source2,
|
|
|
|
att_field_computed_source2,
|
|
|
|
att_field_null_flag, /* If field can be null */
|
|
|
|
att_field_default_source, /* default source for field (new fmt only) */
|
|
|
|
att_field_missing_source, /* missing source for field (new fmt only) */
|
|
|
|
att_field_character_length, /* length of field in characters */
|
|
|
|
att_field_character_set, /* Charset id of field */
|
|
|
|
att_field_collation_id, /* Collation id of field */
|
|
|
|
att_field_precision, /* numeric field precision of RDB$FIELDS */
|
|
|
|
|
|
|
|
/* Index attributes */
|
|
|
|
|
|
|
|
att_index_name = SERIES,
|
|
|
|
att_segment_count,
|
|
|
|
att_index_inactive,
|
|
|
|
att_index_unique_flag,
|
|
|
|
att_index_field_name,
|
|
|
|
att_index_description,
|
|
|
|
att_index_type,
|
|
|
|
att_index_foreign_key,
|
|
|
|
att_index_description2,
|
|
|
|
att_index_expression_source,
|
|
|
|
att_index_expression_blr,
|
|
|
|
|
|
|
|
/* Data record */
|
|
|
|
|
|
|
|
att_data_length = SERIES,
|
|
|
|
att_data_data,
|
|
|
|
|
|
|
|
/* Blob record */
|
|
|
|
|
|
|
|
att_blob_field_number = SERIES + 2, /* Field number of blob field */
|
|
|
|
att_blob_type, /* Segmented = 0, stream = 1 */
|
|
|
|
att_blob_number_segments, /* Number of segments */
|
|
|
|
att_blob_max_segment, /* Longest segment */
|
|
|
|
att_blob_data,
|
|
|
|
|
|
|
|
/* View attributes */
|
|
|
|
|
|
|
|
att_view_relation_name = SERIES + 7,
|
|
|
|
att_view_context_id,
|
|
|
|
att_view_context_name,
|
|
|
|
|
|
|
|
/* Security class attributes */
|
|
|
|
|
|
|
|
att_class_security_class = SERIES + 10,
|
|
|
|
att_class_acl,
|
|
|
|
att_class_description,
|
|
|
|
|
|
|
|
|
|
|
|
/* Array attributes */
|
|
|
|
|
|
|
|
att_array_dimensions = SERIES + 13,
|
|
|
|
att_array_range_low,
|
|
|
|
att_array_range_high,
|
|
|
|
|
|
|
|
/* XDR encoded data attributes */
|
|
|
|
|
|
|
|
att_xdr_length = SERIES + 16,
|
|
|
|
att_xdr_array,
|
|
|
|
att_class_description2,
|
|
|
|
|
|
|
|
/* Trigger attributes */
|
|
|
|
|
|
|
|
att_trig_type = SERIES,
|
|
|
|
att_trig_blr,
|
|
|
|
att_trig_source,
|
|
|
|
att_trig_name,
|
|
|
|
att_trig_relation_name,
|
|
|
|
att_trig_sequence,
|
|
|
|
att_trig_description,
|
|
|
|
att_trig_system_flag,
|
|
|
|
att_trig_inactive,
|
|
|
|
att_trig_source2,
|
|
|
|
att_trig_description2,
|
|
|
|
att_trig_flags,
|
|
|
|
|
|
|
|
/* Function attributes */
|
|
|
|
|
|
|
|
att_function_name = SERIES,
|
|
|
|
att_function_description,
|
|
|
|
att_function_class,
|
|
|
|
att_function_module_name,
|
|
|
|
att_function_entrypoint,
|
|
|
|
att_function_return_arg,
|
|
|
|
att_function_query_name,
|
|
|
|
att_function_type,
|
|
|
|
att_function_description2,
|
|
|
|
|
|
|
|
/* Function argument attributes */
|
|
|
|
|
|
|
|
att_functionarg_name = SERIES,
|
|
|
|
att_functionarg_position,
|
|
|
|
att_functionarg_mechanism,
|
|
|
|
att_functionarg_field_type,
|
|
|
|
att_functionarg_field_scale,
|
|
|
|
att_functionarg_field_length,
|
|
|
|
att_functionarg_field_sub_type,
|
|
|
|
att_functionarg_character_set,
|
|
|
|
att_functionarg_field_precision,
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
/* TYPE relation attributes */
|
|
|
|
att_type_name = SERIES,
|
|
|
|
att_type_type,
|
|
|
|
att_type_field_name,
|
|
|
|
att_type_description,
|
|
|
|
att_type_system_flag,
|
|
|
|
/* Also see att_type_description2 below! */
|
|
|
|
|
|
|
|
/* Filter attributes */
|
|
|
|
att_filter_name,
|
|
|
|
att_filter_description,
|
|
|
|
att_filter_module_name,
|
|
|
|
att_filter_entrypoint,
|
|
|
|
att_filter_input_sub_type,
|
|
|
|
att_filter_output_sub_type,
|
|
|
|
att_filter_description2,
|
|
|
|
att_type_description2,
|
|
|
|
|
|
|
|
/* Trigger message attributes */
|
|
|
|
att_trigmsg_name = SERIES,
|
|
|
|
att_trigmsg_number,
|
|
|
|
att_trigmsg_text,
|
|
|
|
|
|
|
|
/* User privilege attributes */
|
|
|
|
att_priv_user = SERIES,
|
|
|
|
att_priv_grantor,
|
|
|
|
att_priv_privilege,
|
|
|
|
att_priv_grant_option,
|
|
|
|
att_priv_object_name,
|
|
|
|
att_priv_field_name,
|
|
|
|
att_priv_user_type,
|
|
|
|
att_priv_obj_type,
|
|
|
|
|
|
|
|
/* files for shadowing purposes */
|
|
|
|
att_file_filename = SERIES,
|
|
|
|
att_file_sequence,
|
|
|
|
att_file_start,
|
|
|
|
att_file_length,
|
|
|
|
att_file_flags,
|
|
|
|
att_shadow_number,
|
|
|
|
|
|
|
|
/* Attributes for gen_id */
|
|
|
|
att_gen_generator = SERIES,
|
|
|
|
att_gen_value,
|
|
|
|
att_gen_value_int64,
|
|
|
|
|
|
|
|
/* Stored procedure attributes */
|
|
|
|
|
|
|
|
att_procedure_name = SERIES,
|
|
|
|
att_procedure_inputs,
|
|
|
|
att_procedure_outputs,
|
|
|
|
att_procedure_description,
|
|
|
|
att_procedure_description2,
|
|
|
|
att_procedure_source,
|
|
|
|
att_procedure_source2,
|
|
|
|
att_procedure_blr,
|
|
|
|
att_procedure_security_class,
|
|
|
|
att_procedure_owner_name,
|
|
|
|
|
|
|
|
/* Stored procedure parameter attributes */
|
|
|
|
|
|
|
|
att_procedureprm_name = SERIES,
|
|
|
|
att_procedureprm_number,
|
|
|
|
att_procedureprm_type,
|
|
|
|
att_procedureprm_field_source,
|
|
|
|
att_procedureprm_description,
|
|
|
|
att_procedureprm_description2,
|
|
|
|
|
|
|
|
/* Exception attributes */
|
|
|
|
|
|
|
|
att_exception_name = SERIES,
|
|
|
|
att_exception_msg,
|
|
|
|
att_exception_description,
|
|
|
|
att_exception_description2,
|
|
|
|
|
|
|
|
/* Relation constraints attributes */
|
|
|
|
|
|
|
|
att_rel_constraint_name = SERIES,
|
|
|
|
att_rel_constraint_type,
|
|
|
|
att_rel_constraint_rel_name,
|
|
|
|
att_rel_constraint_defer,
|
|
|
|
att_rel_constraint_init,
|
|
|
|
att_rel_constraint_index,
|
|
|
|
|
|
|
|
/* Referential constraints attributes */
|
|
|
|
|
|
|
|
att_ref_constraint_name = SERIES,
|
|
|
|
att_ref_unique_const_name,
|
|
|
|
att_ref_match_option,
|
|
|
|
att_ref_update_rule,
|
|
|
|
att_ref_delete_rule,
|
|
|
|
|
|
|
|
/* SQL roles attributes */
|
|
|
|
att_role_name = SERIES,
|
|
|
|
att_role_owner_name,
|
|
|
|
|
|
|
|
/* Check constraints attributes */
|
|
|
|
att_chk_constraint_name = SERIES,
|
|
|
|
att_chk_trigger_name,
|
|
|
|
|
|
|
|
/* Character Set attributes */
|
|
|
|
att_charset_name = SERIES,
|
|
|
|
att_charset_form,
|
|
|
|
att_charset_numchar,
|
|
|
|
att_charset_coll,
|
|
|
|
att_charset_id,
|
|
|
|
att_charset_sysflag,
|
|
|
|
att_charset_description,
|
|
|
|
att_charset_funct,
|
|
|
|
att_charset_bytes_char,
|
|
|
|
|
|
|
|
att_coll_name = SERIES,
|
|
|
|
att_coll_id,
|
|
|
|
att_coll_cs_id,
|
|
|
|
att_coll_attr,
|
|
|
|
att_coll_subtype, /* Unused: 93-11-12 Daves */
|
|
|
|
att_coll_sysflag,
|
|
|
|
att_coll_description,
|
|
|
|
att_coll_funct
|
2001-05-23 15:26:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
typedef enum att_type ATT_TYPE;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
// TMN: Why was this even added in the first place???
|
|
|
|
//typedef SCHAR att_type;
|
|
|
|
|
|
|
|
|
|
|
|
/* Trigger types */
|
|
|
|
|
|
|
|
enum trig_t {
|
2003-09-18 23:56:26 +02:00
|
|
|
trig_pre_store = 1, /* default */
|
|
|
|
trig_pre_modify, /* default */
|
|
|
|
trig_post_erase /* default */
|
|
|
|
};
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* these types to go away when recognized by gpre as
|
|
|
|
<relation>.<field>.<type> some time in the future */
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int TRIG_TYPE_PRE_STORE = 1;
|
|
|
|
const int TRIG_TYPE_PRE_MODIFY = 3;
|
|
|
|
const int TRIG_TYPE_POST_ERASE = 6;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* default trigger name templates */
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int TRIGGER_SEQUENCE_DEFAULT = 0;
|
2003-09-08 03:51:41 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* common structure definitions */
|
|
|
|
|
|
|
|
/* field block, used to hold local field definitions */
|
|
|
|
|
2002-11-30 18:45:02 +01:00
|
|
|
typedef struct burp_fld {
|
2003-09-18 23:56:26 +02:00
|
|
|
burp_fld *fld_next;
|
|
|
|
SSHORT fld_type;
|
|
|
|
SSHORT fld_sub_type;
|
|
|
|
FLD_LENGTH fld_length;
|
|
|
|
SSHORT fld_scale;
|
|
|
|
SSHORT fld_position;
|
|
|
|
SSHORT fld_parameter;
|
|
|
|
SSHORT fld_missing_parameter;
|
|
|
|
SSHORT fld_id;
|
|
|
|
RCRD_OFFSET fld_offset;
|
|
|
|
RCRD_OFFSET fld_old_offset;
|
|
|
|
SSHORT fld_number;
|
|
|
|
SSHORT fld_system_flag;
|
|
|
|
SSHORT fld_name_length;
|
|
|
|
TEXT fld_name [GDS_NAME_LEN];
|
|
|
|
TEXT fld_source [GDS_NAME_LEN];
|
|
|
|
TEXT fld_base [GDS_NAME_LEN];
|
|
|
|
TEXT fld_query_name [GDS_NAME_LEN];
|
|
|
|
TEXT fld_security_class [GDS_NAME_LEN];
|
|
|
|
SSHORT fld_edit_length;
|
|
|
|
SSHORT fld_view_context;
|
|
|
|
SSHORT fld_update_flag;
|
|
|
|
SSHORT fld_flags;
|
|
|
|
/* Can't do here
|
|
|
|
BASED_ON RDB$RDB$RELATION_FIELDS.RDB$EDIT_STRING fld_edit_string; */
|
|
|
|
TEXT fld_edit_string [126]; /* was [256] */
|
|
|
|
GDS__QUAD fld_description;
|
|
|
|
GDS__QUAD fld_query_header;
|
|
|
|
TEXT fld_complex_name [GDS_NAME_LEN];
|
|
|
|
SSHORT fld_dimensions;
|
|
|
|
SLONG fld_ranges [2 * MAX_DIMENSION];
|
|
|
|
SSHORT fld_null_flag;
|
|
|
|
GDS__QUAD fld_default_value;
|
|
|
|
GDS__QUAD fld_default_source;
|
|
|
|
SSHORT fld_character_length;
|
|
|
|
SSHORT fld_character_set_id;
|
|
|
|
SSHORT fld_collation_id;
|
2002-11-30 18:45:02 +01:00
|
|
|
} *BURP_FLD;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
enum fld_flags_vals {
|
|
|
|
FLD_computed = 1,
|
|
|
|
FLD_position_missing = 2,
|
|
|
|
FLD_array = 4,
|
|
|
|
FLD_update_missing = 8,
|
|
|
|
FLD_null_flag = 16,
|
|
|
|
FLD_charset_flag = 32, /* column has global charset */
|
|
|
|
FLD_collate_flag = 64 /* local column has specific collation */
|
|
|
|
};
|
2003-09-08 03:51:41 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* relation definition - holds useful relation type stuff */
|
|
|
|
|
2002-11-21 00:18:16 +01:00
|
|
|
typedef struct burp_rel {
|
2003-09-18 23:56:26 +02:00
|
|
|
burp_rel *rel_next;
|
|
|
|
burp_fld *rel_fields;
|
|
|
|
SSHORT rel_flags;
|
|
|
|
SSHORT rel_id;
|
|
|
|
SSHORT rel_name_length;
|
|
|
|
GDS_NAME rel_name;
|
|
|
|
GDS_NAME rel_owner; /* relation owner, if not us */
|
|
|
|
GDS__QUAD rel_store_blr; /* trigger blr blob id */
|
|
|
|
GDS__QUAD rel_store_source; /* trigger source blob id */
|
|
|
|
GDS__QUAD rel_modify_blr; /* trigger blr blob id */
|
|
|
|
GDS__QUAD rel_modify_source; /* trigger source blob id */
|
|
|
|
GDS__QUAD rel_erase_blr; /* trigger blr blob id */
|
|
|
|
GDS__QUAD rel_erase_source; /* trigger source blob id */
|
2002-11-17 01:04:19 +01:00
|
|
|
} *BURP_REL;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
enum burp_rel_flags_vals {
|
|
|
|
REL_view = 1,
|
|
|
|
REL_external = 2
|
|
|
|
};
|
2003-09-08 03:51:41 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* procedure definition - holds useful procedure type stuff */
|
|
|
|
|
2002-11-21 00:18:16 +01:00
|
|
|
typedef struct burp_prc {
|
2003-09-18 23:56:26 +02:00
|
|
|
burp_prc *prc_next;
|
|
|
|
SSHORT prc_name_length;
|
|
|
|
GDS_NAME prc_name;
|
|
|
|
GDS_NAME prc_owner; /* relation owner, if not us */
|
2002-11-17 01:04:19 +01:00
|
|
|
} *BURP_PRC;
|
2003-09-08 03:51:41 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
typedef struct gfld {
|
2003-09-18 23:56:26 +02:00
|
|
|
TEXT gfld_name [GDS_NAME_LEN];
|
|
|
|
ISC_QUAD gfld_vb;
|
|
|
|
ISC_QUAD gfld_vs;
|
|
|
|
ISC_QUAD gfld_vs2;
|
|
|
|
gfld *gfld_next;
|
|
|
|
USHORT gfld_flags;
|
2001-05-23 15:26:42 +02:00
|
|
|
} *GFLD;
|
|
|
|
|
2003-09-22 16:13:54 +02:00
|
|
|
enum gfld_flags_vals {
|
2003-09-18 23:56:26 +02:00
|
|
|
GFLD_validation_blr = 1,
|
|
|
|
GFLD_validation_source = 2,
|
|
|
|
GFLD_validation_source2 = 4
|
|
|
|
};
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int MAX_FILE_NAME_LENGTH = 256;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* Note that this typedef is also defined in JRD.H and REMOTE.H */
|
2003-09-18 23:56:26 +02:00
|
|
|
/* but for some reason we are avoiding including JRD.H */
|
|
|
|
/* and this typedef is needed to include SVC.H */
|
2001-05-23 15:26:42 +02:00
|
|
|
#if !(defined REMOTE_REMOTE_H || defined JRD_JRD_H)
|
|
|
|
#ifndef INCLUDE_FB_BLK
|
|
|
|
#include "../include/fb_blk.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "../jrd/svc.h"
|
|
|
|
#include "../jrd/svc_proto.h"
|
|
|
|
|
|
|
|
/* typedef the file descriptor type to make things cleaner */
|
|
|
|
|
|
|
|
#ifdef WIN_NT
|
|
|
|
typedef void *DESC;
|
2003-09-21 01:28:38 +02:00
|
|
|
inline static void close_platf(DESC file)
|
|
|
|
{
|
|
|
|
CloseHandle(file);
|
|
|
|
}
|
|
|
|
inline static void unlink_platf(TEXT * file_name)
|
|
|
|
{
|
|
|
|
DeleteFile(file_name);
|
|
|
|
}
|
|
|
|
inline static void flush_platf(DESC file)
|
|
|
|
{
|
|
|
|
FlushFileBuffers(file);
|
|
|
|
}
|
2001-05-23 15:26:42 +02:00
|
|
|
#else
|
|
|
|
typedef int DESC;
|
2003-09-21 01:28:38 +02:00
|
|
|
inline static void close_platf(DESC file)
|
|
|
|
{
|
|
|
|
close(file);
|
|
|
|
}
|
|
|
|
inline static void unlink_platf(TEXT * file_name)
|
|
|
|
{
|
|
|
|
unlink(file_name);
|
|
|
|
}
|
|
|
|
inline static void flush_platf(DESC file)
|
|
|
|
{
|
|
|
|
}
|
2003-09-18 23:56:26 +02:00
|
|
|
const int INVALID_HANDLE_VALUE = -1;
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif /* WIN_NT */
|
2003-09-08 03:51:41 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* File block -- for multi-file databases */
|
|
|
|
|
|
|
|
typedef enum {
|
2003-09-18 23:56:26 +02:00
|
|
|
size_n = 0, /* none */
|
|
|
|
size_k, /* k = 1024 */
|
|
|
|
size_m, /* m = k x 1024 */
|
|
|
|
size_g, /* g = m x 1024 */
|
|
|
|
size_e /* error */
|
2001-05-23 15:26:42 +02:00
|
|
|
} SIZE_CODE;
|
|
|
|
|
|
|
|
typedef struct fil {
|
2003-09-18 23:56:26 +02:00
|
|
|
fil *fil_next;
|
|
|
|
TEXT *fil_name;
|
|
|
|
ULONG fil_length;
|
|
|
|
DESC fil_fd;
|
|
|
|
USHORT fil_seq;
|
|
|
|
SIZE_CODE fil_size_code;
|
2001-05-23 15:26:42 +02:00
|
|
|
} *FIL;
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int FIL_LEN = sizeof(fil);
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* Split & Join stuff */
|
|
|
|
|
|
|
|
typedef enum act_t {
|
2003-09-18 23:56:26 +02:00
|
|
|
ACT_unknown, /* action is unknown */
|
|
|
|
ACT_backup,
|
|
|
|
ACT_backup_split,
|
|
|
|
ACT_restore,
|
|
|
|
ACT_restore_join
|
2001-05-23 15:26:42 +02:00
|
|
|
} ACT_T;
|
|
|
|
|
|
|
|
typedef struct act {
|
2003-09-18 23:56:26 +02:00
|
|
|
USHORT act_total;
|
|
|
|
FIL act_file;
|
|
|
|
ACT_T act_action;
|
2001-05-23 15:26:42 +02:00
|
|
|
} *ACT;
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int ACT_LEN = sizeof(act);
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2002-09-25 15:08:25 +02:00
|
|
|
#define MAX_LENGTH -1UL
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* This structure has been cloned from spit.c */
|
|
|
|
|
|
|
|
typedef struct hdr_split {
|
2003-09-18 23:56:26 +02:00
|
|
|
TEXT hdr_split_tag[18];
|
|
|
|
TEXT hdr_split_timestamp[30];
|
|
|
|
TEXT hdr_split_text1[11];
|
|
|
|
TEXT hdr_split_sequence[4]; /* File sequence number */
|
|
|
|
TEXT hdr_split_text2[4];
|
|
|
|
TEXT hdr_split_total[4]; /* Total number of files */
|
|
|
|
TEXT hdr_split_text3[2];
|
|
|
|
TEXT hdr_split_name[27]; /* File name */
|
|
|
|
} *HDR_SPLIT;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* NOTE: size of the hdr_split_tag and HDR_SPLIT_TAG must be the same and equal
|
|
|
|
to 18. Otherwise we will not be able to join the gbk files v5.x */
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int HDR_SPLIT_SIZE = sizeof(hdr_split);
|
|
|
|
static const char *HDR_SPLIT_TAG5 = "InterBase/gsplit, ";
|
|
|
|
static const char *HDR_SPLIT_TAG6 = "InterBase/gbak, ";
|
|
|
|
static const char *HDR_SPLIT_TAG = HDR_SPLIT_TAG6;
|
|
|
|
const unsigned int MIN_SPLIT_SIZE = 2048; /* bytes */
|
2003-09-12 11:04:38 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* Global switches and data */
|
|
|
|
|
2002-10-29 17:31:02 +01:00
|
|
|
typedef struct tgbl
|
|
|
|
{
|
2003-09-18 23:56:26 +02:00
|
|
|
thdd tgbl_thd_data;
|
|
|
|
TEXT *gbl_database_file_name;
|
|
|
|
TEXT gbl_backup_start_time [30];
|
|
|
|
USHORT gbl_sw_verbose;
|
|
|
|
USHORT gbl_sw_ignore_limbo;
|
|
|
|
USHORT gbl_sw_meta;
|
|
|
|
USHORT gbl_sw_novalidity;
|
|
|
|
USHORT gbl_sw_page_size;
|
|
|
|
USHORT gbl_sw_compress;
|
|
|
|
USHORT gbl_sw_version;
|
|
|
|
USHORT gbl_sw_transportable;
|
|
|
|
USHORT gbl_sw_incremental;
|
|
|
|
USHORT gbl_sw_deactivate_indexes;
|
|
|
|
USHORT gbl_sw_kill;
|
|
|
|
USHORT gbl_sw_blk_factor;
|
|
|
|
USHORT gbl_sw_no_reserve;
|
|
|
|
USHORT gbl_sw_old_descriptions;
|
|
|
|
USHORT gbl_sw_service_gbak;
|
|
|
|
USHORT gbl_sw_service_thd;
|
|
|
|
USHORT gbl_sw_convert_ext_tables;
|
|
|
|
bool gbl_sw_mode;
|
|
|
|
bool gbl_sw_mode_val;
|
|
|
|
SCHAR *gbl_sw_sql_role;
|
|
|
|
SCHAR *gbl_sw_user;
|
|
|
|
SCHAR *gbl_sw_password;
|
|
|
|
SLONG gbl_sw_skip_count;
|
|
|
|
SLONG gbl_sw_page_buffers;
|
|
|
|
FIL gbl_sw_files;
|
|
|
|
FIL gbl_sw_backup_files;
|
|
|
|
GFLD gbl_global_fields;
|
|
|
|
ACT action;
|
|
|
|
ULONG io_buffer_size;
|
|
|
|
redirect_vals sw_redirect;
|
|
|
|
UCHAR dpb_string [100];
|
|
|
|
SSHORT dpb_length;
|
|
|
|
UCHAR *burp_env;
|
|
|
|
UCHAR *io_ptr;
|
|
|
|
int io_cnt;
|
|
|
|
BURP_REL relations;
|
|
|
|
BURP_PRC procedures;
|
|
|
|
SLONG BCK_capabilities;
|
|
|
|
USHORT RESTORE_format;
|
|
|
|
ULONG mvol_io_buffer_size;
|
|
|
|
ULONG mvol_actual_buffer_size;
|
|
|
|
UINT64 mvol_cumul_count;
|
|
|
|
UCHAR *mvol_io_ptr;
|
|
|
|
int mvol_io_cnt;
|
|
|
|
UCHAR *mvol_io_buffer;
|
|
|
|
UCHAR *mvol_io_volume;
|
|
|
|
UCHAR *mvol_io_header;
|
|
|
|
UCHAR *mvol_io_data;
|
|
|
|
TEXT mvol_db_name_buffer [MAX_FILE_NAME_LENGTH];
|
|
|
|
SCHAR mvol_old_file [MAX_FILE_NAME_LENGTH];
|
|
|
|
int mvol_volume_count;
|
|
|
|
USHORT mvol_empty_file;
|
|
|
|
isc_db_handle db_handle;
|
|
|
|
isc_tr_handle tr_handle;
|
|
|
|
isc_tr_handle global_trans;
|
|
|
|
DESC file_desc;
|
|
|
|
ISC_STATUS *status; /* points to either the tdgbl status or service status */
|
|
|
|
ISC_STATUS_ARRAY status_vector;
|
|
|
|
int exit_code;
|
|
|
|
UCHAR *head_of_mem_list;
|
|
|
|
pfn_svc_output output_proc;
|
|
|
|
SLONG output_data;
|
|
|
|
IB_FILE *output_file;
|
|
|
|
SVC service_blk;
|
|
|
|
/*
|
|
|
|
* Link list of global fields that were converted from V3 sub_type
|
|
|
|
* to V4 char_set_id/collate_id. Needed for local fields conversion.
|
|
|
|
*/
|
|
|
|
BURP_FLD v3_cvt_fld_list;
|
|
|
|
|
|
|
|
isc_req_handle handles_get_character_sets_req_handle1;
|
|
|
|
isc_req_handle handles_get_chk_constraint_req_handle1;
|
|
|
|
isc_req_handle handles_get_collation_req_handle1;
|
|
|
|
isc_req_handle handles_get_exception_req_handle1;
|
|
|
|
isc_req_handle handles_get_field_dimensions_req_handle1;
|
|
|
|
isc_req_handle handles_get_field_req_handle1;
|
|
|
|
isc_req_handle handles_get_fields_req_handle1;
|
|
|
|
isc_req_handle handles_get_fields_req_handle2;
|
|
|
|
isc_req_handle handles_get_fields_req_handle3;
|
|
|
|
isc_req_handle handles_get_fields_req_handle4;
|
|
|
|
isc_req_handle handles_get_fields_req_handle5;
|
|
|
|
isc_req_handle handles_get_fields_req_handle6;
|
|
|
|
isc_req_handle handles_get_files_req_handle1;
|
|
|
|
isc_req_handle handles_get_filter_req_handle1;
|
|
|
|
isc_req_handle handles_get_function_arg_req_handle1;
|
|
|
|
isc_req_handle handles_get_function_req_handle1;
|
|
|
|
isc_req_handle handles_get_global_field_req_handle1;
|
|
|
|
isc_req_handle handles_get_index_req_handle1;
|
|
|
|
isc_req_handle handles_get_index_req_handle2;
|
|
|
|
isc_req_handle handles_get_index_req_handle3;
|
|
|
|
isc_req_handle handles_get_index_req_handle4;
|
|
|
|
isc_req_handle handles_get_procedure_prm_req_handle1;
|
|
|
|
isc_req_handle handles_get_procedure_req_handle1;
|
|
|
|
isc_req_handle handles_get_ranges_req_handle1;
|
|
|
|
isc_req_handle handles_get_ref_constraint_req_handle1;
|
|
|
|
isc_req_handle handles_get_rel_constraint_req_handle1;
|
|
|
|
isc_req_handle handles_get_relation_req_handle1;
|
|
|
|
isc_req_handle handles_get_security_class_req_handle1;
|
|
|
|
isc_req_handle handles_get_sql_roles_req_handle1;
|
|
|
|
isc_req_handle handles_get_trigger_message_req_handle1;
|
|
|
|
isc_req_handle handles_get_trigger_message_req_handle2;
|
|
|
|
isc_req_handle handles_get_trigger_old_req_handle1;
|
|
|
|
isc_req_handle handles_get_trigger_req_handle1;
|
|
|
|
isc_req_handle handles_get_type_req_handle1;
|
|
|
|
isc_req_handle handles_get_user_privilege_req_handle1;
|
|
|
|
isc_req_handle handles_get_view_req_handle1;
|
|
|
|
isc_req_handle handles_put_index_req_handle1;
|
|
|
|
isc_req_handle handles_put_index_req_handle2;
|
|
|
|
isc_req_handle handles_put_index_req_handle3;
|
|
|
|
isc_req_handle handles_put_index_req_handle4;
|
|
|
|
isc_req_handle handles_put_index_req_handle5;
|
|
|
|
isc_req_handle handles_put_index_req_handle6;
|
|
|
|
isc_req_handle handles_put_index_req_handle7;
|
|
|
|
isc_req_handle handles_put_relation_req_handle1;
|
|
|
|
isc_req_handle handles_put_relation_req_handle2;
|
|
|
|
isc_req_handle handles_store_blr_gen_id_req_handle1;
|
|
|
|
isc_req_handle handles_write_function_args_req_handle1;
|
|
|
|
isc_req_handle handles_write_function_args_req_handle2;
|
|
|
|
isc_req_handle handles_write_procedure_prms_req_handle1;
|
|
|
|
USHORT hdr_forced_writes;
|
|
|
|
TEXT database_security_class[GDS_NAME_LEN]; /* To save database security class for deferred update */
|
2001-05-23 15:26:42 +02:00
|
|
|
} *TGBL;
|
|
|
|
|
|
|
|
#ifdef GET_THREAD_DATA
|
|
|
|
#undef GET_THREAD_DATA
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef SUPERSERVER
|
2003-09-18 23:56:26 +02:00
|
|
|
#define GET_THREAD_DATA ((TGBL) THD_get_specific())
|
|
|
|
#define SET_THREAD_DATA THD_put_specific ((THDD) tdgbl); \
|
2001-05-23 15:26:42 +02:00
|
|
|
tdgbl->tgbl_thd_data.thdd_type = THDD_TYPE_TGBL
|
2003-09-18 23:56:26 +02:00
|
|
|
#define RESTORE_THREAD_DATA THD_restore_specific();
|
2001-05-23 15:26:42 +02:00
|
|
|
#else
|
2003-08-27 12:20:07 +02:00
|
|
|
extern tgbl *gdgbl;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
#define GET_THREAD_DATA (gdgbl)
|
|
|
|
#define SET_THREAD_DATA gdgbl = const_cast<tgbl*>(tdgbl); \
|
2001-05-23 15:26:42 +02:00
|
|
|
tdgbl->tgbl_thd_data.thdd_type = THDD_TYPE_TGBL
|
2003-09-18 23:56:26 +02:00
|
|
|
#define RESTORE_THREAD_DATA
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int FINI_DB_NOT_ONLINE = 2; /* database is not on-line due to
|
|
|
|
failure to activate one or more
|
|
|
|
indices */
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* I/O definitions */
|
|
|
|
|
|
|
|
#ifndef IO_BUFFER_SIZE
|
|
|
|
#ifdef BUFSIZ
|
2003-09-23 21:47:50 +02:00
|
|
|
const int GBAK_IO_BUFFER_SIZE = (16 * (BUFSIZ));
|
2001-05-23 15:26:42 +02:00
|
|
|
#else
|
2003-09-23 21:47:50 +02:00
|
|
|
const int GBAK_IO_BUFFER_SIZE = (16 * (1024));
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Burp will always write a backup in multiples of the following number
|
|
|
|
* of bytes. The initial value is the smallest which ensures that writes
|
|
|
|
* to fixed-block SCSI tapes such as QIC-150 will work. The value should
|
|
|
|
* always be a multiple of 512 for that reason.
|
|
|
|
* If you change to a value which is NOT a power of 2, then change the
|
|
|
|
* BURP_UP_TO_BLOCK macro to use division and multiplication instead of
|
|
|
|
* bit masking.
|
|
|
|
*/
|
|
|
|
|
2003-09-18 23:56:26 +02:00
|
|
|
const int BURP_BLOCK = 512;
|
2003-09-21 01:28:38 +02:00
|
|
|
inline static ULONG BURP_UP_TO_BLOCK(ULONG size)
|
|
|
|
{
|
|
|
|
return (((size) + BURP_BLOCK - 1) & ~(BURP_BLOCK - 1));
|
|
|
|
}
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
/* Move the read and write mode declarations in here from burp.c
|
|
|
|
so that other files can see them for multivolume opens */
|
|
|
|
|
|
|
|
#ifdef WIN_NT
|
2003-09-23 21:47:50 +02:00
|
|
|
static const int MODE_READ = GENERIC_READ;
|
|
|
|
static const int MODE_WRITE = GENERIC_WRITE;
|
|
|
|
#else
|
|
|
|
# ifdef VMS
|
|
|
|
static const int MODE_READ = O_RDONLY;
|
|
|
|
static const int MODE_WRITE = O_WRONLY | O_CREAT | O_TRUNC;
|
|
|
|
# else
|
|
|
|
static const int MODE_READ = O_RDONLY;
|
|
|
|
static const int MODE_WRITE = O_WRONLY | O_CREAT
|
|
|
|
# endif
|
2001-05-23 15:26:42 +02:00
|
|
|
#endif
|
|
|
|
|
2003-09-08 03:51:41 +02:00
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
/* Burp Messages */
|
|
|
|
|
2003-09-22 16:13:54 +02:00
|
|
|
enum burp_messages_vals {
|
2003-09-18 23:56:26 +02:00
|
|
|
msgVerbose_write_charsets = 211,
|
|
|
|
msgVerbose_write_collations = 212,
|
|
|
|
msgErr_restore_charset = 213,
|
|
|
|
msgVerbose_restore_charset = 214,
|
|
|
|
msgErr_restore_collation = 215,
|
|
|
|
msgVerbose_restore_collation = 216
|
|
|
|
};
|
|
|
|
|
|
|
|
inline static void stuff(UCHAR **blr, int byte)
|
|
|
|
{
|
|
|
|
UCHAR *ptr = *blr;
|
|
|
|
*ptr++ = (SCHAR) (byte);
|
|
|
|
*blr = ptr;
|
|
|
|
}
|
|
|
|
inline static void stuff_word(UCHAR **blr, int word)
|
|
|
|
{
|
|
|
|
stuff(blr, word);
|
|
|
|
stuff(blr, (word) >> 8);
|
|
|
|
}
|
|
|
|
inline static void stuff_long(UCHAR **blr, long lg)
|
|
|
|
{
|
|
|
|
stuff_word(blr, lg);
|
|
|
|
stuff_word(blr, (lg) >> 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline static void stuff_int64(UCHAR **blr, SINT64 i64)
|
|
|
|
{
|
|
|
|
stuff_long(blr, i64);
|
|
|
|
stuff_long(blr, (i64) >> 32);
|
|
|
|
}
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2003-09-12 11:04:38 +02:00
|
|
|
#endif /* BURP_BURP_H */
|
|
|
|
|