(n *parser.Create_virtual_table_stmtContext)
| 141 | } |
| 142 | |
| 143 | func (c *cc) convertCreate_virtual_table_fts5(n *parser.Create_virtual_table_stmtContext) ast.Node { |
| 144 | stmt := &ast.CreateTableStmt{ |
| 145 | Name: parseTableName(n), |
| 146 | IfNotExists: n.EXISTS_() != nil, |
| 147 | } |
| 148 | |
| 149 | for _, arg := range n.AllModule_argument() { |
| 150 | var columnName string |
| 151 | |
| 152 | // For example: CREATE VIRTUAL TABLE tbl_ft USING fts5(b, c UNINDEXED) |
| 153 | // * the 'b' column is parsed like Expr_qualified_column_nameContext |
| 154 | // * the 'c' column is parsed like Column_defContext |
| 155 | if columnExpr, ok := arg.Expr().(*parser.Expr_qualified_column_nameContext); ok { |
| 156 | columnName = columnExpr.Column_name().GetText() |
| 157 | } else if columnDef, ok := arg.Column_def().(*parser.Column_defContext); ok { |
| 158 | columnName = columnDef.Column_name().GetText() |
| 159 | } |
| 160 | |
| 161 | if columnName != "" { |
| 162 | stmt.Cols = append(stmt.Cols, &ast.ColumnDef{ |
| 163 | Colname: identifier(columnName), |
| 164 | // you can not specify any column constraints in fts5, so we pass them manually |
| 165 | IsNotNull: true, |
| 166 | TypeName: &ast.TypeName{Name: "text"}, |
| 167 | }) |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | return stmt |
| 172 | } |
| 173 | |
| 174 | func (c *cc) convertCreate_view_stmtContext(n *parser.Create_view_stmtContext) ast.Node { |
| 175 | viewName := n.View_name().GetText() |
no test coverage detected