mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 21:23:03 +01:00
Changed syntax of the INDEX subclause of a constraint declaration,
now it looks as: [USING [ASC[ENDING] | DESC[ENDING]] INDEX index]
This commit is contained in:
parent
43181f0dc8
commit
c6e838a144
@ -20,7 +20,7 @@
|
|||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
* Contributor(s): ______________________________________.
|
* Contributor(s): ______________________________________.
|
||||||
*
|
*
|
||||||
* $Id: ddl.cpp,v 1.13 2002-09-01 15:44:45 dimitr Exp $
|
* $Id: ddl.cpp,v 1.14 2002-09-04 12:09:25 dimitr 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;
|
||||||
*
|
*
|
||||||
@ -4286,25 +4286,37 @@ static void make_index( REQ request,
|
|||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
|
|
||||||
// stuff a zero-length name, indicating that an index
|
/* stuff either user-defined name or
|
||||||
// name should be generated
|
zero-length name, indicating that an index name
|
||||||
|
should be generated */
|
||||||
|
|
||||||
assert(element->nod_type != nod_foreign);
|
assert(element->nod_type != nod_foreign);
|
||||||
|
|
||||||
STR string = (STR) element->nod_arg[e_pri_idx_name];
|
NOD index = element->nod_arg[e_pri_index];
|
||||||
|
assert(index);
|
||||||
|
|
||||||
|
STR string = (STR) index->nod_arg[e_idx_name];
|
||||||
if (string)
|
if (string)
|
||||||
{
|
{
|
||||||
index_name = reinterpret_cast<char*>(string->str_data);
|
index_name = reinterpret_cast<char*>(string->str_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element->nod_type == nod_primary) {
|
if (element->nod_type == nod_primary)
|
||||||
|
{
|
||||||
request->append_cstring(gds_dyn_def_primary_key, index_name);
|
request->append_cstring(gds_dyn_def_primary_key, index_name);
|
||||||
} else if (element->nod_type == nod_unique) {
|
}
|
||||||
|
else if (element->nod_type == nod_unique)
|
||||||
|
{
|
||||||
request->append_cstring(gds_dyn_def_unique, index_name);
|
request->append_cstring(gds_dyn_def_unique, index_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
request->append_number(gds_dyn_idx_unique, 1);
|
request->append_number(gds_dyn_idx_unique, 1);
|
||||||
|
|
||||||
|
if (index->nod_arg[e_idx_asc_dsc])
|
||||||
|
{
|
||||||
|
request->append_number(gds_dyn_idx_type, 1);
|
||||||
|
}
|
||||||
|
|
||||||
const NOD* end = columns->nod_arg + columns->nod_count;
|
const NOD* end = columns->nod_arg + columns->nod_count;
|
||||||
for (NOD* ptr = columns->nod_arg; ptr < end; ++ptr)
|
for (NOD* ptr = columns->nod_arg; ptr < end; ++ptr)
|
||||||
{
|
{
|
||||||
@ -4349,17 +4361,22 @@ static void make_index_trg_ref_int( REQ request,
|
|||||||
|
|
||||||
assert(element->nod_type == nod_foreign)
|
assert(element->nod_type == nod_foreign)
|
||||||
|
|
||||||
/* for_rel_name_str is the name of the relation on which the ddl operation
|
/* for_rel_name_str is the name of the relation
|
||||||
is being done, in this case the foreign key table */
|
on which the ddl operation is being done,
|
||||||
|
in this case the foreign key table */
|
||||||
|
|
||||||
ddl_node = request->req_ddl_node;
|
ddl_node = request->req_ddl_node;
|
||||||
for_rel_node = ddl_node->nod_arg[e_drl_name];
|
for_rel_node = ddl_node->nod_arg[e_drl_name];
|
||||||
for_rel_name_str = (STR) for_rel_node->nod_arg[e_rln_name];
|
for_rel_name_str = (STR) for_rel_node->nod_arg[e_rln_name];
|
||||||
|
|
||||||
|
/* stuff either user-defined name or
|
||||||
|
zero-length name, indicating that an index name
|
||||||
|
should be generated */
|
||||||
|
|
||||||
/* stuff a zero-length name, indicating that an index
|
NOD index = element->nod_arg[e_for_index];
|
||||||
name should be generated */
|
assert(index);
|
||||||
|
|
||||||
STR string = (STR) element->nod_arg[e_for_idx_name];
|
STR string = (STR) index->nod_arg[e_idx_name];
|
||||||
if (string)
|
if (string)
|
||||||
{
|
{
|
||||||
index_name = reinterpret_cast<char*>(string->str_data);
|
index_name = reinterpret_cast<char*>(string->str_data);
|
||||||
@ -4367,6 +4384,10 @@ static void make_index_trg_ref_int( REQ request,
|
|||||||
|
|
||||||
request->append_cstring(gds_dyn_def_foreign_key, index_name);
|
request->append_cstring(gds_dyn_def_foreign_key, index_name);
|
||||||
|
|
||||||
|
if (index->nod_arg[e_idx_asc_dsc])
|
||||||
|
{
|
||||||
|
request->append_number(gds_dyn_idx_type, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (element->nod_arg[e_for_action])
|
if (element->nod_arg[e_for_action])
|
||||||
{
|
{
|
||||||
|
@ -243,3 +243,4 @@
|
|||||||
#define CASE 499
|
#define CASE 499
|
||||||
#define NULLIF 500
|
#define NULLIF 500
|
||||||
#define COALESCE 501
|
#define COALESCE 501
|
||||||
|
#define USING 502
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Id: keywords.cpp,v 1.5 2002-08-11 08:04:53 dimitr Exp $
|
* $Id: keywords.cpp,v 1.6 2002-09-04 12:09:25 dimitr Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -268,6 +268,7 @@ static CONST TOK tokens [] = {
|
|||||||
{UPDATE, "UPDATE", 1},
|
{UPDATE, "UPDATE", 1},
|
||||||
{KW_UPPER, "UPPER", 1},
|
{KW_UPPER, "UPPER", 1},
|
||||||
{USER, "USER", 1},
|
{USER, "USER", 1},
|
||||||
|
{USING, "USING", 2},
|
||||||
{KW_VALUE, "VALUE", 1},
|
{KW_VALUE, "VALUE", 1},
|
||||||
{VALUES, "VALUES", 1},
|
{VALUES, "VALUES", 1},
|
||||||
{VARCHAR, "VARCHAR", 1},
|
{VARCHAR, "VARCHAR", 1},
|
||||||
|
@ -651,14 +651,14 @@ typedef nod *NOD;
|
|||||||
#define e_rct_type 1
|
#define e_rct_type 1
|
||||||
|
|
||||||
#define e_pri_columns 0 /* nod_primary */
|
#define e_pri_columns 0 /* nod_primary */
|
||||||
#define e_pri_idx_name 1
|
#define e_pri_index 1
|
||||||
#define e_pri_count 2
|
#define e_pri_count 2
|
||||||
|
|
||||||
#define e_for_columns 0 /* nod_foreign */
|
#define e_for_columns 0 /* nod_foreign */
|
||||||
#define e_for_reftable 1
|
#define e_for_reftable 1
|
||||||
#define e_for_refcolumns 2
|
#define e_for_refcolumns 2
|
||||||
#define e_for_action 3
|
#define e_for_action 3
|
||||||
#define e_for_idx_name 4
|
#define e_for_index 4
|
||||||
#define e_for_count 5
|
#define e_for_count 5
|
||||||
|
|
||||||
#define e_ref_upd 0 /* nod_ref_upd_del_action */
|
#define e_ref_upd 0 /* nod_ref_upd_del_action */
|
||||||
|
4143
src/dsql/parse.cpp
4143
src/dsql/parse.cpp
File diff suppressed because it is too large
Load Diff
@ -405,6 +405,7 @@ static void yyerror (TEXT *);
|
|||||||
%token CASE
|
%token CASE
|
||||||
%token NULLIF
|
%token NULLIF
|
||||||
%token COALESCE
|
%token COALESCE
|
||||||
|
%token USING
|
||||||
|
|
||||||
/* precedence declarations for expression evaluation */
|
/* precedence declarations for expression evaluation */
|
||||||
|
|
||||||
@ -1261,25 +1262,31 @@ table_constraint : unique_constraint
|
|||||||
| check_constraint
|
| check_constraint
|
||||||
;
|
;
|
||||||
|
|
||||||
unique_constraint : UNIQUE column_parens constraint_index_name_opt
|
unique_constraint : UNIQUE column_parens constraint_index_opt
|
||||||
{ $$ = make_node (nod_unique, 2, $2, $3); }
|
{ $$ = make_node (nod_unique, 2, $2, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
primary_constraint : PRIMARY KEY column_parens constraint_index_name_opt
|
primary_constraint : PRIMARY KEY column_parens constraint_index_opt
|
||||||
{ $$ = make_node (nod_primary, e_pri_count, $3, $4); }
|
{ $$ = make_node (nod_primary, e_pri_count, $3, $4); }
|
||||||
;
|
;
|
||||||
|
|
||||||
referential_constraint : FOREIGN KEY column_parens REFERENCES
|
referential_constraint : FOREIGN KEY column_parens REFERENCES
|
||||||
simple_table_name column_parens_opt
|
simple_table_name column_parens_opt
|
||||||
referential_trigger_action constraint_index_name_opt
|
referential_trigger_action constraint_index_opt
|
||||||
{ $$ = make_node (nod_foreign, e_for_count, $3, $5,
|
{ $$ = make_node (nod_foreign, e_for_count, $3, $5,
|
||||||
$6, $7, $8); }
|
$6, $7, $8); }
|
||||||
;
|
;
|
||||||
|
|
||||||
constraint_index_name_opt : INDEX symbol_index_name
|
constraint_index_opt : USING order_direction INDEX symbol_index_name
|
||||||
{ $$ = $2; }
|
{ $$ = make_node (nod_def_index, (int) e_idx_count,
|
||||||
|
|
NULL, $2, $4, NULL, NULL); }
|
||||||
|
/*
|
||||||
|
| NO INDEX
|
||||||
{ $$ = NULL; }
|
{ $$ = NULL; }
|
||||||
|
*/
|
||||||
|
|
|
||||||
|
{ $$ = make_node (nod_def_index, (int) e_idx_count,
|
||||||
|
NULL, NULL, NULL, NULL, NULL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
check_constraint : begin_trigger CHECK '(' search_condition ')' end_trigger
|
check_constraint : begin_trigger CHECK '(' search_condition ')' end_trigger
|
||||||
|
Loading…
Reference in New Issue
Block a user