Google Visualization API 中的 JDBC 结果集到数据表?
是否有将 JDBC ResultSet 转换为 Google Visualization 的通用方法 DataTable 对象?
似乎会有这样的东西使用 ResultSetMetaData 创建 ColumnDescription 对象,然后迭代填充行。但如果我能通过谷歌搜索找到它就好了。
由于 ResultSetMetaData 和 DataTable 都有许多特殊属性,在开始编写自定义方法之前,想要在这里仔细检查。
Is there a general method to convert a JDBC ResultSet to a Google Visualization DataTable object?
It seems like there would be such a thing that uses ResultSetMetaData to create ColumnDescription objects and then iterate populates rows. But darn if I can find it via Google search.
Since both ResultSetMetaData and DataTable have so many special properties, wanted to double check here before starting down the garden path of writing a custom method.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
类 com.google.visualization.datasource.util.SqlDataSourceHelper 有两个静态方法
buildColumns()
和负责处理此问题的buildRows()
:这些是从顶级方法
executeQuery(...)
调用的,然后调用类中的其他方法来处理各种情况翻译步骤。据说它只适用于 MySQL,但代码足够透明,可以针对其他目标数据库进行定制。The class com.google.visualization.datasource.util.SqlDataSourceHelper has two static methods
buildColumns()
andbuildRows()
that take care of this:These are called from the top method
executeQuery(...)
and in turn call other methods in the class, that handle the various translation steps. It's said to work only with MySQL but the code is transparent enough to customize for other target database.