001package gudusoft.gsqlparser.nodes; 002 003import gudusoft.gsqlparser.ESqlClause; 004import gudusoft.gsqlparser.TCustomSqlStatement; 005import gudusoft.gsqlparser.TSourceToken; 006 007/** 008 * This class is used to represent a JSON_TABLE function in Oracle and OpenJson function in SQL Server. 009 * 010 * JSON_TABLE is a function that generates a relational view of JSON data. It returns a table with one or more rows for each object in a JSON array. 011 * 012 * OpenJson in SQL Server, SOQL in Salesforce 013 * Json_table in Oracle 014 */ 015public class TJsonTable extends TTableFunction { 016 017 private TExpression row_expr_literal; 018 private TExpression col_expr_literal; 019 020 /** 021 * teradata rowexpr literal 022 */ 023 public TExpression getRowExprLiteral() { 024 return row_expr_literal; 025 } 026 027 /** 028 * teradata colexpr literal 029 */ 030 public TExpression getColExprLiteral() { 031 return col_expr_literal; 032 } 033 034 public void setRowExprLiteral(TExpression row_expr_literal) { 035 this.row_expr_literal = row_expr_literal; 036 } 037 038 public void setColExprLiteral(TExpression col_expr_literal) { 039 this.col_expr_literal = col_expr_literal; 040 } 041 042 private TColumnDefinitionList columnDefinitions; 043 044 public TColumnDefinitionList getColumnDefinitions() { 045 return columnDefinitions; 046 } 047 048 private TExpression jsonExpression; 049 private String path; 050 051 public void setPath(TSourceToken path) { 052 if (path == null) return; 053 this.path = path.toString(); 054 055 } 056 057 public String getPath() { 058 return path; 059 } 060 061 public TExpression getJsonExpression() { 062 return jsonExpression; 063 } 064 065 public void init(Object arg1){ 066 this.jsonExpression = (TExpression)arg1; 067 } 068 069 public void init(Object arg1,Object arg2){ 070 init(arg1); 071 this.columnDefinitions = (TColumnDefinitionList)arg2; 072 } 073 074 public void doParse(TCustomSqlStatement psql, ESqlClause plocation){ 075 super.doParse(psql,plocation); 076 if (this.jsonExpression != null){ 077 this.jsonExpression.doParse(psql,plocation); 078 } 079 } 080 081 public void accept(TParseTreeVisitor v){ 082 v.preVisit(this); 083 v.postVisit(this); 084 } 085 086 public void acceptChildren(TParseTreeVisitor v){ 087 v.preVisit(this); 088 if (jsonExpression != null){ 089 jsonExpression.acceptChildren(v); 090 } 091 092 v.postVisit(this); 093 } 094}