Logical Trees: an Essential Method of Parsing SQL Statement with Semantic Analysis
Gang Lu, Lano Kevin · International Journal of Advancements in Computing Technology · 2013
Comparing where sub-clauses between different SQL statements is important in analyzing SQL statements, which is usually the key for databases security. Comparing them literally is not sufficient, because there may be different character strings for the same semantic structure. A method called Logical Tree (LT) is proposed in this paper, which is used to compare different where sub-clauses semantically. By this method, where sub-clauses of SQL statements are denoted by trees. Some basic definitions of LT are addressed. According to laws of logical expressions, which are the form of where sub-clauses, accordingly laws and operations are defined for LT. When different LTs are reduced basing on some principles, they can be compared according to their structures. As a result, the where sub-clauses they denote are compared semantically. Basing on the method of LT, there may be more work about analyzing SQL statements can be done.