mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 21:23:04 +01:00
136 lines
3.5 KiB
C++
136 lines
3.5 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 */
|
|
|
|
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
|
|
};
|
|
|
|
typedef rsr_t RSR_T;
|
|
|
|
/* Temporary field block */
|
|
|
|
class TemporaryField : public pool_alloc<type_tfb>
|
|
{
|
|
public:
|
|
TemporaryField* tfb_next; /* next block in chain */
|
|
USHORT tfb_id; /* id of field in relation */
|
|
USHORT tfb_flags;
|
|
DSC tfb_desc;
|
|
};
|
|
|
|
// tfb_flags
|
|
|
|
const int TFB_computed = 1;
|
|
const int TFB_array = 2;
|
|
|
|
// index status
|
|
|
|
const SSHORT MET_object_active = 0;
|
|
const SSHORT MET_object_inactive = 1;
|
|
const SSHORT MET_object_unknown = 2;
|
|
|
|
|
|
const int TRIGGER_PRE_STORE = 1;
|
|
const int TRIGGER_POST_STORE = 2;
|
|
const int TRIGGER_PRE_MODIFY = 3;
|
|
const int TRIGGER_POST_MODIFY = 4;
|
|
const int TRIGGER_PRE_ERASE = 5;
|
|
const int TRIGGER_POST_ERASE = 6;
|
|
const int TRIGGER_MAX = 7;
|
|
|
|
// trigger type prefixes
|
|
const int TRIGGER_PRE = 0;
|
|
const int TRIGGER_POST = 1;
|
|
|
|
// trigger type suffixes
|
|
const int TRIGGER_STORE = 1;
|
|
const int TRIGGER_MODIFY = 2;
|
|
const int 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) )
|
|
|
|
const int TRIGGER_COMBINED_MAX = 128;
|
|
|
|
#include "../jrd/obj.h"
|
|
|
|
#endif /* JRD_MET_H */
|