parser

package
v0.4.75 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QualifyWhereCondition

func QualifyWhereCondition(sql string) (string, error)
  Updates columns names in where clause to be fully qualified
  ex: SELECT * FROM users WHERE name = 'John' becomes SELECT * FROM users WHERE "users"."name" = 'John'

	To view query tree use
	tree.ToStringTree(parser.RuleNames, parser)

	Example query tree for SELECT * FROM users WHERE name = 'John'
	(tsql_file
		(batch
			(sql_clauses
				(dml_clause
					(select_statement_standalone
						(select_statement
							(query_expression
								(query_specification
									SELECT
									(select_list
										(select_list_elem
											(asterisk *)))
									FROM
									(table_sources
										(table_source
											(table_source_item
												(full_table_name
													(id_ users)))))
									WHERE
									(search_condition
										(predicate
											(expression
												(full_column_name
													(id_
														(keyword name))))
											(comparison_operator =)
											(expression
												(primitive_expression
													(primitive_constant 'John')))))))))))) <EOF>)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL