Alvor -- SQL checker for Java

[复制链接]
查看11 | 回复2 | 2007-1-24 12:56:49 | 显示全部楼层 |阅读模式
In Java programs SQL statements are usually embedded in string literals. As they are just strings for compiler, SQL mistakes pop up only at runtime. Furthermore, if you have used conditionals for constructing the query, it's possible that a buggy branch is executed first time at your client's site.
Alvor is an Eclipse JDT plug-in that checks embedded SQL statements at compile-time. It can be invoked explicitly for whole-program analysis or it can be configured to run incrementally as you write code (each time file is saved). Alvor's work process has 3 main steps:
1) Find expressions in Java code that should evaluate to correct SQL statements. For this, the user configures set of method names and argument positions (eg. java.sql.Connection#prepareStatement, argument 1) and Alvor locates respective method calls and argument expressions.
2) Perform string analysis on those argument expressions to find their possible values. Besides simple string literals, it can handle conditional assignments to variables and cases where parts of string come from method parameters or from methods returning strings. Possible values for each expression are represented as a regular expression.
3) Validate found strings either by testing all possible cases against actual test database (using Connection.prepareStatement) or by performing abstract parsing directly on the regular expressions constructed in previous step. Any errors found are presented via Eclipse error markers.
Although Alvor is currently in beta, it has proven itself by finding 8 real SQL bugs in selected parts of Compiere ERP system (300 KLOC). For medium-sized projects the whole-program analysis takes 5-20 seconds. Incremental analysis usually completes in less than 0.5 seconds.
Alvor is an open-source project. For more information and installation instructions see http://alvor.googlecode.com/
回复

使用道具 举报

千问 | 2007-1-24 12:56:49 | 显示全部楼层
帮up
回复

使用道具 举报

千问 | 2007-1-24 12:56:49 | 显示全部楼层
Eclipse中的SQL验证插件,非常不错哦。
但不知道支持哪个SQL版本的语法。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行