@@ -1125,8 +1125,11 @@ public override void ExitAliased_table_name(MiniSqlParserParser.Aliased_table_na
1125
1125
}
1126
1126
1127
1127
public override void ExitHinted_table_name ( MiniSqlParserParser . Hinted_table_nameContext context ) {
1128
- if ( context . table_hint ( ) == null ) {
1129
- // table_hintが存在しない場合はなにもしない
1128
+ // コメントでテーブル別名の指定があれば取得する
1129
+ var implicitAliasName = this . GetTableAliasNameFromDocComment ( context ) ;
1130
+
1131
+ if ( context . table_hint ( ) == null && string . IsNullOrEmpty ( implicitAliasName ) ) {
1132
+ // Tableオブジェクトを再作成する必要がなければ何もしない
1130
1133
return ;
1131
1134
}
1132
1135
@@ -1135,8 +1138,6 @@ public override void ExitHinted_table_name(MiniSqlParserParser.Hinted_table_name
1135
1138
comments . AddRange ( this . GetComments ( context ) ) ;
1136
1139
comments . AddRange ( this . GetComments ( context . table_hint ( ) ) ) ;
1137
1140
1138
- // コメントでテーブル別名の指定があれば取得する
1139
- var implicitAliasName = this . GetTableAliasNameFromDocComment ( context ) ;
1140
1141
1141
1142
var hinted_table = this . CreateHintedTable ( context . table_hint ( )
1142
1143
, tableNode
@@ -1172,20 +1173,23 @@ private Table CreateHintedTable(MiniSqlParserParser.Table_hintContext table_hint
1172
1173
Identifier indexSchemaName = null ;
1173
1174
Identifier indexName = null ;
1174
1175
bool hasNotIndexed = false ;
1175
-
1176
- if ( table_hintContext . K_NOT ( ) != null ) {
1177
- hasNotIndexed = true ;
1178
- } else if ( table_hintContext . K_INDEXED ( ) != null ) {
1179
- comments . AddRange ( this . GetComments ( table_hintContext . index_name ( ) . qualified_schema_name ( ) ) ) ;
1180
- comments . AddRange ( this . GetComments ( table_hintContext . index_name ( ) ) ) ;
1181
- if ( table_hintContext . index_name ( ) . qualified_schema_name ( ) != null ) {
1182
- indexServerName = this . GetIdentifier ( table_hintContext . index_name ( ) . qualified_schema_name ( ) . s ) ;
1183
- indexDatabaseName = this . GetIdentifier ( table_hintContext . index_name ( ) . qualified_schema_name ( ) . d ) ;
1184
- indexSchemaName = this . GetIdentifier ( table_hintContext . index_name ( ) . qualified_schema_name ( ) . n ) ;
1176
+ var msSqlHint = MsSqlHint . None ;
1177
+
1178
+ if ( table_hintContext != null ) {
1179
+ if ( table_hintContext . K_NOT ( ) != null ) {
1180
+ hasNotIndexed = true ;
1181
+ } else if ( table_hintContext . K_INDEXED ( ) != null ) {
1182
+ comments . AddRange ( this . GetComments ( table_hintContext . index_name ( ) . qualified_schema_name ( ) ) ) ;
1183
+ comments . AddRange ( this . GetComments ( table_hintContext . index_name ( ) ) ) ;
1184
+ if ( table_hintContext . index_name ( ) . qualified_schema_name ( ) != null ) {
1185
+ indexServerName = this . GetIdentifier ( table_hintContext . index_name ( ) . qualified_schema_name ( ) . s ) ;
1186
+ indexDatabaseName = this . GetIdentifier ( table_hintContext . index_name ( ) . qualified_schema_name ( ) . d ) ;
1187
+ indexSchemaName = this . GetIdentifier ( table_hintContext . index_name ( ) . qualified_schema_name ( ) . n ) ;
1188
+ }
1189
+ indexName = this . GetIdentifier ( table_hintContext . index_name ( ) . identifier ( ) ) ;
1185
1190
}
1186
- indexName = this . GetIdentifier ( table_hintContext . index_name ( ) . identifier ( ) ) ;
1191
+ msSqlHint = this . ConvToMsSqlHint ( table_hintContext . h ) ;
1187
1192
}
1188
- var msSqlHint = this . ConvToMsSqlHint ( table_hintContext . h ) ;
1189
1193
1190
1194
return new Table ( tableNode . ServerName
1191
1195
, tableNode . DataBaseName
0 commit comments