@@ -2943,6 +2943,18 @@ func tableReferenceToJSON(ref ast.TableReference) jsonNode {
29432943 if r.ProviderString != nil {
29442944 node["ProviderString"] = scalarExpressionToJSON(r.ProviderString)
29452945 }
2946+ if r.DataSource != nil {
2947+ node["DataSource"] = scalarExpressionToJSON(r.DataSource)
2948+ }
2949+ if r.UserId != nil {
2950+ node["UserId"] = scalarExpressionToJSON(r.UserId)
2951+ }
2952+ if r.Password != nil {
2953+ node["Password"] = scalarExpressionToJSON(r.Password)
2954+ }
2955+ if r.Query != nil {
2956+ node["Query"] = scalarExpressionToJSON(r.Query)
2957+ }
29462958 if r.Object != nil {
29472959 node["Object"] = schemaObjectNameToJSON(r.Object)
29482960 }
@@ -2958,6 +2970,73 @@ func tableReferenceToJSON(ref ast.TableReference) jsonNode {
29582970 }
29592971 node["ForPath"] = r.ForPath
29602972 return node
2973+ case *ast.AdHocTableReference:
2974+ node := jsonNode{
2975+ "$type": "AdHocTableReference",
2976+ }
2977+ if r.DataSource != nil {
2978+ node["DataSource"] = adHocDataSourceToJSON(r.DataSource)
2979+ }
2980+ if r.Object != nil {
2981+ objNode := jsonNode{
2982+ "$type": "SchemaObjectNameOrValueExpression",
2983+ }
2984+ if r.Object.SchemaObjectName != nil {
2985+ objNode["SchemaObjectName"] = schemaObjectNameToJSON(r.Object.SchemaObjectName)
2986+ }
2987+ if r.Object.ValueExpression != nil {
2988+ objNode["ValueExpression"] = scalarExpressionToJSON(r.Object.ValueExpression)
2989+ }
2990+ node["Object"] = objNode
2991+ }
2992+ if r.Alias != nil {
2993+ node["Alias"] = identifierToJSON(r.Alias)
2994+ }
2995+ node["ForPath"] = r.ForPath
2996+ return node
2997+ case *ast.OpenXmlTableReference:
2998+ node := jsonNode{
2999+ "$type": "OpenXmlTableReference",
3000+ }
3001+ if r.Variable != nil {
3002+ node["Variable"] = scalarExpressionToJSON(r.Variable)
3003+ }
3004+ if r.RowPattern != nil {
3005+ node["RowPattern"] = scalarExpressionToJSON(r.RowPattern)
3006+ }
3007+ if r.Flags != nil {
3008+ node["Flags"] = scalarExpressionToJSON(r.Flags)
3009+ }
3010+ if len(r.SchemaDeclarationItems) > 0 {
3011+ items := make([]jsonNode, len(r.SchemaDeclarationItems))
3012+ for i, item := range r.SchemaDeclarationItems {
3013+ items[i] = schemaDeclarationItemToJSON(item)
3014+ }
3015+ node["SchemaDeclarationItems"] = items
3016+ }
3017+ if r.TableName != nil {
3018+ node["TableName"] = schemaObjectNameToJSON(r.TableName)
3019+ }
3020+ if r.Alias != nil {
3021+ node["Alias"] = identifierToJSON(r.Alias)
3022+ }
3023+ node["ForPath"] = r.ForPath
3024+ return node
3025+ case *ast.OpenQueryTableReference:
3026+ node := jsonNode{
3027+ "$type": "OpenQueryTableReference",
3028+ }
3029+ if r.LinkedServer != nil {
3030+ node["LinkedServer"] = identifierToJSON(r.LinkedServer)
3031+ }
3032+ if r.Query != nil {
3033+ node["Query"] = scalarExpressionToJSON(r.Query)
3034+ }
3035+ if r.Alias != nil {
3036+ node["Alias"] = identifierToJSON(r.Alias)
3037+ }
3038+ node["ForPath"] = r.ForPath
3039+ return node
29613040 case *ast.PredictTableReference:
29623041 node := jsonNode{
29633042 "$type": "PredictTableReference",
@@ -3091,6 +3170,9 @@ func tableReferenceToJSON(ref ast.TableReference) jsonNode {
30913170 if r.PropertyName != nil {
30923171 node["PropertyName"] = scalarExpressionToJSON(r.PropertyName)
30933172 }
3173+ if r.Alias != nil {
3174+ node["Alias"] = identifierToJSON(r.Alias)
3175+ }
30943176 node["ForPath"] = r.ForPath
30953177 return node
30963178 case *ast.SemanticTableReference:
@@ -3136,6 +3218,9 @@ func schemaDeclarationItemToJSON(item *ast.SchemaDeclarationItem) jsonNode {
31363218 if item.ColumnDefinition != nil {
31373219 node["ColumnDefinition"] = columnDefinitionBaseToJSON(item.ColumnDefinition)
31383220 }
3221+ if item.Mapping != nil {
3222+ node["Mapping"] = scalarExpressionToJSON(item.Mapping)
3223+ }
31393224 return node
31403225}
31413226
0 commit comments