• SqlBuilder


    SqlBuilder是一个SQL查询语句生成类库。它利用Builder设计模式将SQL语法封装成易于使用的Java对象,从而让一些在运行期才能发现的SQL语法错误转换成Java编译期错误。

    SqlBuilder is a library which attempts to take the pain out of generating SQL queries within Java programs. Using one programming language (Java) to generate code for another language (i.e. SQL) is always a challenge. There are always issues with escaping characters within string literals, getting spaces in the right place, and getting the parentheses to match up. And often, even after the code is debugged and fully tested, it is still very fragile. The slightest change will throw things out of balance and require another round of testing and tweaking.

    SqlBuilder changes that whole scenario by wrapping the SQL syntax within very lightweight and easy to use Java objects which follow the "builder" paradigm (similar to StringBuilder). This changes many common SQL syntactical, runtime errors into Java compile-time errors! Let's dive right in to some quick examples to to see how it all works.

    A fairly simple SQL select query embedded in a Java program might currently look something like this:

    // assuming a variety of predefined string constants
    String selectQuery = "SELECT " + T1_COL1 + "," + T1_COL2 + "," +
    T2_COL1 + " FROM " + TABLE1 + " " + T1 + " INNER JOIN " +
    TABLE2 + " " + T2 + " ON (" + T1_IDCOL + " = " + T2_IDCOL +
    ") ORDER BY " + T1_COL1;

    Whenever this query is modified, you will need to make sure there are sufficient commas, parentheses, and spaces to generate the correct query (not to mention the correct columns for the given tables and the correct aliases for those tables).

    点击次数   官方主页【官方主页】   下载地址【下载地址】

    网友留言/评论

    我要留言/评论

    相关开源项目

    WebHuddle:WebHuddle一个小巧(只有100KB),简单(不需要安装-直接运行在浏览器上)并且安全(所有数据通过HTTPS协议加密)的Web based视频会议系统.
    FCKeditor:这个HTML文本编辑器可以让web程序拥有如MS Word这样强大的编辑功能.FCKeditor支持当前流行的浏览器如IE 5.5+, Firefox 1.0+, Mozilla 1.3+与Netscape 7+. 本站有个在线DEMO

    Jettison:Jettison是一组StAX parser与writer用于读写JSON。这就使得可以在像CXF,XFire这样的service框架中实现基于JSON的web service。
    MessAdmin:MessAdmin是一个HttpSession管理与通知系统。它以非侵入的方式加到Web应用程序中,不需要修改原有程序任何代码。MessAdmin提供的功能包括:监控所有活跃的HttpSession;查看相关Sessions的详细信息;发送Html信息到所有远程用户(包括Web与JMX用户)等。
    iCarousel:iCarousel是一个开源的javascript工具用于创建滚动效果的widget。它非常灵活,构建在MooTools之上。

    SWTJasperViewer:SWTJasperViewer是一个专门为基于SWT/JFace应用程序与Eclipse插件开发的JasperReports报表查看组件。
    OpenDMTP:OpenDMTP(Open Device Monitoring and Tracking Protocol)是一个协议和框架用于在服务器和客户端设备之间通过Internet或其它相似网络进行双向数据通信。OpenDMTP是专门连接面向基于定位的信息比如GPS,也可以是从远程监控设备收集到的温度和其它数据。由于OpenDMTP非常小,所以特别适合于移动设备比PDA,移动电话和其它特定的OEM设备。
    YaHP:YaHP是一个能够把html文档转换成pdf文档的Java开源包。
    JBarcodeBean:JBarcodeBean是一个JFC Swing兼容的JavaBean组件用来产生条形码.JBarcodeBean支持当前一些流行的条形码格式如:Code 128,Code 39,Extended Code 39,Codabar Interleaved Code 25 ,MSI ,EAN-13,EAN-8.
    验证码:Kaptcha:Kaptcha是比simplecaptcha功能更强,更易于使用的Java验证码组件。