【24h】

Queryll: Java Database Queries Through Bytecode Rewriting

机译:Queryll:通过字节码重写的Java数据库查询

获取原文
获取原文并翻译 | 示例
获取外文期刊封面目录资料

摘要

When interfacing Java with other systems such as databases, programmers must often program in special interface languages like SQL. Code written in these languages often needs to be embedded in strings where they cannot be error-checked at compile-time, or the Java compiler needs to be altered to directly recognize code written in these languages. We have taken a different approach to adding database query facilities to Java. Bytecode rewriting allows us to add query facilities to Java whose correctness can be checked at compile-time but which don't require any changes to the Java language, Java compilers, Java VMs, or IDEs. Like traditional object-relational mapping tools, we provide Java libraries for accessing individual database entries as objects and navigating among them. To express a query though, a programmer simply writes code that takes a Collection representing the entire contents of a database, iterates over each entry like they would with a normal Collection, and choose the entries of interest. The query is fully valid Java code that, if executed, will read through an entire database and copy entries into Java objects where they will be inspected. Executing queries in this way is obviously inefficient, but we have a special bytecode rewriting tool that can decompile Java class files, identify queries in the bytecode, and rewrite the code to use SQL instead. The rewritten bytecode can then be run using any standard Java VM. Since queries use standard Java set manipulation syntax, Java programmers do not need to learn any new syntax. Our system is able to handle complex queries that make use of all the basic relational operations and exhibits performance comparable to that of hand-written SQL.
机译:当将Java与数据库等其他系统接口时,程序员必须经常使用特殊的接口语言(例如SQL)进行编程。用这些语言编写的代码通常需要嵌入在无法在编译时进行错误检查的字符串中,或​​者需要更改Java编译器以直接识别用这些语言编写的代码。我们采用了另一种方法向Java添加数据库查询功能。字节码重写使我们可以向Java添加查询工具,这些查询工具的正确性可以在编译时检查,但不需要对Java语言,Java编译器,Java VM或IDE进行任何更改。像传统的对象关系映射工具一样,我们提供Java库来作为对象访问各个数据库条目并在其中导航。但是,为了表示查询,程序员只需编写代码,就可以使用代表数据库整个内容的Collection,然后像对普通Collection一样对每个条目进行迭代,然后选择感兴趣的条目。该查询是完全有效的Java代码,如果执行该代码,则会读取整个数据库,并将条目复制到Java对象中,以对其进行检查。以这种方式执行查询显然效率低下,但是我们有一个特殊的字节码重写工具,可以反编译Java类文件,识别字节码中的查询并重写代码以使用SQL。然后可以使用任何标准Java VM运行重写的字节码。由于查询使用标准的Java集操作语法,因此Java程序员无需学习任何新语法。我们的系统能够处理利用所有基本关系操作的复杂查询,并表现出与手写SQL相当的性能。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号