@@ -2257,7 +2257,6 @@ TOKEN [IGNORE_CASE] :
2257
2257
| <XMLPARSE: "xmlparse">
2258
2258
| <XMLQUERY: "xmlquery">
2259
2259
| <XMLSERIALIZE: "xmlserialize">
2260
- | <Z_ORDER_LAT_LON: "z_order_lat_lon">
2261
2260
}
2262
2261
2263
2262
/* This list should contain non-SQL92 keywords that are not reserved.
@@ -8445,58 +8444,59 @@ indexItemList(IndexColumnList columnList) throws StandardException :
8445
8444
8446
8445
void indexItem(IndexColumnList columnList) throws StandardException :
8447
8446
{
8448
- String columnName;
8447
+ String firstName = null;
8448
+ String columnName = null;
8449
8449
boolean asc = true;
8450
- int spatialColumnCount;
8450
+ int firstSpatialColumnPosition = -1;
8451
+ int spatialColumnCount = -1;
8451
8452
}
8452
8453
{
8453
- (
8454
- <Z_ORDER_LAT_LON>
8455
- <LEFT_PAREN>
8456
- columnName = identifier()
8457
- {
8458
- int latPosition = columnList.size();
8459
- IndexColumn lat = (IndexColumn)
8460
- nodeFactory.getNode(NodeTypes.INDEX_COLUMN,
8461
- columnName,
8462
- Boolean.FALSE,
8463
- parserContext);
8464
- columnList.add(lat);
8465
- spatialColumnCount = 1;
8466
- }
8467
- [
8468
- <COMMA>
8469
- columnName = identifier()
8470
- {
8471
- IndexColumn lon = (IndexColumn)
8472
- nodeFactory.getNode(NodeTypes.INDEX_COLUMN,
8473
- columnName,
8474
- Boolean.FALSE,
8475
- parserContext);
8476
- columnList.add(lon);
8477
- spatialColumnCount = 2;
8478
- }
8479
- ]
8480
- <RIGHT_PAREN>
8481
- {
8482
- columnList.applyFunction(IndexColumnList.FunctionType.Z_ORDER_LAT_LON,
8483
- latPosition,
8484
- spatialColumnCount);
8485
- }
8486
- )
8487
- |
8488
- (
8489
- columnName = identifier()
8490
- [ <ASC> | <DESC> { asc = false; } ]
8491
- {
8492
- IndexColumn indexColumn = (IndexColumn)
8493
- nodeFactory.getNode(NodeTypes.INDEX_COLUMN,
8494
- columnName,
8495
- asc ? Boolean.TRUE : Boolean.FALSE,
8496
- parserContext);
8497
- columnList.add(indexColumn);
8498
- }
8499
- )
8454
+ firstName = identifier()
8455
+ ( (
8456
+ <LEFT_PAREN>
8457
+ columnName = identifier()
8458
+ {
8459
+ firstSpatialColumnPosition = columnList.size();
8460
+ IndexColumn lat = (IndexColumn)
8461
+ nodeFactory.getNode(NodeTypes.INDEX_COLUMN,
8462
+ columnName,
8463
+ Boolean.FALSE,
8464
+ parserContext);
8465
+ columnList.add(lat);
8466
+ spatialColumnCount = 1;
8467
+ }
8468
+ [
8469
+ <COMMA>
8470
+ columnName = identifier()
8471
+ {
8472
+ IndexColumn lon = (IndexColumn)
8473
+ nodeFactory.getNode(NodeTypes.INDEX_COLUMN,
8474
+ columnName,
8475
+ Boolean.FALSE,
8476
+ parserContext);
8477
+ columnList.add(lon);
8478
+ spatialColumnCount = 2;
8479
+ }
8480
+ ]
8481
+ <RIGHT_PAREN>
8482
+ {
8483
+ columnList.applyFunction(IndexColumnList.functionType(firstName),
8484
+ firstSpatialColumnPosition,
8485
+ spatialColumnCount);
8486
+ }
8487
+ )
8488
+ |
8489
+ (
8490
+ [ <ASC> | <DESC> { asc = false; } ]
8491
+ {
8492
+ IndexColumn indexColumn = (IndexColumn)
8493
+ nodeFactory.getNode(NodeTypes.INDEX_COLUMN,
8494
+ firstName,
8495
+ asc ? Boolean.TRUE : Boolean.FALSE,
8496
+ parserContext);
8497
+ columnList.add(indexColumn);
8498
+ }
8499
+ ) )
8500
8500
}
8501
8501
8502
8502
void
@@ -14435,30 +14435,53 @@ groupIndexItemList(IndexColumnList columnList) throws StandardException :
14435
14435
14436
14436
void groupIndexItem(IndexColumnList columnList) throws StandardException :
14437
14437
{
14438
- int latPosition;
14438
+ ColumnReference columnReference;
14439
+ String[] nameComponents;
14440
+ int firstSpatialColumnPosition;
14439
14441
int spatialColumnCount;
14442
+ boolean asc = true;
14440
14443
}
14441
14444
{
14442
- (
14443
- <Z_ORDER_LAT_LON>
14444
- <LEFT_PAREN>
14445
- { latPosition = columnList.size(); }
14446
- unorderedGroupIndexColumnItem(columnList)
14447
- { spatialColumnCount = 1; }
14448
- [
14445
+ nameComponents = groupIndexColumnNameComponents()
14446
+ ( (
14447
+ <LEFT_PAREN>
14448
+ { firstSpatialColumnPosition = columnList.size(); }
14449
+ unorderedGroupIndexColumnItem(columnList)
14450
+ { spatialColumnCount = 1; }
14451
+ [
14449
14452
<COMMA>
14450
14453
unorderedGroupIndexColumnItem(columnList)
14451
14454
{ spatialColumnCount = 2; }
14452
- ]
14453
- <RIGHT_PAREN>
14454
- {
14455
- columnList.applyFunction(IndexColumnList.FunctionType.Z_ORDER_LAT_LON,
14456
- latPosition,
14457
- spatialColumnCount);
14458
- }
14459
- )
14460
- |
14461
- groupIndexColumnItem(columnList)
14455
+ ]
14456
+ <RIGHT_PAREN>
14457
+ {
14458
+ String functionName = nameComponents[2];
14459
+ if (nameComponents[1] != null) {
14460
+ functionName = nameComponents[1] + "." + functionName;
14461
+ if (nameComponents[0] != null) {
14462
+ functionName = nameComponents[0] + "." + functionName;
14463
+ }
14464
+ throw new StandardException(functionName + " is not a valid function for use in index creation DDL.");
14465
+ }
14466
+ columnList.applyFunction(IndexColumnList.functionType(functionName),
14467
+ firstSpatialColumnPosition,
14468
+ spatialColumnCount);
14469
+ }
14470
+ )
14471
+ |
14472
+ (
14473
+ [ <ASC> | <DESC> { asc = false; } ]
14474
+ {
14475
+ columnReference = groupIndexColumnNameFromComponents(nameComponents);
14476
+ IndexColumn indexColumn = (IndexColumn)
14477
+ nodeFactory.getNode(NodeTypes.INDEX_COLUMN,
14478
+ columnReference.getTableNameNode(),
14479
+ columnReference.getColumnName(),
14480
+ asc ? Boolean.TRUE : Boolean.FALSE,
14481
+ parserContext);
14482
+ columnList.add(indexColumn);
14483
+ }
14484
+ ) )
14462
14485
}
14463
14486
14464
14487
void fullTextColumnItemList(IndexColumnList columnList) throws StandardException :
@@ -14482,7 +14505,7 @@ groupIndexColumnItem(IndexColumnList columnList) throws StandardException :
14482
14505
ColumnReference groupIndexColumnName;
14483
14506
}
14484
14507
{
14485
- groupIndexColumnName = groupIndexColumnName(columnList )
14508
+ groupIndexColumnName = groupIndexColumnName()
14486
14509
[ <ASC> | <DESC> { asc = false; } ]
14487
14510
{
14488
14511
IndexColumn indexColumn = (IndexColumn)
@@ -14501,7 +14524,7 @@ unorderedGroupIndexColumnItem(IndexColumnList columnList) throws StandardExcepti
14501
14524
ColumnReference groupIndexColumnName;
14502
14525
}
14503
14526
{
14504
- groupIndexColumnName = groupIndexColumnName(columnList )
14527
+ groupIndexColumnName = groupIndexColumnName()
14505
14528
{
14506
14529
IndexColumn indexColumn = (IndexColumn)
14507
14530
nodeFactory.getNode(NodeTypes.INDEX_COLUMN,
@@ -14514,48 +14537,67 @@ unorderedGroupIndexColumnItem(IndexColumnList columnList) throws StandardExcepti
14514
14537
}
14515
14538
14516
14539
ColumnReference
14517
- groupIndexColumnName(IndexColumnList columnList) throws StandardException :
14540
+ groupIndexColumnName() throws StandardException :
14541
+ {
14542
+ String[] names;
14543
+ }
14544
+ {
14545
+ {
14546
+ return groupIndexColumnNameFromComponents(groupIndexColumnNameComponents());
14547
+ }
14548
+ }
14549
+
14550
+ ColumnReference
14551
+ groupIndexColumnNameFromComponents(String[] names) throws StandardException :
14518
14552
{
14519
- String firstName;
14520
- String secondName = null;
14521
- String thirdName = null;
14522
14553
}
14523
14554
{
14524
- firstName = identifierDeferCheckLength()
14525
- [ LOOKAHEAD( { getToken(1).kind == PERIOD } )
14526
- <PERIOD>
14527
- secondName = identifierDeferCheckLength()
14528
- [ LOOKAHEAD( { getToken(1).kind == PERIOD } )
14529
- <PERIOD>
14530
- thirdName = identifierDeferCheckLength() ] ]
14531
14555
{
14532
- if (secondName == null) {
14533
- thirdName = firstName;
14534
- firstName = null;
14535
- }
14536
- else if (thirdName == null) {
14537
- thirdName = secondName;
14538
- secondName = firstName;
14539
- firstName = null;
14540
- }
14541
- if (firstName != null)
14542
- parserContext.checkIdentifierLengthLimit(firstName);
14543
- if (secondName != null)
14544
- parserContext.checkIdentifierLengthLimit(secondName);
14545
- parserContext.checkIdentifierLengthLimit(thirdName);
14546
14556
TableName tableName = null;
14547
- if (secondName != null)
14557
+ if (names[1] != null)
14548
14558
tableName = (TableName)nodeFactory.getNode(NodeTypes.TABLE_NAME,
14549
- firstName ,
14550
- secondName ,
14559
+ names[0] ,
14560
+ names[1] ,
14551
14561
new Integer(nextToLastIdentifierToken.beginOffset),
14552
14562
new Integer(nextToLastIdentifierToken.endOffset),
14553
14563
parserContext);
14554
14564
return (ColumnReference)nodeFactory.getNode(NodeTypes.COLUMN_REFERENCE,
14555
- thirdName ,
14565
+ names[2] ,
14556
14566
tableName,
14557
14567
new Integer(lastIdentifierToken.beginOffset),
14558
14568
new Integer(lastIdentifierToken.endOffset),
14559
14569
parserContext);
14560
14570
}
14561
14571
}
14572
+
14573
+ String[]
14574
+ groupIndexColumnNameComponents() throws StandardException :
14575
+ {
14576
+ String[] names = new String[3];
14577
+ }
14578
+ {
14579
+ names[0] = identifierDeferCheckLength()
14580
+ [ LOOKAHEAD( { getToken(1).kind == PERIOD } )
14581
+ <PERIOD>
14582
+ names[1] = identifierDeferCheckLength()
14583
+ [ LOOKAHEAD( { getToken(1).kind == PERIOD } )
14584
+ <PERIOD>
14585
+ names[2] = identifierDeferCheckLength() ] ]
14586
+ {
14587
+ if (names[1] == null) {
14588
+ names[2] = names[0];
14589
+ names[0] = null;
14590
+ }
14591
+ else if (names[2] == null) {
14592
+ names[2] = names[1];
14593
+ names[1] = names[0];
14594
+ names[0] = null;
14595
+ }
14596
+ if (names[0] != null)
14597
+ parserContext.checkIdentifierLengthLimit(names[0]);
14598
+ if (names[1] != null)
14599
+ parserContext.checkIdentifierLengthLimit(names[1]);
14600
+ parserContext.checkIdentifierLengthLimit(names[2]);
14601
+ return names;
14602
+ }
14603
+ }
0 commit comments