8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 01:23:03 +01:00

- allowed user-defined index names for PK/FK/UK constraints

- fixed ugly hardcoded name checks for primary/foreign keys
- implemented RECREATE VIEW statement
This commit is contained in:
dimitr 2002-09-01 15:49:03 +00:00
parent e83e3137c1
commit b36015e6e9
6 changed files with 28 additions and 13 deletions

View File

@ -49,6 +49,8 @@
* 2002.08.04 Dmitry Yemanov: ALTER VIEW
* 2002.08.06 Arno Brinkman: ordinal added to grp_column_elem for using positions in group by
* 2002.08.07 Dmitry Yemanov: INT64/LARGEINT are replaced with BIGINT and available in dialect 3 only
* 2002.08.31 Dmitry Yemanov: allowed user-defined index names for PK/FK/UK constraints
* 2002.09.01 Dmitry Yemanov: RECREATE VIEW
*/

View File

@ -930,6 +930,7 @@ NOD PASS1_statement(REQ request, NOD input, USHORT proc_flag)
case nod_redef_relation:
case nod_def_index:
case nod_def_view:
case nod_redef_view:
case nod_def_constraint:
case nod_def_exception:
case nod_mod_relation:

View File

@ -26,7 +26,7 @@
*
*____________________________________________________________
*
* $Id: gpre_meta.epp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
* $Id: gpre_meta.epp,v 1.4 2002-09-01 15:44:46 dimitr Exp $
*/
#include "firebird.h"
@ -681,11 +681,12 @@ LLS MET_get_primary_key(DBB dbb, TEXT * relation_name)
ptr_fields = &fields;
FOR(REQUEST_HANDLE dbb->dbb_primary_key_request)
X IN RDB$INDICES CROSS
Y IN RDB$INDEX_SEGMENTS
X IN RDB$INDICES CROSS
Y IN RDB$INDEX_SEGMENTS CROSS
Z IN RDB$RELATION_CONSTRAINTS
OVER RDB$INDEX_NAME
WITH X.RDB$RELATION_NAME EQ name
AND X.RDB$INDEX_NAME STARTING "RDB$PRIMARY"
AND Z.RDB$CONSTRAINT_TYPE EQ "PRIMARY KEY"
SORTED BY Y.RDB$FIELD_POSITION
field_name = (str*) MAKE_STRING(Y.RDB$FIELD_NAME);

View File

@ -1519,12 +1519,19 @@ static bool create_index( TDBB tdbb,
idx.idx_flags |= idx_descending;
if (!IDX.RDB$FOREIGN_KEY.NULL)
idx.idx_flags |= idx_foreign;
if (!strncmp( IDX.RDB$INDEX_NAME,
"RDB$PRIMARY",
strlen("RDB$PRIMARY")))
{
BLK rc_request = NULL;
FOR(REQUEST_HANDLE rc_request)
RC IN RDB$RELATION_CONSTRAINTS WITH
RC.RDB$INDEX_NAME EQ work->dfw_name AND
RC.RDB$CONSTRAINT_TYPE = "PRIMARY KEY"
idx.idx_flags |= idx_primary;
}
END_FOR;
CMP_release(tdbb, (REQ)rc_request);
}
if (++key_count > idx.idx_count ||

View File

@ -2090,9 +2090,11 @@ void DYN_define_index(GBL gbl,
id = drq_l_primary;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
IND IN RDB$INDICES WITH
IND IN RDB$INDICES CROSS
RC IN RDB$RELATION_CONSTRAINTS
OVER RDB$INDEX_NAME WITH
IND.RDB$RELATION_NAME EQ referenced_relation AND
IND.RDB$INDEX_NAME STARTING "RDB$PRIMARY"
RC.RDB$CONSTRAINT_TYPE EQ PRIMARY_KEY
if (!DYN_REQUEST(drq_l_primary))
DYN_REQUEST(drq_l_primary) = request;

View File

@ -35,7 +35,7 @@
*
*/
/*
$Id: met.epp,v 1.13 2002-07-05 15:00:20 skywalker Exp $
$Id: met.epp,v 1.14 2002-09-01 15:44:46 dimitr Exp $
*/
// This MUST be at the top of the file
#ifdef DARWIN
@ -1581,8 +1581,10 @@ int MET_lookup_partner(
FOR(REQUEST_HANDLE request)
IDX IN RDB$INDICES CROSS
RC IN RDB$RELATION_CONSTRAINTS
OVER RDB$INDEX_NAME CROSS
IND IN RDB$INDICES WITH
IDX.RDB$INDEX_NAME STARTING WITH "RDB$FOREIGN" AND
RC.RDB$CONSTRAINT_TYPE EQ "FOREIGN KEY" AND
IDX.RDB$RELATION_NAME EQ relation->rel_name AND
IND.RDB$INDEX_NAME EQ IDX.RDB$FOREIGN_KEY AND
IND.RDB$UNIQUE_FLAG NOT MISSING