mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-26 08:03:03 +01:00
130 lines
3.4 KiB
C++
130 lines
3.4 KiB
C++
/*
|
|
* PROGRAM: JRD Access Method
|
|
* MODULE: met.h
|
|
* DESCRIPTION: Random meta-data stuff
|
|
*
|
|
* 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): ______________________________________.
|
|
*/
|
|
|
|
#ifndef _JRD_MET_H_
|
|
#define _JRD_MET_H_
|
|
|
|
/* Record types for record summary blob records */
|
|
|
|
typedef enum rsr_t {
|
|
RSR_field_id,
|
|
RSR_field_name,
|
|
RSR_view_context,
|
|
RSR_base_field,
|
|
RSR_computed_blr,
|
|
RSR_missing_value,
|
|
RSR_default_value,
|
|
RSR_validation_blr,
|
|
RSR_security_class,
|
|
RSR_trigger_name,
|
|
RSR_dimensions,
|
|
RSR_array_desc,
|
|
|
|
RSR_relation_id, /* The following are Gateway specific */
|
|
RSR_relation_name, /* and are used to speed the acquiring */
|
|
RSR_rel_sys_flag, /* of relation information */
|
|
RSR_view_blr,
|
|
RSR_owner_name,
|
|
RSR_field_type, /* The following are also Gateway */
|
|
RSR_field_scale, /* specific and relate to field info */
|
|
RSR_field_length,
|
|
RSR_field_sub_type,
|
|
RSR_field_not_null
|
|
} RSR_T;
|
|
|
|
/* Temporary field block */
|
|
|
|
class tfb : public pool_alloc<type_tfb>
|
|
{
|
|
public:
|
|
struct tfb *tfb_next; /* next block in chain */
|
|
USHORT tfb_id; /* id of field in relation */
|
|
USHORT tfb_flags;
|
|
DSC tfb_desc;
|
|
};
|
|
typedef tfb *TFB;
|
|
|
|
#define TFB_computed 1
|
|
#define TFB_array 2
|
|
|
|
#define MET_object_active 0
|
|
#define MET_object_inactive 1
|
|
#define MET_object_unknown 2
|
|
|
|
#define TRIGGER_PRE_STORE 1
|
|
#define TRIGGER_POST_STORE 2
|
|
#define TRIGGER_PRE_MODIFY 3
|
|
#define TRIGGER_POST_MODIFY 4
|
|
#define TRIGGER_PRE_ERASE 5
|
|
#define TRIGGER_POST_ERASE 6
|
|
#define TRIGGER_MAX 7
|
|
|
|
// trigger type prefixes
|
|
#define TRIGGER_PRE 0
|
|
#define TRIGGER_POST 1
|
|
|
|
// trigger type suffixes
|
|
#define TRIGGER_STORE 1
|
|
#define TRIGGER_MODIFY 2
|
|
#define TRIGGER_ERASE 3
|
|
|
|
// that's how trigger action types are encoded
|
|
/*
|
|
bit 0 = TRIGGER_PRE/TRIGGER_POST flag,
|
|
bits 1-2 = TRIGGER_STORE/TRIGGER_MODIFY/TRIGGER_ERASE (slot #1),
|
|
bits 3-4 = TRIGGER_STORE/TRIGGER_MODIFY/TRIGGER_ERASE (slot #2),
|
|
bits 5-6 = TRIGGER_STORE/TRIGGER_MODIFY/TRIGGER_ERASE (slot #3),
|
|
and finally the above calculated value is decremented
|
|
|
|
example #1:
|
|
TRIGGER_POST_ERASE =
|
|
= ((TRIGGER_ERASE << 1) | TRIGGER_POST) - 1 =
|
|
= ((3 << 1) | 1) - 1 =
|
|
= 0x00000110 (6)
|
|
|
|
example #2:
|
|
TRIGGER_PRE_STORE_MODIFY =
|
|
= ((TRIGGER_MODIFY << 3) | (TRIGGER_STORE << 1) | TRIGGER_PRE) - 1 =
|
|
= ((2 << 3) | (1 << 1) | 0) - 1 =
|
|
= 0x00010001 (17)
|
|
|
|
example #3:
|
|
TRIGGER_POST_MODIFY_ERASE_STORE =
|
|
= ((TRIGGER_STORE << 5) | (TRIGGER_ERASE << 3) | (TRIGGER_MODIFY << 1) | TRIGGER_POST) - 1 =
|
|
= ((1 << 5) | (3 << 3) | (2 << 1) | 1) - 1 =
|
|
= 0x00111100 (60)
|
|
*/
|
|
|
|
// that's how trigger types are decoded
|
|
#define TRIGGER_ACTION(value, shift) \
|
|
(((((value + 1) >> shift) & 3) << 1) | ((value + 1) & 1)) - 1
|
|
|
|
#define TRIGGER_ACTION_SLOT(value, slot) \
|
|
TRIGGER_ACTION(value, (slot * 2 - 1) )
|
|
|
|
#define TRIGGER_COMBINED_MAX 128
|
|
|
|
#include "../jrd/obj.h"
|
|
|
|
#endif /* _JRD_MET_H_ */
|