-
-
Save phantomjinx/17135fe7a766d305d375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final public void createTable(MetadataFactory factory) throws ParseException { | |
boolean view = false; | |
boolean globalTemp = false; | |
String tableName = null; | |
Table table = null; | |
Token comment = null; | |
Command query = null; | |
jj_consume_token(CREATE); | |
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { | |
case FOREIGN: | |
jj_consume_token(FOREIGN); | |
jj_consume_token(TABLE); | |
break; | |
case VIRTUAL: | |
case VIEW: | |
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { | |
case VIRTUAL: | |
jj_consume_token(VIRTUAL); | |
break; | |
default: | |
jj_la1[320] = jj_gen; | |
; | |
} | |
jj_consume_token(VIEW); | |
view = true; | |
break; | |
case GLOBAL: | |
jj_consume_token(GLOBAL); | |
jj_consume_token(TEMPORARY); | |
jj_consume_token(TABLE); | |
globalTemp = true; view = true; | |
break; | |
default: | |
jj_la1[321] = jj_gen; | |
jj_consume_token(-1); | |
throw new ParseException(); | |
} | |
tableName = id(null); | |
table = factory.addTable(tableName); | |
table.setVirtual(view); | |
if (globalTemp) { | |
table.setTableType(Table.Type.TemporaryTable); | |
} | |
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { | |
case LPAREN: | |
createTableBody(table, factory); | |
break; | |
default: | |
jj_la1[323] = jj_gen; | |
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { | |
case OPTIONS: | |
optionsClause(table, factory); | |
setTableOptions(table); | |
break; | |
default: | |
jj_la1[322] = jj_gen; | |
; | |
} | |
} | |
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { | |
case AS: | |
jj_consume_token(AS); | |
comment = getToken(1).specialToken; | |
query = queryExpression(ParseInfo.DEFAULT_INSTANCE); | |
if (!view || globalTemp) { | |
{if (true) throw new MetadataException(QueryPlugin.Util.getString("SQLParser.view_def", table.getName()));} | |
} | |
table.setSelectTransformation((comment != null?comment.image+" ":"") + query.toString()); | |
break; | |
default: | |
jj_la1[324] = jj_gen; | |
; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment