<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AnySQL.net &#187; Java</title>
	<atom:link href="http://www.anysql.net/tag/java/feed" rel="self" type="application/rss+xml" />
	<link>http://www.anysql.net</link>
	<description>SQLULDR2, DataCopy, DataSync, WebChart, OraMon, AUL/MyDUL, 性能优化及容量分析</description>
	<lastBuildDate>Wed, 14 Jul 2010 09:27:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>批量数据查询需求</title>
		<link>http://www.anysql.net/tools/webchart-batch-query.html</link>
		<comments>http://www.anysql.net/tools/webchart-batch-query.html#comments</comments>
		<pubDate>Fri, 07 May 2010 01:37:44 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=759</guid>
		<description><![CDATA[&#160; &#160; 经常会接收到开发人员的批量数据查询需求, 什么是批量数据查询需求? 指的是开发人员给你一堆ID, 比如员工编号, 要求查出这些ID对应的记录, 比如员工记录. 提供的格式通常是一行一个ID, 可以指定任意多个, 进行查询. 说了一堆, 还是举个例子来说明一下吧. &#160; &#160; 以SCOTT用户的员工表(EMP)为例, 我们在查询页面中, 提供了一个文本输入区, 让查询人员指定多个员工编号. 7369 7499 7521 7566 &#160; &#160; 在点击查询后, 要能得到如下结果. EMPNO ENAME JOB MGR SAL 7369 SMITH CLERK 7902 1100 7499 ALLEN SALESMAN 7698 1600 7521 WARD SALESMAN 7698 1250 7566 JONES MANAGER 7839 3275 &#160; &#160; 上周帮一个部门做了一个临时查询页面时, [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 经常会接收到开发人员的批量数据查询需求, 什么是批量数据查询需求? 指的是开发人员给你一堆ID, 比如员工编号, 要求查出这些ID对应的记录, 比如员工记录. 提供的格式通常是一行一个ID, 可以指定任意多个, 进行查询. 说了一堆, 还是举个例子来说明一下吧. </p>
<p>&nbsp; &nbsp; 以SCOTT用户的员工表(EMP)为例, 我们在查询页面中, 提供了一个文本输入区, 让查询人员指定多个员工编号. </p>
<blockquote><p>
<textarea name="arglist" cols="30" rows="6">7369<br />
7499<br />
7521<br />
7566</textarea>
</p></blockquote>
<p>&nbsp; &nbsp; 在点击查询后, 要能得到如下结果. </p>
<blockquote class="prefont">
<table border="1" width="500" cellspacing="0" cellpadding="2">
<caption align="center">
<font size="5"></font><br />
</caption>
<tr>
<th width="16%">EMPNO</th>
<th width="20%">ENAME</th>
<th width="32%">JOB</th>
<th width="16%">MGR</th>
<th width="16%">SAL</th>
</tr>
<tr>
<td align="right">7369</td>
<td align="center">SMITH</td>
<td bgcolor="#eeeeee" align="left">CLERK</td>
<td bgcolor="#eeeeee" align="right">7902</td>
<td bgcolor="#eeeeee" align="right">1100</td>
</tr>
<tr>
<td align="right">7499</td>
<td align="center">ALLEN</td>
<td align="left">SALESMAN</td>
<td align="right">7698</td>
<td align="right">1600</td>
</tr>
<tr>
<td align="right">7521</td>
<td align="center">WARD</td>
<td bgcolor="#eeeeee" align="left">SALESMAN</td>
<td bgcolor="#eeeeee" align="right">7698</td>
<td bgcolor="#eeeeee" align="right">1250</td>
</tr>
<tr>
<td align="right">7566</td>
<td align="center">JONES</td>
<td align="left">MANAGER</td>
<td align="right">7839</td>
<td align="right">3275</td>
</tr>
</table>
</blockquote>
<p>&nbsp; &nbsp; 上周帮一个部门做了一个临时查询页面时, 人家强烈要求这样的<strong>UI体验, 视觉之外的体验</strong>, 只好下功夫努力去解决一下了. 还好在DataReport中实现起来并不难. 先定义一个如下所示的页面</p>
<blockquote class="prefont"><p>
WEBCHART.FORALL_1=$arglist<br />
WEBCHART.TYPE_1=-<br />
WEBCHART.QUERY_1=SELECT empno, ename, job, mgr, sal <br />
&nbsp;  FROM EMP WHERE EMPNO = TO_NUMBER(:ARGV0)</p>
<p>WEBCHART.QUERY_2=-
</p></blockquote>
<p>&nbsp; &nbsp; 只要将员工列表的数据用名为arglist的URL参数传给这个页面就可以了. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li><li>2009/12/28 -- <a href="http://www.anysql.net/tools/webchart-one-java-servlet.html" title="统一DataReport的Servlet">统一DataReport的Servlet</a> (2)</li><li>2009/12/02 -- <a href="http://www.anysql.net/tools/webchart-xml-html-escape-chars.html" title="添加URL/HTML字符转义功能">添加URL/HTML字符转义功能</a> (1)</li><li>2009/09/21 -- <a href="http://www.anysql.net/tools/four-extra-businees-charts.html" title="多支持了四种业务图">多支持了四种业务图</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-batch-query.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>为DataReport增加条件过滤功能</title>
		<link>http://www.anysql.net/tools/webchart-rows-filter.html</link>
		<comments>http://www.anysql.net/tools/webchart-rows-filter.html#comments</comments>
		<pubDate>Thu, 04 Mar 2010 12:54:42 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=742</guid>
		<description><![CDATA[&#160; &#160; 为了查询出保存在员工表(SCOTT.EMP)中, 每个部门工资最高的三个人, 如果是Oracle数据库, 大家可以使用Windows分组汇总函数来轻松地实现, 如下所示. SELECT * FROM ( SELECT DEPTNO, EMPNO, ENAME, SAL, &#160; RANK() OVER (PARTITION BY DEPTNO ORDER BY SAL DESC) RNK FROM EMP ) WHERE RNK &#60;= 3 &#160; &#160; 但如果员工表存放在MySQL数据库, 或其他数据库, 如SQLLite中, 要实现同样的功能, 就比较复杂了, 至少我现在都还不会. 但利用DataReport以前开发的功能, 及刚增加的条件过滤功能, 就可以轻松实现这个需求. webchart.query_1=select deptno, empno, ename, sal from emp webchart.express_1=rank&#124;x&#124;rnk::sal&#124;deptno webchart.filter_1=3.5-x&#124;rank webchart.sort_1=deptno,rank [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 为了查询出保存在员工表(SCOTT.EMP)中, 每个部门工资最高的三个人, 如果是Oracle数据库, 大家可以使用Windows分组汇总函数来轻松地实现, 如下所示. </p>
<blockquote class="prefont"><p>
SELECT * FROM (<br />
SELECT DEPTNO, EMPNO, ENAME, SAL,<br />
&nbsp;  RANK() OVER (PARTITION BY DEPTNO ORDER BY SAL DESC) RNK<br />
FROM EMP ) WHERE RNK &lt;= 3
</p></blockquote>
<p>&nbsp; &nbsp; 但如果员工表存放在MySQL数据库, 或其他数据库, 如SQLLite中, 要实现同样的功能, 就比较复杂了, 至少我现在都还不会. 但利用DataReport以前开发的功能, 及刚增加的条件过滤功能, 就可以轻松实现这个需求. </p>
<blockquote class="prefont"><p>
webchart.query_1=select deptno, empno, ename, sal from emp<br />
webchart.express_1=rank|x|rnk::sal|deptno<br />
<strong>webchart.filter_1=3.5-x|rank</strong><br />
webchart.sort_1=deptno,rank<br />
webchart.group_1=1
</p></blockquote>
<p>&nbsp; &nbsp; 如果Filter中的公司算出来的值小于0, 那么这条记录就会被删除, 在这个例子中, 如果排名这一列的值大于3, 这个公式算出来的值就为负数, 所以只保留了前三名, 达到了我们的业务要求. 页面输出如下所示的表格: </p>
<blockquote class="prefont">
<table border="1" width="550" cellspacing="0" cellpadding="2">
<caption align="center">
<font size="5"></font><br />
</caption>
<tr>
<th width="16%">deptno</th>
<th width="16%">empno</th>
<th width="25%">ename</th>
<th width="25%">sal</th>
<th width="16%">rank</th>
</tr>
<tr>
<td rowspan="3" align="right">10</td>
<td bgcolor="#eeeeee" align="right">7839</td>
<td bgcolor="#eeeeee" align="center">KING</td>
<td bgcolor="#eeeeee" align="right">5000.0</td>
<td bgcolor="#eeeeee" align="right">1</td>
</tr>
<tr>
<td align="right">7782</td>
<td align="center">CLARK</td>
<td align="right">2450.0</td>
<td align="right">2</td>
</tr>
<tr>
<td bgcolor="#eeeeee" align="right">7934</td>
<td bgcolor="#eeeeee" align="center">MILLER</td>
<td bgcolor="#eeeeee" align="right">1300.0</td>
<td bgcolor="#eeeeee" align="right">3</td>
</tr>
<tr>
<td rowspan="3" align="right">20</td>
<td align="right">7788</td>
<td align="center">SSCOTT</td>
<td align="right">3000.0</td>
<td align="right">1</td>
</tr>
<tr>
<td bgcolor="#eeeeee" align="right">7902</td>
<td bgcolor="#eeeeee" align="center">FORD</td>
<td bgcolor="#eeeeee" align="right">3000.0</td>
<td bgcolor="#eeeeee" align="right">2</td>
</tr>
<tr>
<td align="right">7566</td>
<td align="center">JONESS</td>
<td align="right">2975.0</td>
<td align="right">3</td>
</tr>
<tr>
<td rowspan="3" align="right">30</td>
<td bgcolor="#eeeeee" align="right">7698</td>
<td bgcolor="#eeeeee" align="center">BLAKE</td>
<td bgcolor="#eeeeee" align="right">2850.0</td>
<td bgcolor="#eeeeee" align="right">1</td>
</tr>
<tr>
<td align="right">7499</td>
<td align="center">ALLEN</td>
<td align="right">1600.0</td>
<td align="right">2</td>
</tr>
<tr>
<td bgcolor="#eeeeee" align="right">7844</td>
<td bgcolor="#eeeeee" align="center">TURNER</td>
<td bgcolor="#eeeeee" align="right">1500.0</td>
<td bgcolor="#eeeeee" align="right">3</td>
</tr>
</table>
</blockquote>
<p>&nbsp; &nbsp; 将这些处理放在应用服务器端实现, 不仅让SQL变得通用, 如果访问频率极高, 还可以减轻数据库端的压力. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li><li>2009/12/28 -- <a href="http://www.anysql.net/tools/webchart-one-java-servlet.html" title="统一DataReport的Servlet">统一DataReport的Servlet</a> (2)</li><li>2009/12/02 -- <a href="http://www.anysql.net/tools/webchart-xml-html-escape-chars.html" title="添加URL/HTML字符转义功能">添加URL/HTML字符转义功能</a> (1)</li><li>2009/09/21 -- <a href="http://www.anysql.net/tools/four-extra-businees-charts.html" title="多支持了四种业务图">多支持了四种业务图</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-rows-filter.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WebChart的DB连接配置2</title>
		<link>http://www.anysql.net/tools/webchart-dbconn-config2.html</link>
		<comments>http://www.anysql.net/tools/webchart-dbconn-config2.html#comments</comments>
		<pubDate>Fri, 26 Feb 2010 06:47:30 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=741</guid>
		<description><![CDATA[&#160; &#160; 从应用架构角度出发, 为DataReport增加了逻库连接层后, 为了与物理连接层清晰地分开, 就对原来的数据库连接配置作了改动. 由于这儿并不能算是文档, 就贴个配置范例来说明一下了. # WebChart元数据库连接名称 ADMINDB=DEFAULT # 启用的数据库连接 PHYSICAL.DBLIST=ORACLE&#124;MYSQL # 连接参数设置 PHYSICAL.ORACLE.DBTYPE=oracle PHYSICAL.ORACLE.DBHOST=localhost:1521:db10g PHYSICAL.ORACLE.DBUSER=scott PHYSICAL.ORACLE.DBPASS=8500B089B7B516CE PHYSICAL.ORACLE.MAXCONNS=4 PHYSICAL.ORACLE.INITCONNS=1 PHYSICAL.ORACLE.LOCALE=ENGLISH PHYSICAL.MYSQL.DBTYPE=mysql PHYSICAL.MYSQL.DBHOST=localhost:3306/test PHYSICAL.MYSQL.DBUSER= PHYSICAL.MYSQL.DBPASS=1B820063CEA8A955 PHYSICAL.MYSQL.MAXCONNS=4 PHYSICAL.MYSQL.INITCONNS=1 PHYSICAL.MYSQL.LOCALE=ENGLISH LOGICAL.DBLIST=DEFAULT LOGICAL.DEFAULT=RANDOM&#124;ORACLE,MYSQL &#160; &#160; 这个配置可以让DataReport以Oracle或MySQL为数据源, 如果同时有Oracle及MySQL, 则可以随机从Oracle或MySQL中读取数据展示. 在上一个改进后, 所有的Demo页面都已经改成同时支持Oracle和MySQL了, 你可以重新下载软件包进行更新. Relative Posts:2010/02/20 -- 定义不同数据源的SQL (4)2010/01/05 -- DataReport中的FORALL循环 (0)2009/03/17 -- MySQL上的WebChart (0)2010/05/07 -- 批量数据查询需求 (0)2010/03/04 -- [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 从<a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html">应用架构角度</a>出发, 为DataReport增加了逻库连接层后, 为了与物理连接层清晰地分开, 就对原来的<a href="http://www.anysql.net/tools/webchart_dbconn_config.html">数据库连接配置</a>作了改动. 由于这儿并不能算是文档, 就贴个配置范例来说明一下了. </p>
<blockquote class="prefont"><p>
# WebChart元数据库连接名称<br />
ADMINDB=DEFAULT</p>
<p># 启用的数据库连接<br />
PHYSICAL.DBLIST=ORACLE|MYSQL</p>
<p># 连接参数设置<br />
PHYSICAL.ORACLE.DBTYPE=oracle<br />
PHYSICAL.ORACLE.DBHOST=localhost:1521:db10g<br />
PHYSICAL.ORACLE.DBUSER=scott<br />
PHYSICAL.ORACLE.DBPASS=8500B089B7B516CE<br />
PHYSICAL.ORACLE.MAXCONNS=4<br />
PHYSICAL.ORACLE.INITCONNS=1<br />
PHYSICAL.ORACLE.LOCALE=ENGLISH</p>
<p>PHYSICAL.MYSQL.DBTYPE=mysql<br />
PHYSICAL.MYSQL.DBHOST=localhost:3306/test<br />
PHYSICAL.MYSQL.DBUSER=<br />
PHYSICAL.MYSQL.DBPASS=1B820063CEA8A955<br />
PHYSICAL.MYSQL.MAXCONNS=4<br />
PHYSICAL.MYSQL.INITCONNS=1<br />
PHYSICAL.MYSQL.LOCALE=ENGLISH</p>
<p>LOGICAL.DBLIST=DEFAULT<br />
LOGICAL.DEFAULT=RANDOM|ORACLE,MYSQL
</p></blockquote>
<p>&nbsp; &nbsp; 这个配置可以让DataReport以Oracle或MySQL为数据源, 如果同时有Oracle及MySQL, 则可以随机从Oracle或MySQL中读取数据展示. 在<a href="http://www.anysql.net/tools/webchart-multidb-support.html">上一个改进</a>后, 所有的Demo页面都已经改成同时支持Oracle和MySQL了, 你可以重新<a href="http://www.anysql.net/software/webchart.zip">下载软件包</a>进行更新. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2009/03/17 -- <a href="http://www.anysql.net/tools/webchart_mysql_demo.html" title="MySQL上的WebChart">MySQL上的WebChart</a> (0)</li><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/01/26 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess2.html" title="逻辑连接层与物理连接层(2)">逻辑连接层与物理连接层(2)</a> (1)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-dbconn-config2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>定义不同数据源的SQL</title>
		<link>http://www.anysql.net/tools/webchart-multidb-support.html</link>
		<comments>http://www.anysql.net/tools/webchart-multidb-support.html#comments</comments>
		<pubDate>Sat, 20 Feb 2010 06:43:02 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=740</guid>
		<description><![CDATA[&#160; &#160; DataReport的几个演示页面, 有的人喜欢在Oracle上跑, 有的人喜欢在MySQL上跑. 而针对不同的数据源, SQL的写法是不同的, 因此演示页面是和某类数据源绑定的, 给第一次接触DataReport的人带来了一定的困惑. &#160; &#160; 不过现在可以为不同的数据源定义不同的SQL了, 如下所示. WEBCHART.QUERY_1=* WEBCHART.QUERY_ORACLE_1=select &#160; &#160; &#160; to_char(trade_month,&#8217;yyyy/mm&#8217;) month , &#160; &#160; &#160; trade_count count &#160; from trade_monthly_summary &#160; where to_char(trade_month,&#8217;yyyy&#8217;)=&#8217;2008&#8242; &#160; WEBCHART.QUERY_MYSQL_1=select &#160; &#160; &#160; trade_month, &#160; &#160; &#160; trade_count+0 as count &#160; from trade_summary_monthly &#160; where year(trade_month) = 2008 &#160; &#160; 将最上层的SQL定义成星号, [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; DataReport的几个演示页面, 有的人喜欢在Oracle上跑, 有的人喜欢在MySQL上跑. 而针对不同的数据源, SQL的写法是不同的, 因此演示页面是和某类数据源绑定的, 给第一次接触DataReport的人带来了一定的困惑. </p>
<p>&nbsp; &nbsp; 不过现在可以为不同的数据源定义不同的SQL了, 如下所示. </p>
<blockquote class="prefont"><p>
WEBCHART.QUERY_1=*</p>
<p>WEBCHART.QUERY_ORACLE_1=select <br />
&nbsp; &nbsp; &nbsp; to_char(trade_month,&#8217;yyyy/mm&#8217;) month , <br />
&nbsp; &nbsp; &nbsp; trade_count count <br />
&nbsp; from trade_monthly_summary <br />
&nbsp; where to_char(trade_month,&#8217;yyyy&#8217;)=&#8217;2008&#8242;<br />
&nbsp; <br />
WEBCHART.QUERY_MYSQL_1=select <br />
&nbsp; &nbsp; &nbsp; trade_month,<br />
&nbsp; &nbsp; &nbsp; trade_count+0 as count <br />
&nbsp; from trade_summary_monthly <br />
&nbsp; where year(trade_month) = 2008
</p></blockquote>
<p>&nbsp; &nbsp; 将最上层的SQL定义成星号, 这时DataReport会根据数据源的类型, 进行进一步查找, 如果连到Oracle数据库, 就取上面一条SQL语句, 如果连接的是MySQL数据库, 则取下面一条SQL, 进行不同数据源类型的自动匹配, 使得报表定义变得更加灵活. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/26 -- <a href="http://www.anysql.net/tools/webchart-dbconn-config2.html" title="WebChart的DB连接配置2">WebChart的DB连接配置2</a> (0)</li><li>2010/01/26 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess2.html" title="逻辑连接层与物理连接层(2)">逻辑连接层与物理连接层(2)</a> (1)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li><li>2009/12/28 -- <a href="http://www.anysql.net/tools/webchart-one-java-servlet.html" title="统一DataReport的Servlet">统一DataReport的Servlet</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-multidb-support.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>DataReport的Form格式显示</title>
		<link>http://www.anysql.net/tools/webchart-form-data-display.html</link>
		<comments>http://www.anysql.net/tools/webchart-form-data-display.html#comments</comments>
		<pubDate>Thu, 04 Feb 2010 06:11:45 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebCh]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=738</guid>
		<description><![CDATA[&#160; &#160; 一直以来, DataReport都是用表格方式显示多行数据, 当我们查询少量字段数很多的记录时, 就不希望以表格方式显示记录, 而希望以Form格式显示, 如下面显示的员工表的信息. EMPNO 7782 ENAME CLARK JOB MANAGER MGR 7839 HIREDATE 1981-06-09 00:00:00.0 SAL 2450 COMM &#160; DEPTNO 10 EMPNO 7839 ENAME KING JOB PRESIDENT MGR &#160; HIREDATE 1981-11-17 00:00:00.0 SAL 5000 COMM &#160; DEPTNO 10 &#160; &#160; 实现这个功能, 并没有修改任何一行代码, 只是改了一下控制显示格式的XSL文件, 然后在报表定义文件中加入一行. WEBCHART.XMLATTR=form=&#8221;yes&#8221; WEBCHART.QUERY_1=SELECT * FROM EMP WHERE DEPTNO=10 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 一直以来, DataReport都是用表格方式显示多行数据, 当我们查询少量字段数很多的记录时, 就不希望以表格方式显示记录, 而希望以Form格式显示, 如下面显示的员工表的信息. </p>
<blockquote>
<table border="1" width="510" cellspacing="0" cellpadding="2">
<caption align="center">
<font size="5"></font><br />
</caption>
<tr>
<td width="20%" align="center">EMPNO</td>
<td>7782</td>
</tr>
<tr>
<td width="20%" align="center">ENAME</td>
<td>CLARK</td>
</tr>
<tr>
<td width="20%" align="center">JOB</td>
<td>MANAGER</td>
</tr>
<tr>
<td width="20%" align="center">MGR</td>
<td>7839</td>
</tr>
<tr>
<td width="20%" align="center">HIREDATE</td>
<td>1981-06-09 00:00:00.0</td>
</tr>
<tr>
<td width="20%" align="center">SAL</td>
<td>2450</td>
</tr>
<tr>
<td width="20%" align="center">COMM</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="20%" align="center">DEPTNO</td>
<td>10</td>
</tr>
<tr>
<td colspan="2" align="center">

</td>
</tr>
<tr>
<td width="20%" align="center">EMPNO</td>
<td>7839</td>
</tr>
<tr>
<td width="20%" align="center">ENAME</td>
<td>KING</td>
</tr>
<tr>
<td width="20%" align="center">JOB</td>
<td>PRESIDENT</td>
</tr>
<tr>
<td width="20%" align="center">MGR</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="20%" align="center">HIREDATE</td>
<td>1981-11-17 00:00:00.0</td>
</tr>
<tr>
<td width="20%" align="center">SAL</td>
<td>5000</td>
</tr>
<tr>
<td width="20%" align="center">COMM</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="20%" align="center">DEPTNO</td>
<td>10</td>
</tr>
</table>
</blockquote>
<p>&nbsp; &nbsp; 实现这个功能, 并没有修改任何一行代码, 只是改了一下控制显示格式的<a href="http://www.anysql.net/doc/default.xsl">XSL文件</a>, 然后在报表定义文件中加入一行. </p>
<blockquote class="prefont"><p>
WEBCHART.XMLATTR=form=&#8221;yes&#8221;<br />
WEBCHART.QUERY_1=SELECT * FROM EMP WHERE DEPTNO=10
</p></blockquote>
<p>&nbsp; &nbsp; 想要更丰富的格式, 只需要再改进一下XSL文件即可, 不需要修改Java代码, 不过这需要你对XML和XSLT比较熟悉. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li><li>2009/12/28 -- <a href="http://www.anysql.net/tools/webchart-one-java-servlet.html" title="统一DataReport的Servlet">统一DataReport的Servlet</a> (2)</li><li>2009/12/02 -- <a href="http://www.anysql.net/tools/webchart-xml-html-escape-chars.html" title="添加URL/HTML字符转义功能">添加URL/HTML字符转义功能</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-form-data-display.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>逻辑连接层与物理连接层(2)</title>
		<link>http://www.anysql.net/tools/webchart-logical-dbaccess2.html</link>
		<comments>http://www.anysql.net/tools/webchart-logical-dbaccess2.html#comments</comments>
		<pubDate>Tue, 26 Jan 2010 12:11:19 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=735</guid>
		<description><![CDATA[&#160; &#160; 上一次只想到了逻辑逻辑层和物理连接层之间的三种关系, 等价(FIRST), 随机(RANDOM), 顺序(FAILOVER). 其实后面一直在思考, 阅读了一些相关文章, 糊思乱想了一通后, 又增加了两种访问方式. &#160; &#160; 按位置(POSITION)访问, 指程序提供一个标识位置的数, 然后与逻辑连接层的连接源数目进行取余操作, 根据余数来获取指定位置的数据源. 继续上一次中的四个MySQL的例子, 我们创建如下逻辑连接, 在访问时如果提供的值是5, 则最后取到的是5余4的位置, 即SLAVE1. LOGICAL.DEFAULT=POSITION&#124;MASTER,SLAVE1,SLAVE2,SLAVE3 &#160; &#160; 按范围(RANGE)访问, 指程序提供一个标识位置的数, 然后与逻辑连接层的连接数据源进行比较操作, 按顺序找到指定位置的数据源. 继续上一次中的四个MySQL的例子, 我们创建如下逻辑连接, 在访问时如果提供的值是250, 则最后取到的是小于300的位置, 即SLAVE2. 同前面的按位置相比, 这个可以在增减数据源时, 将影响控制得更好. LOGICAL.DEFAULT=POSITION&#124;MASTER,SLAVE1,SLAVE2,SLAVE3 LOGICAL.DEFAULT.VALUES=100,200,300,400 &#160; &#160; 在程序中, 可以根据业务特色提供这个标识位置的数, 然后在JDBC的访问URL中提供这个值, 访问代码如下所示. try { &#160; Connection db = DriverManager.getConnection(&#8220;jdbc:anysql:default/250&#8243;, null); &#160; &#8230;&#8230; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html">上一次</a>只想到了逻辑逻辑层和物理连接层之间的三种关系, 等价(FIRST), 随机(RANDOM), 顺序(FAILOVER). 其实后面一直在思考, 阅读了一些相关文章, 糊思乱想了一通后, 又增加了两种访问方式. </p>
<p>&nbsp; &nbsp; 按位置(POSITION)访问, 指程序提供一个标识位置的数, 然后与逻辑连接层的连接源数目进行取余操作, 根据余数来获取指定位置的数据源. 继续上一次中的四个MySQL的例子, 我们创建如下逻辑连接, 在访问时如果提供的值是5, 则最后取到的是5余4的位置, 即SLAVE1. </p>
<blockquote class="prefont"><p>
LOGICAL.DEFAULT=POSITION|MASTER,SLAVE1,SLAVE2,SLAVE3
</p></blockquote>
<p>&nbsp; &nbsp; 按范围(RANGE)访问, 指程序提供一个标识位置的数, 然后与逻辑连接层的连接数据源进行比较操作, 按顺序找到指定位置的数据源. 继续上一次中的四个MySQL的例子, 我们创建如下逻辑连接, 在访问时如果提供的值是250, 则最后取到的是小于300的位置, 即SLAVE2. 同前面的按位置相比, 这个可以在增减数据源时, 将影响控制得更好.</p>
<blockquote class="prefont"><p>
LOGICAL.DEFAULT=POSITION|MASTER,SLAVE1,SLAVE2,SLAVE3<br />
LOGICAL.DEFAULT.VALUES=100,200,300,400
</p></blockquote>
<p>&nbsp; &nbsp; 在程序中, 可以根据业务特色提供这个标识位置的数, 然后在JDBC的访问URL中提供这个值, 访问代码如下所示. </p>
<blockquote class="prefont"><p>
try {<br />
&nbsp; Connection db = DriverManager.getConnection(&#8220;jdbc:anysql:default/250&#8243;, null);<br />
&nbsp; &#8230;&#8230;<br />
&nbsp; db.close();<br />
}<br />
catch (SQLException sqle) <br />
{<br />
&nbsp; &#8230;&#8230;<br />
}
</p></blockquote>
<p>&nbsp; &nbsp; 接下来当然还会思考有没有新的方式了, 有了这些访问方式, 进一步抽像一下, 可以看看能不能将数据库当成一个磁盘(Database as Disk)来看, 写一个弱弱的DatabaseRaid类在实验室玩玩数据冗余. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/26 -- <a href="http://www.anysql.net/tools/webchart-dbconn-config2.html" title="WebChart的DB连接配置2">WebChart的DB连接配置2</a> (0)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li><li>2009/12/28 -- <a href="http://www.anysql.net/tools/webchart-one-java-servlet.html" title="统一DataReport的Servlet">统一DataReport的Servlet</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-logical-dbaccess2.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AnySQL JDBC Driver</title>
		<link>http://www.anysql.net/tools/anysql-jdbc-driver.html</link>
		<comments>http://www.anysql.net/tools/anysql-jdbc-driver.html#comments</comments>
		<pubDate>Thu, 21 Jan 2010 07:55:43 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=734</guid>
		<description><![CDATA[&#160; &#160; 上一篇中的逻辑连接层, 通过一个DBLogicalManager类来实现, 并不是标准的JDBC调用方式, 如果要使现有的程序能很快用上这个功能, 要么更改程序, 要么就去实现一个JDBC Driver类, 让程序透明化. 显然第二种方法很好, 于是就写一个AnySQL JDBC Driver类吧. &#160; &#160; JDBC Driver的类名为: com.lfx.db.AnySQLDriver &#160; &#160; 使用这个类时, 需要传入一个保存连接配置信息(逻辑库, 物理库)的文件, 只要创建一个类实例就行了. new com.lfx.db.AnySQLDriver(Sting config_file); &#160; &#160; 接下来就可以用标准的JDBC来获得逻辑库的连接了, URL规则为: jdbc:anysql:logical_database_name &#160; &#160; 比如在批处理中, 要从上一篇的三个Slave库中的一个读取一条记录, 就可以使用如下代码. try { &#160; Connection db = DriverManager.getConnection(&#8220;jdbc:anysql:readdb&#8221;, null); &#160; &#8230;&#8230; &#160; db.close(); } catch (SQLException sqle) { [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 上一篇中的逻辑连接层, 通过一个DBLogicalManager类来实现, 并不是标准的JDBC调用方式, 如果要使现有的程序能很快用上这个功能, 要么更改程序, 要么就去实现一个JDBC Driver类, 让程序透明化. 显然第二种方法很好, 于是就写一个AnySQL JDBC Driver类吧. </p>
<p>&nbsp; &nbsp; JDBC Driver的类名为: </p>
<blockquote class="prefont"><p>
com.lfx.db.AnySQLDriver
</p></blockquote>
<p>&nbsp; &nbsp; 使用这个类时, 需要传入一个保存连接配置信息(逻辑库, 物理库)的文件, 只要创建一个类实例就行了. </p>
<blockquote class="prefont"><p>
new com.lfx.db.AnySQLDriver(Sting config_file);
</p></blockquote>
<p>&nbsp; &nbsp; 接下来就可以用标准的JDBC来获得逻辑库的连接了, URL规则为: </p>
<blockquote class="prefont"><p>
jdbc:anysql:logical_database_name
</p></blockquote>
<p>&nbsp; &nbsp; 比如在批处理中, 要从上一篇的三个Slave库中的一个读取一条记录, 就可以使用如下代码. </p>
<blockquote class="prefont"><p>
try {<br />
&nbsp; Connection db = DriverManager.getConnection(&#8220;jdbc:anysql:readdb&#8221;, null);<br />
&nbsp; &#8230;&#8230;<br />
&nbsp; db.close();<br />
}<br />
catch (SQLException sqle) <br />
{<br />
&nbsp; &#8230;&#8230;<br />
}
</p></blockquote>
<p>&nbsp; &nbsp; 现在还没有真正投入使用, 只在实验室中测试了一下, 感觉上还可以. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/02/26 -- <a href="http://www.anysql.net/anysql/anysql_db_query.html" title="AnySQL DB查询组件">AnySQL DB查询组件</a> (0)</li><li>2009/01/14 -- <a href="http://www.anysql.net/developer/webchart_excel.html" title="WebChart的Excel导出">WebChart的Excel导出</a> (4)</li><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/26 -- <a href="http://www.anysql.net/tools/webchart-dbconn-config2.html" title="WebChart的DB连接配置2">WebChart的DB连接配置2</a> (0)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/26 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess2.html" title="逻辑连接层与物理连接层(2)">逻辑连接层与物理连接层(2)</a> (1)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/anysql-jdbc-driver.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>逻辑连接层与物理连接层</title>
		<link>http://www.anysql.net/tools/webchart-logical-dbaccess.html</link>
		<comments>http://www.anysql.net/tools/webchart-logical-dbaccess.html#comments</comments>
		<pubDate>Wed, 20 Jan 2010 08:52:27 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=733</guid>
		<description><![CDATA[&#160; &#160; 为了更好地利用MySQL的廉价复制(Slave)功能, 在DataReport的数据库连接层中增加了逻辑连接层, 原来是直接指定物理边接层. 当然数据库连接池还是在物理连接层实现的, 逻辑连接层则可以指定一种关系, 然后根据关系来获得指定的数据库物理连接, 当应用使用逻辑连接层来访问时, 其实是自动根据关系挑选一个物理连接. &#160; &#160; 还是举一个例子来说明一下, 比如你有一台主MySQL库(master)后面挂了三台从MySQL库(Slave), 然后用DataReport去搭建一个以读为主的应用, 希望DataReport能首先随机挑选三个Slave库中的一台进行读取, 如果三台Slave都不行, 则从Master进行读取. &#160; &#160; 首先定义四台MySQL数据库的连接, 称为物理层的配置. PHYSICAL.DBLIST=MASTER&#124;SLAVE1&#124;SLAVE2&#124;SLAVE3 &#160; &#160; 然后定义逻辑连接层, 以实现上面的要求. LOGICAL.DBLIST=writedb&#124;slavedb&#124;readdb LOGICAL.WRITEDB=FIRST&#124;MASTER LOGICAL.SLAVEDB=RANDOM&#124;SLAVE1,SLAVE2,SLAVE3 LOGICAL.READDB=FAILOVER&#124;SLAVEDB,WRITEDB &#160; &#160; 其中FIRST表示读取第一个连接池, RANDOM表示从后面的连接中随机选一个, FAILOVER表示第一个失败的话，取下一个. 通过这三种关系, 就实现了我们的要求. 然后给物理连接池及每个逻辑连接都加上状态判断, 当遇到连接关闭的错误时, 就将相应的连接池标记为不可用(Markdown), 逻辑库层可以主动跳过已经被Markdown的下一级节点, 按照规则查找到一个可用的物理数据库连接. &#160; &#160; 在DataReport中还设置了一个守护进程, 会每分钟检查各个Markdown的物理连接池, 偿试去Markup, 一当出现意外的物理库回到正常状态, 就可以提供服务, 使应用保持高可用状态. Relative Posts:2010/05/07 -- 批量数据查询需求 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 为了更好地利用MySQL的廉价复制(Slave)功能, 在DataReport的数据库连接层中增加了逻辑连接层, 原来是直接指定物理边接层. 当然数据库连接池还是在物理连接层实现的, 逻辑连接层则可以指定一种关系, 然后根据关系来获得指定的数据库物理连接, 当应用使用逻辑连接层来访问时, 其实是自动根据关系挑选一个物理连接. </p>
<p>&nbsp; &nbsp; 还是举一个例子来说明一下, 比如你有一台主MySQL库(master)后面挂了三台从MySQL库(Slave), 然后用DataReport去搭建一个以读为主的应用, 希望DataReport能首先随机挑选三个Slave库中的一台进行读取, 如果三台Slave都不行, 则从Master进行读取. </p>
<p>&nbsp; &nbsp; 首先定义四台MySQL数据库的连接, 称为物理层的配置. </p>
<blockquote class="prefont"><p>
PHYSICAL.DBLIST=MASTER|SLAVE1|SLAVE2|SLAVE3
</p></blockquote>
<p>&nbsp; &nbsp; 然后定义逻辑连接层, 以实现上面的要求. </p>
<blockquote class="prefont"><p>
LOGICAL.DBLIST=writedb|slavedb|readdb<br />
LOGICAL.WRITEDB=FIRST|MASTER<br />
LOGICAL.SLAVEDB=RANDOM|SLAVE1,SLAVE2,SLAVE3<br />
LOGICAL.READDB=FAILOVER|SLAVEDB,WRITEDB
</p></blockquote>
<p>&nbsp; &nbsp; 其中FIRST表示读取第一个连接池, RANDOM表示从后面的连接中随机选一个, FAILOVER表示第一个失败的话，取下一个. 通过这三种关系, 就实现了我们的要求. 然后给物理连接池及每个逻辑连接都加上状态判断, 当遇到连接关闭的错误时, 就将相应的连接池标记为不可用(Markdown), 逻辑库层可以主动跳过已经被Markdown的下一级节点, 按照规则查找到一个可用的物理数据库连接.</p>
<p>&nbsp; &nbsp; 在DataReport中还设置了一个守护进程, 会每分钟检查各个Markdown的物理连接池, 偿试去Markup, 一当出现意外的物理库回到正常状态, 就可以提供服务, 使应用保持高可用状态. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li><li>2009/12/28 -- <a href="http://www.anysql.net/tools/webchart-one-java-servlet.html" title="统一DataReport的Servlet">统一DataReport的Servlet</a> (2)</li><li>2009/12/02 -- <a href="http://www.anysql.net/tools/webchart-xml-html-escape-chars.html" title="添加URL/HTML字符转义功能">添加URL/HTML字符转义功能</a> (1)</li><li>2009/09/21 -- <a href="http://www.anysql.net/tools/four-extra-businees-charts.html" title="多支持了四种业务图">多支持了四种业务图</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-logical-dbaccess.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>DataReport中的超级表达式</title>
		<link>http://www.anysql.net/tools/webchart-super-expression.html</link>
		<comments>http://www.anysql.net/tools/webchart-super-expression.html#comments</comments>
		<pubDate>Fri, 08 Jan 2010 11:08:32 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=730</guid>
		<description><![CDATA[&#160; &#160; 将部份报表从Oracle迁到MySQL中时, 发现要在MySQL中实现Oracle的分析函数功能, 解决诸如&#8221;每个员工在各自部门中按工资降序排列的名次&#8221;等问题, 在Oracle中我们以用&#8221;rank() over (partition by deptno order by sal desc)&#8221;这样的语句来实现, 可这个在MySQL中怎么实现? SQL实在难写. &#160; &#160; 这样的需求还是有一定的通用性的, 不如放到客户端来计算, 在DataReport中实现它吧! 下面这个报表的后台数据库是在MySQL上的, 先猜猜是如何完成的. empno ename job sal deptno Pecent Rank 7782 CLARK MANAGER 2450.0 10 28 2 7839 KING PRESSIDEN 5000.0 57.1429 1 7934 MILLER CLERK 1300.0 14.8571 3 7369 SSMITH CLERK 800.0 20 7.3563 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 将部份报表从Oracle迁到MySQL中时, 发现要在MySQL中实现Oracle的分析函数功能, 解决诸如&#8221;每个员工在各自部门中按工资降序排列的名次&#8221;等问题, 在Oracle中我们以用&#8221;rank() over (partition by deptno order by sal desc)&#8221;这样的语句来实现, 可这个在MySQL中怎么实现? SQL实在难写. </p>
<p>&nbsp; &nbsp; 这样的需求还是有一定的通用性的, 不如放到客户端来计算, 在DataReport中实现它吧! 下面这个报表的后台数据库是在MySQL上的, 先猜猜是如何完成的. </p>
<blockquote>
<table border="1" width="540" cellspacing="0" cellpadding="2">
<caption align="center">
<font size="5"></font><br />
</caption>
<tr>
<th width="10%">empno</th>
<th width="15%">ename</th>
<th width="22%">job</th>
<th width="15%">sal</th>
<th width="10%">deptno</th>
<th width="17%">Pecent</th>
<th width="10%">Rank</th>
</tr>
<tr>
<td bgcolor="#eeeeee" align="right">7782</td>
<td bgcolor="#eeeeee" align="center">CLARK</td>
<td bgcolor="#eeeeee" align="left">MANAGER</td>
<td bgcolor="#eeeeee" align="right">2450.0</td>
<td rowspan="3" align="right">10</td>
<td bgcolor="#eeeeee" align="right">28</td>
<td bgcolor="#eeeeee" align="right">2</td>
</tr>
<tr>
<td align="right">7839</td>
<td align="center">KING</td>
<td align="left">PRESSIDEN</td>
<td align="right">5000.0</td>
<td align="right">57.1429</td>
<td align="right">1</td>
</tr>
<tr>
<td bgcolor="#eeeeee" align="right">7934</td>
<td bgcolor="#eeeeee" align="center">MILLER</td>
<td bgcolor="#eeeeee" align="left">CLERK</td>
<td bgcolor="#eeeeee" align="right">1300.0</td>
<td bgcolor="#eeeeee" align="right">14.8571</td>
<td bgcolor="#eeeeee" align="right">3</td>
</tr>
<tr>
<td align="right">7369</td>
<td align="center">SSMITH</td>
<td align="left">CLERK</td>
<td align="right">800.0</td>
<td rowspan="5" align="right">20</td>
<td align="right">7.3563</td>
<td align="right">5</td>
</tr>
<tr>
<td bgcolor="#eeeeee" align="right">7566</td>
<td bgcolor="#eeeeee" align="center">JONESS</td>
<td bgcolor="#eeeeee" align="left">MANAGER</td>
<td bgcolor="#eeeeee" align="right">2975.0</td>
<td bgcolor="#eeeeee" align="right">27.3563</td>
<td bgcolor="#eeeeee" align="right">3</td>
</tr>
<tr>
<td align="right">7788</td>
<td align="center">SSCOTT</td>
<td align="left">ANALYSST</td>
<td align="right">3000.0</td>
<td align="right">27.5862</td>
<td align="right">1</td>
</tr>
<tr>
<td bgcolor="#eeeeee" align="right">7876</td>
<td bgcolor="#eeeeee" align="center">ADAMSS</td>
<td bgcolor="#eeeeee" align="left">CLERK</td>
<td bgcolor="#eeeeee" align="right">1100.0</td>
<td bgcolor="#eeeeee" align="right">10.1149</td>
<td bgcolor="#eeeeee" align="right">4</td>
</tr>
<tr>
<td align="right">7902</td>
<td align="center">FORD</td>
<td align="left">ANALYSST</td>
<td align="right">3000.0</td>
<td align="right">27.5862</td>
<td align="right">2</td>
</tr>
<tr>
<td bgcolor="#eeeeee" align="right">7499</td>
<td bgcolor="#eeeeee" align="center">ALLEN</td>
<td bgcolor="#eeeeee" align="left">SSALESSMA</td>
<td bgcolor="#eeeeee" align="right">1600.0</td>
<td rowspan="6" align="right">30</td>
<td bgcolor="#eeeeee" align="right">17.0213</td>
<td bgcolor="#eeeeee" align="right">2</td>
</tr>
<tr>
<td align="right">7521</td>
<td align="center">WARD</td>
<td align="left">SSALESSMA</td>
<td align="right">1250.0</td>
<td align="right">13.2979</td>
<td align="right">5</td>
</tr>
<tr>
<td bgcolor="#eeeeee" align="right">7654</td>
<td bgcolor="#eeeeee" align="center">MARTIN</td>
<td bgcolor="#eeeeee" align="left">SSALESSMA</td>
<td bgcolor="#eeeeee" align="right">1250.0</td>
<td bgcolor="#eeeeee" align="right">13.2979</td>
<td bgcolor="#eeeeee" align="right">4</td>
</tr>
<tr>
<td align="right">7698</td>
<td align="center">BLAKE</td>
<td align="left">MANAGER</td>
<td align="right">2850.0</td>
<td align="right">30.3191</td>
<td align="right">1</td>
</tr>
<tr>
<td bgcolor="#eeeeee" align="right">7844</td>
<td bgcolor="#eeeeee" align="center">TURNER</td>
<td bgcolor="#eeeeee" align="left">SSALESSMA</td>
<td bgcolor="#eeeeee" align="right">1500.0</td>
<td bgcolor="#eeeeee" align="right">15.9574</td>
<td bgcolor="#eeeeee" align="right">3</td>
</tr>
<tr>
<td align="right">7900</td>
<td align="center">JAMESS</td>
<td align="left">CLERK</td>
<td align="right">950.0</td>
<td align="right">10.1064</td>
<td align="right">6</td>
</tr>
</table>
</blockquote>
<p>&nbsp; &nbsp; 所用的SQL只是非常简单的SELECT语句. </p>
<blockquote class="prefont"><p>
select <br />
&nbsp; &nbsp; &nbsp; &nbsp; empno, ename, job, sal, deptno <br />
&nbsp; &nbsp; from emp_his order by deptno
</p></blockquote>
<p>&nbsp; &nbsp; 在报表定义文件中, 定义了两个虚拟列, 指定表达式, 就完成这个工作了. </p>
<blockquote class="prefont"><p>
webchart.express_1=Pecent|100*x/y|sal,sum::sal|deptno<br />
&nbsp; &nbsp; Rank|x|rnk::sal|deptno<br />
webchart.merge_1=deptno
</p></blockquote>
<p>&nbsp; &nbsp; 这样在不同的数据库之间迁移起来就简单多了, DataReport中已经实现了&#8221;min, max, sum, avg, cnt, row, rnk&#8221;这七个计算公式. 虽然功能很好, 但实现的逻辑并没有优化, 处理大量数据估计不行, 但一个页面上的少量数据, 应当没有什么问题. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li><li>2009/12/28 -- <a href="http://www.anysql.net/tools/webchart-one-java-servlet.html" title="统一DataReport的Servlet">统一DataReport的Servlet</a> (2)</li><li>2009/12/02 -- <a href="http://www.anysql.net/tools/webchart-xml-html-escape-chars.html" title="添加URL/HTML字符转义功能">添加URL/HTML字符转义功能</a> (1)</li><li>2009/09/21 -- <a href="http://www.anysql.net/tools/four-extra-businees-charts.html" title="多支持了四种业务图">多支持了四种业务图</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-super-expression.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DataReport的重复值合并</title>
		<link>http://www.anysql.net/tools/webchart-merge-dup-values.html</link>
		<comments>http://www.anysql.net/tools/webchart-merge-dup-values.html#comments</comments>
		<pubDate>Fri, 08 Jan 2010 03:04:33 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=729</guid>
		<description><![CDATA[&#160; &#160; DataReport的GROUP功能可以对左边的指定列进行重复值合并, 对于右边的列无能为力, 当我们在查询员工表时, 页面显示如下. EMPNO ENAME JOB SAL DEPTNO 7782 CLARK MANAGER 2450 10 7839 KING PRESIDENT 5000 10 7934 MILLER CLERK 1300 10 7369 SMITH CLERK 800 20 7566 JONES MANAGER 2975 20 7902 FORD ANALYST 3000 20 7499 ALLEN SALESMAN 1600 30 7521 WARD SALESMAN 1250 30 7654 MARTIN SALESMAN 1250 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; DataReport的GROUP功能可以对左边的指定列进行重复值合并, 对于右边的列无能为力, 当我们在查询员工表时, 页面显示如下. </p>
<blockquote>
<table border="1" width="540" cellspacing="0" cellpadding="2">
<caption align="center">
<font size="5"></font><br />
</caption>
<tr>
<th width="14%">EMPNO</th>
<th width="22%">ENAME</th>
<th width="33%">JOB</th>
<th width="14%">SAL</th>
<th width="14%">DEPTNO</th>
</tr>
<tr>
<td align="right">7782</td>
<td align="center">CLARK</td>
<td bgcolor="#eeeeee" align="left">MANAGER</td>
<td bgcolor="#eeeeee" align="right">2450</td>
<td bgcolor="#eeeeee" align="right">10</td>
</tr>
<tr>
<td align="right">7839</td>
<td align="center">KING</td>
<td align="left">PRESIDENT</td>
<td align="right">5000</td>
<td align="right">10</td>
</tr>
<tr>
<td align="right">7934</td>
<td align="center">MILLER</td>
<td bgcolor="#eeeeee" align="left">CLERK</td>
<td bgcolor="#eeeeee" align="right">1300</td>
<td bgcolor="#eeeeee" align="right">10</td>
</tr>
<tr>
<td align="right">7369</td>
<td align="center">SMITH</td>
<td align="left">CLERK</td>
<td align="right">800</td>
<td align="right">20</td>
</tr>
<tr>
<td align="right">7566</td>
<td align="center">JONES</td>
<td bgcolor="#eeeeee" align="left">MANAGER</td>
<td bgcolor="#eeeeee" align="right">2975</td>
<td bgcolor="#eeeeee" align="right">20</td>
</tr>
<tr>
<td align="right">7902</td>
<td align="center">FORD</td>
<td align="left">ANALYST</td>
<td align="right">3000</td>
<td align="right">20</td>
</tr>
<tr>
<td align="right">7499</td>
<td align="center">ALLEN</td>
<td bgcolor="#eeeeee" align="left">SALESMAN</td>
<td bgcolor="#eeeeee" align="right">1600</td>
<td bgcolor="#eeeeee" align="right">30</td>
</tr>
<tr>
<td align="right">7521</td>
<td align="center">WARD</td>
<td align="left">SALESMAN</td>
<td align="right">1250</td>
<td align="right">30</td>
</tr>
<tr>
<td align="right">7654</td>
<td align="center">MARTIN</td>
<td bgcolor="#eeeeee" align="left">SALESMAN</td>
<td bgcolor="#eeeeee" align="right">1250</td>
<td bgcolor="#eeeeee" align="right">30</td>
</tr>
<tr>
<td align="right">7698</td>
<td align="center">BLAKE</td>
<td align="left">MANAGER</td>
<td align="right">2850</td>
<td align="right">30</td>
</tr>
<tr>
<td align="right">7844</td>
<td align="center">TURNER</td>
<td bgcolor="#eeeeee" align="left">SALESMAN</td>
<td bgcolor="#eeeeee" align="right">1500</td>
<td bgcolor="#eeeeee" align="right">30</td>
</tr>
<tr>
<td align="right">7900</td>
<td align="center">JAMES</td>
<td align="left">CLERK</td>
<td align="right">950</td>
<td align="right">30</td>
</tr>
</table>
</blockquote>
<p>&nbsp; &nbsp; 也许我们更希望, 最右边的部门号字段进行复值合并, 得到如下输出. </p>
<blockquote>
<table border="1" width="540" cellspacing="0" cellpadding="2">
<caption align="center">
<font size="5"></font><br />
</caption>
<tr>
<th width="14%">EMPNO</th>
<th width="22%">ENAME</th>
<th width="33%">JOB</th>
<th width="14%">SAL</th>
<th width="14%">DEPTNO</th>
</tr>
<tr>
<td align="right">7782</td>
<td align="center">CLARK</td>
<td bgcolor="#eeeeee" align="left">MANAGER</td>
<td bgcolor="#eeeeee" align="right">2450</td>
<td rowspan="3" align="right">10</td>
</tr>
<tr>
<td align="right">7839</td>
<td align="center">KING</td>
<td align="left">PRESIDENT</td>
<td align="right">5000</td>
</tr>
<tr>
<td align="right">7934</td>
<td align="center">MILLER</td>
<td bgcolor="#eeeeee" align="left">CLERK</td>
<td bgcolor="#eeeeee" align="right">1300</td>
</tr>
<tr>
<td align="right">7369</td>
<td align="center">SMITH</td>
<td align="left">CLERK</td>
<td align="right">800</td>
<td rowspan="3" align="right">20</td>
</tr>
<tr>
<td align="right">7566</td>
<td align="center">JONES</td>
<td bgcolor="#eeeeee" align="left">MANAGER</td>
<td bgcolor="#eeeeee" align="right">2975</td>
</tr>
<tr>
<td align="right">7902</td>
<td align="center">FORD</td>
<td align="left">ANALYST</td>
<td align="right">3000</td>
</tr>
<tr>
<td align="right">7499</td>
<td align="center">ALLEN</td>
<td bgcolor="#eeeeee" align="left">SALESMAN</td>
<td bgcolor="#eeeeee" align="right">1600</td>
<td rowspan="6" align="right">30</td>
</tr>
<tr>
<td align="right">7521</td>
<td align="center">WARD</td>
<td align="left">SALESMAN</td>
<td align="right">1250</td>
</tr>
<tr>
<td align="right">7654</td>
<td align="center">MARTIN</td>
<td bgcolor="#eeeeee" align="left">SALESMAN</td>
<td bgcolor="#eeeeee" align="right">1250</td>
</tr>
<tr>
<td align="right">7698</td>
<td align="center">BLAKE</td>
<td align="left">MANAGER</td>
<td align="right">2850</td>
</tr>
<tr>
<td align="right">7844</td>
<td align="center">TURNER</td>
<td bgcolor="#eeeeee" align="left">SALESMAN</td>
<td bgcolor="#eeeeee" align="right">1500</td>
</tr>
<tr>
<td align="right">7900</td>
<td align="center">JAMES</td>
<td align="left">CLERK</td>
<td align="right">950</td>
</tr>
</table>
</blockquote>
<p>&nbsp; &nbsp; 在DataReport中现在可以做到了, 只需要指定要进行合并处理的列, 用如下标记. </p>
<blockquote class="prefont"><p>
WEBCHART.MERGE_n=col1|col2|&#8230;
</p></blockquote>
<p>&nbsp; &nbsp; 如果你有网页查询系统要开发, 可以试试免费的<a href="http://www.anysql.net/tag/WebChart">DataReport</a>软件. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li><li>2009/12/28 -- <a href="http://www.anysql.net/tools/webchart-one-java-servlet.html" title="统一DataReport的Servlet">统一DataReport的Servlet</a> (2)</li><li>2009/12/02 -- <a href="http://www.anysql.net/tools/webchart-xml-html-escape-chars.html" title="添加URL/HTML字符转义功能">添加URL/HTML字符转义功能</a> (1)</li><li>2009/09/21 -- <a href="http://www.anysql.net/tools/four-extra-businees-charts.html" title="多支持了四种业务图">多支持了四种业务图</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-merge-dup-values.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DataReport中的FORALL循环</title>
		<link>http://www.anysql.net/tools/webchart-forall-loop.html</link>
		<comments>http://www.anysql.net/tools/webchart-forall-loop.html#comments</comments>
		<pubDate>Tue, 05 Jan 2010 13:20:35 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=728</guid>
		<description><![CDATA[&#160; &#160; 在某个项目中上了10台MySQL数据库, 编写了几段脚本收集了MySQL及主机的性能信息, 如CPU利用率, 系统负载, MySQL中的事务数, 查询数量等. 在使用DataReport编写一个页面展示10个Master库的负载信息时, 发现要写很多的SQL语句, 比较繁硕, 若有调整, 更加麻烦. WEBCHART.QUERY_1=select &#8230; from mysql_load where host=&#8217;mysql1&#8242; WEBCHART.QUERY_2=select &#8230; from mysql_load where host=&#8217;mysql1&#8242; WEBCHART.QUERY_3=select &#8230; from mysql_load where host=&#8217;mysql1&#8242; &#8230;&#8230; WEBCHART.QUERY_10=select &#8230; from mysql_load where host=&#8217;mysql1&#8242; &#160; &#160; 同事数次询问有没有循环的功能, 以减轻DataReport页面编写的任务, 经过几番思量, 为其增加了FORALL循环功能. WEBCHART.FORALL_n= var1=var1 value 1; var2=var2 value 1 &#160; &#160; &#160; var1=var1 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 在某个项目中上了10台MySQL数据库, 编写了几段脚本收集了MySQL及主机的性能信息, 如CPU利用率, 系统负载, MySQL中的事务数, 查询数量等. 在使用DataReport编写一个页面展示10个Master库的负载信息时, 发现要写很多的SQL语句, 比较繁硕, 若有调整, 更加麻烦. </p>
<blockquote class="prefont"><p>
WEBCHART.QUERY_1=select &#8230; from mysql_load where host=&#8217;mysql1&#8242;<br />
WEBCHART.QUERY_2=select &#8230; from mysql_load where host=&#8217;mysql1&#8242;<br />
WEBCHART.QUERY_3=select &#8230; from mysql_load where host=&#8217;mysql1&#8242;<br />
&#8230;&#8230;<br />
WEBCHART.QUERY_10=select &#8230; from mysql_load where host=&#8217;mysql1&#8242;
</p></blockquote>
<p>&nbsp; &nbsp; 同事数次询问有没有循环的功能, 以减轻DataReport页面编写的任务, 经过几番思量, 为其增加了FORALL循环功能. </p>
<blockquote class="prefont"><p>
WEBCHART.FORALL_n= var1=var1 value 1; var2=var2 value 1<br />
&nbsp; &nbsp; &nbsp;  var1=var1 value 2; var2=var2 value 2<br />
&nbsp; &nbsp; &nbsp;  &#8230;&#8230;<br />
&nbsp; &nbsp; &nbsp;  var1=var1 value n; var2=var2 value n
</p></blockquote>
<p>&nbsp; &nbsp; 对于FORALL标记的每一行, 都会执行一次第n个定义的循环处理, 比如下面的页面定义. </p>
<blockquote class="prefont"><p>
webchart.xsldoc=xsl/default.xsl</p>
<p>webchart.forall_1=dno=10; title=Dept 10<br />
&nbsp;  dno=20; title=Dept 20<br />
&nbsp;  dno=30; title=Dept 30</p>
<p>webchart.query_1=select&nbsp; empno, ename <br />
&nbsp; &nbsp;  from emp <br />
&nbsp; &nbsp;  where deptno = :dno
</p></blockquote>
<p>&nbsp; &nbsp; 就会执行三次对EMP表的查询, 分别列出不同部门的员工编号和员工名字, 有了这个功能后, 使得显示10个MySQL Master数据性能页面的编写变得简单可维护多了. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/26 -- <a href="http://www.anysql.net/tools/webchart-dbconn-config2.html" title="WebChart的DB连接配置2">WebChart的DB连接配置2</a> (0)</li><li>2010/01/26 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess2.html" title="逻辑连接层与物理连接层(2)">逻辑连接层与物理连接层(2)</a> (1)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li><li>2009/12/28 -- <a href="http://www.anysql.net/tools/webchart-one-java-servlet.html" title="统一DataReport的Servlet">统一DataReport的Servlet</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-forall-loop.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DataReport中的Cache为王</title>
		<link>http://www.anysql.net/tools/webchart-page-cache.html</link>
		<comments>http://www.anysql.net/tools/webchart-page-cache.html#comments</comments>
		<pubDate>Tue, 29 Dec 2009 14:22:52 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=726</guid>
		<description><![CDATA[&#160; &#160; DataReport充分发挥了数据库性能数据展示的作用, 不仅展示了核心Oracle数据库的数据, 也展示了众多的MySQL的数据, 并且访问的人数在激增, 其后台数据库压力日增, 访问的速度也慢下来了, 看来好象要增加一台应用服务器了. &#160; &#160; 但Web应用Cache为王, 加机器也解决不了单次访问时间的问题, 不能从根本上解决内部用户体验的问题, 所以为DataReport加上了Cache功能. 使用很简单, 有两个属性可以指定Cache相关属性. WEBCHART.CACHE=cache key WEBCHART.KEEP_CACHE_TIME=expire time in seconds &#160; &#160; 要启用Cache功能, 必须指定第一个参数, 用与指定页面的缓冲KEY, 在这里可以使用表达式方式, 比如我们有一个时间参数(PDAY), 则我们可以指定如下的缓冲KEY, 不同的日期条件会保存成不同的缓冲页面. WEBCHART.CACHE=CACHE_${REQUEST.FILE}_$PDAY &#160; &#160; 有一些Load监控页面, 显示的数据比较多, 每次刷新要比较久的时间, 我们更多时侯只希望看到最近几分钟的数据就行了, 不一定要实时的, 这时可以启用这个功能, 用另一个参数控制页面缓冲过期的时间(默认为5分钟), 如1分钟的过期时间. WEBCHART.KEEP_CACHE_TIME=60 &#160; &#160; 可以在每一个页面进行独立的控制, HTML的内容和图片会一起进行缓存处理, 做了这样的改进之后, 使用起来超级爽. Relative Posts:2010/05/07 -- 批量数据查询需求 (0)2010/03/04 [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; DataReport充分发挥了数据库性能数据展示的作用, 不仅展示了核心Oracle数据库的数据, 也展示了众多的MySQL的数据, 并且访问的人数在激增, 其后台数据库压力日增, 访问的速度也慢下来了, 看来好象要增加一台应用服务器了. </p>
<p>&nbsp; &nbsp; 但Web应用Cache为王, 加机器也解决不了单次访问时间的问题, 不能从根本上解决内部用户体验的问题, 所以为DataReport加上了Cache功能. 使用很简单, 有两个属性可以指定Cache相关属性. </p>
<blockquote class="prefont"><p>
WEBCHART.CACHE=cache key<br />
WEBCHART.KEEP_CACHE_TIME=expire time in seconds
</p></blockquote>
<p>&nbsp; &nbsp; 要启用Cache功能, 必须指定第一个参数, 用与指定页面的缓冲KEY, 在这里可以使用表达式方式, 比如我们有一个时间参数(PDAY), 则我们可以指定如下的缓冲KEY, 不同的日期条件会保存成不同的缓冲页面. </p>
<blockquote class="prefont"><p>
WEBCHART.CACHE=CACHE_${REQUEST.FILE}_$PDAY
</p></blockquote>
<p>&nbsp; &nbsp; 有一些Load监控页面, 显示的数据比较多, 每次刷新要比较久的时间, 我们更多时侯只希望看到最近几分钟的数据就行了, 不一定要实时的, 这时可以启用这个功能, 用另一个参数控制页面缓冲过期的时间(默认为5分钟), 如1分钟的过期时间. </p>
<blockquote class="prefont"><p>
WEBCHART.KEEP_CACHE_TIME=60
</p></blockquote>
<p>&nbsp; &nbsp; 可以在每一个页面进行独立的控制, HTML的内容和图片会一起进行缓存处理, 做了这样的改进之后, 使用起来超级爽. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2009/12/28 -- <a href="http://www.anysql.net/tools/webchart-one-java-servlet.html" title="统一DataReport的Servlet">统一DataReport的Servlet</a> (2)</li><li>2009/12/02 -- <a href="http://www.anysql.net/tools/webchart-xml-html-escape-chars.html" title="添加URL/HTML字符转义功能">添加URL/HTML字符转义功能</a> (1)</li><li>2009/09/21 -- <a href="http://www.anysql.net/tools/four-extra-businees-charts.html" title="多支持了四种业务图">多支持了四种业务图</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-page-cache.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>统一DataReport的Servlet</title>
		<link>http://www.anysql.net/tools/webchart-one-java-servlet.html</link>
		<comments>http://www.anysql.net/tools/webchart-one-java-servlet.html#comments</comments>
		<pubDate>Mon, 28 Dec 2009 04:58:53 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[WebChart]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=725</guid>
		<description><![CDATA[&#160; &#160; 在此以前的DataReport有三个Java Servlet, 分别管理数据展示, 安全登录及在线编辑三个方面, 集成程度不是很好. 周日下了一天的雪, 就利用了这个时间做了一下程序升级, 将三个Servlet合成了一个统一的Servlet, 当然功能没有减少, 全部集成到数据展示这个Servlet中. &#160; &#160; 为了集成安全登录和在线编辑功能, 保留了7个页面, 它们是: syslogin.&#60;FileExtention&#62;&#160; &#8212; Process Login sysloginform.&#60;FileExtention&#62; &#8212; Default Login Page syspassword.&#60;FileExtention&#62;&#160; &#8212; Change Password syspasswordform.&#60;FileExtention&#62; &#8212; Default Password Page syslogout.&#60;FileExtention&#62;&#160; &#8212; Process Logout syseditxsl.&#60;FileExtention&#62;&#160; &#8212; XSLT for online editor page sysedit.&#60;FileExtention&#62;&#160; &#8212; Online Page Editor Page &#160; &#160; 其中&#60;FileExtention&#62;在Java [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 在此以前的DataReport有三个Java Servlet, 分别管理数据展示, 安全登录及在线编辑三个方面, 集成程度不是很好. 周日下了一天的雪, 就利用了这个时间做了一下程序升级, 将三个Servlet合成了一个统一的Servlet, 当然功能没有减少, 全部集成到数据展示这个Servlet中. </p>
<p>&nbsp; &nbsp; 为了集成安全登录和在线编辑功能, 保留了7个页面, 它们是: </p>
<blockquote class="prefont"><p>
syslogin.&lt;FileExtention&gt;&nbsp;  &#8212; Process Login<br />
sysloginform.&lt;FileExtention&gt; &#8212; Default Login Page<br />
syspassword.&lt;FileExtention&gt;&nbsp; &#8212; Change Password <br />
syspasswordform.&lt;FileExtention&gt; &#8212; Default Password Page<br />
syslogout.&lt;FileExtention&gt;&nbsp; &#8212; Process Logout<br />
syseditxsl.&lt;FileExtention&gt;&nbsp; &#8212; XSLT for online editor page<br />
sysedit.&lt;FileExtention&gt;&nbsp; &#8212; Online Page Editor Page
</p></blockquote>
<p>&nbsp; &nbsp; 其中&lt;FileExtention&gt;在Java Web应用的配置文件中指定, 经此改进后的Web应用配置文件简洁如下: </p>
<blockquote class="prefont"><p>
&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;ISO-8859-1&#8243;?&gt;<br />
&lt;!DOCTYPE web-app<br />
&nbsp; &nbsp; PUBLIC &#8220;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&#8221;<br />
&nbsp; &nbsp; &#8220;http://java.sun.com/dtd/web-app_2_3.dtd&#8221; &gt;<br />
&lt;web-app&gt;<br />
&nbsp; &lt;display-name&gt;WebChart&lt;/display-name&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;description&gt;WebChart&lt;/description&gt;<br />
&nbsp; &lt;listener&gt;<br />
&nbsp; &nbsp; &lt;listener-class&gt;com.lfx.web.WebChartListener&lt;/listener-class&gt;<br />
&nbsp; &lt;/listener&gt;<br />
&nbsp; <br />
&nbsp; &lt;servlet&gt;<br />
&nbsp; &nbsp; &lt;servlet-name&gt;WebChart&lt;/servlet-name&gt;<br />
&nbsp; &nbsp; &lt;servlet-class&gt;com.lfx.web.WebChart2Servlet&lt;/servlet-class&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;init-param&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;param-name&gt;FileExtention&lt;/param-name&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;param-value&gt;.rhtml&lt;/param-value&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/init-param&gt;<br />
&nbsp; &lt;/servlet&gt;</p>
<p>&nbsp; &lt;servlet-mapping&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;servlet-name&gt;WebChart&lt;/servlet-name&gt;<br />
&nbsp; &nbsp; &lt;url-pattern&gt;*.rhtml&lt;/url-pattern&gt;<br />
&nbsp; &lt;/servlet-mapping&gt;</p>
<p>&nbsp; &lt;session-config&gt;<br />
&nbsp; &nbsp; &lt;session-timeout&gt;900&lt;/session-timeout&gt; <br />
&nbsp; &lt;/session-config&gt;&nbsp;  <br />
&lt;/web-app&gt;
</p></blockquote>
<p>&nbsp; &nbsp; 如果使用了登录功能, 在升级后需要调整与登录有关的部份代码, 这一次没有做到完全兼容, 这点需要注意. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/20 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess.html" title="逻辑连接层与物理连接层">逻辑连接层与物理连接层</a> (4)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-super-expression.html" title="DataReport中的超级表达式">DataReport中的超级表达式</a> (0)</li><li>2010/01/08 -- <a href="http://www.anysql.net/tools/webchart-merge-dup-values.html" title="DataReport的重复值合并">DataReport的重复值合并</a> (0)</li><li>2010/01/05 -- <a href="http://www.anysql.net/tools/webchart-forall-loop.html" title="DataReport中的FORALL循环">DataReport中的FORALL循环</a> (0)</li><li>2009/12/29 -- <a href="http://www.anysql.net/tools/webchart-page-cache.html" title="DataReport中的Cache为王">DataReport中的Cache为王</a> (4)</li><li>2009/12/02 -- <a href="http://www.anysql.net/tools/webchart-xml-html-escape-chars.html" title="添加URL/HTML字符转义功能">添加URL/HTML字符转义功能</a> (1)</li><li>2009/09/21 -- <a href="http://www.anysql.net/tools/four-extra-businees-charts.html" title="多支持了四种业务图">多支持了四种业务图</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-one-java-servlet.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>报表页面导航链接定义</title>
		<link>http://www.anysql.net/tools/webchart-nagivation-links.html</link>
		<comments>http://www.anysql.net/tools/webchart-nagivation-links.html#comments</comments>
		<pubDate>Fri, 04 Dec 2009 04:59:24 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[WebChart]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=720</guid>
		<description><![CDATA[&#160; &#160; 以前一直是我自已在用DataReport展示数据, 如今天随着数据越来越多, 我的同事也开始使用DataReport来展示数据了. 在他们使用的过程中, 渐渐显示出某些需要改进和完善的地方. 对于我的同事来讲, 编辑报表定义文件已不是问题, 但编辑用于控制报表显示的XSL文件则相当痛苦, 我也充分理解这种痛苦. &#160; &#160; 比如让页面显示一排导航链接, 几经思量, 终于想出了一个解决的方法, 在报表定义中新增了一个属性. WEBCHART.URLS=ID&#124;URL[&#124;Attributes] &#160; &#160; &#160; &#160; &#160; &#160; &#160; ID&#124;URL[&#124;Attributes] &#160; &#160; 比如在报表定义文件中加入如下一行. WEBCHART.URLS=Home&#124;index.rhtml &#160; &#160; &#160; &#160; &#160; &#160; &#160; Sep&#124;,&#124;sep=&#8221;1&#8243; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Product&#124;prod.rthml &#160; &#160; &#160; &#160; &#160; &#160; &#160; Sep&#124;,&#124;sep=&#8221;1&#8243; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 以前一直是我自已在用DataReport展示数据, 如今天随着数据越来越多, 我的同事也开始使用DataReport来展示数据了. 在他们使用的过程中, 渐渐显示出某些需要改进和完善的地方. 对于我的同事来讲, 编辑报表定义文件已不是问题, 但编辑用于控制报表显示的XSL文件则相当痛苦, 我也充分理解这种痛苦. </p>
<p>&nbsp; &nbsp; 比如让页面显示一排导航链接, 几经思量, 终于想出了一个解决的方法, 在报表定义中新增了一个属性. </p>
<blockquote class="prefont"><p>
WEBCHART.URLS=ID|URL[|Attributes]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ID|URL[|Attributes]
</p></blockquote>
<p>&nbsp; &nbsp; 比如在报表定义文件中加入如下一行. </p>
<blockquote class="prefont"><p>
WEBCHART.URLS=Home|index.rhtml<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sep|,|sep=&#8221;1&#8243;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Product|prod.rthml<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Sep|,|sep=&#8221;1&#8243;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; About|about.rthml
</p></blockquote>
<p>&nbsp; &nbsp; 在生成的XML数据流中, 就会有如下数据. </p>
<blockquote class="prefont"><p>
- &lt;urls&gt;<br />
&nbsp; &lt;url id=&#8221;Home&#8221;&gt;index.rhtml&lt;/url&gt; <br />
&nbsp; &lt;url id=&#8221;Sep&#8221; sep=&#8221;1&#8243;&gt;,&lt;/url&gt; <br />
&nbsp; &lt;url id=&#8221;Product&#8221;&gt;prod.rthml&lt;/url&gt; <br />
&nbsp; &lt;url id=&#8221;Sep&#8221; sep=&#8221;1&#8243;&gt;,&lt;/url&gt; <br />
&nbsp; &lt;url id=&#8221;About&#8221;&gt;about.rthml&lt;/url&gt; <br />
&nbsp; &lt;/urls&gt;
</p></blockquote>
<p>&nbsp; &nbsp; 在XSL文件中, 就可以用统一的方式进行HTML转换. </p>
<blockquote class="prefont"><p>
&#8230;&#8230;<br />
&lt;xsl:apply-templates select=&#8221;urls&#8221; /&gt;<br />
&#8230;&#8230;<br />
&lt;xsl:template match=&#8221;urls&#8221; &gt;<br />
&nbsp; &nbsp; &lt;div&gt;<br />
&nbsp; &nbsp; &lt;xsl:for-each select=&#8221;url&#8221;&gt;<br />
&nbsp; &lt;xsl:choose&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;xsl:when test=&#8221;@sep&#8221;&gt;&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;xsl:value-of select=&#8221;.&#8221; disable-output-escaping=&#8221;yes&#8221; /&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/xsl:when&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;xsl:otherwise&gt;&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;a&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;xsl:attribute name=&#8221;href&#8221;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;xsl:value-of select=&#8221;.&#8221; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/xsl:attribute&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;xsl:value-of select=&#8221;@id&#8221; /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/a&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/xsl:otherwise&gt;<br />
&nbsp; &lt;/xsl:choose&gt;<br />
&nbsp; &nbsp; &lt;/xsl:for-each&gt;<br />
&nbsp; &nbsp; &lt;/div&gt;<br />
&lt;/xsl:template&gt;<br />
&#8230;&#8230;
</p></blockquote>
<p>&nbsp; &nbsp; 将原本需要在XSL中定义的内容, 移到报表定义文件的属性中, 增加XSL文件的通用性. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/12/04 -- <a href="http://www.anysql.net/tools/webchart-auto-reload-page.html" title="报表页面自动刷新属性">报表页面自动刷新属性</a> (0)</li><li>2009/12/02 -- <a href="http://www.anysql.net/tools/webchart-xml-html-escape-chars.html" title="添加URL/HTML字符转义功能">添加URL/HTML字符转义功能</a> (1)</li><li>2009/06/04 -- <a href="http://www.anysql.net/tools/webchart-new-xsl-template.html" title="如何打开WebChart的链接?">如何打开WebChart的链接?</a> (0)</li><li>2009/02/17 -- <a href="http://www.anysql.net/tools/webchart_xml.html" title="WebChart中的XML技术">WebChart中的XML技术</a> (1)</li><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/26 -- <a href="http://www.anysql.net/tools/webchart-dbconn-config2.html" title="WebChart的DB连接配置2">WebChart的DB连接配置2</a> (0)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/26 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess2.html" title="逻辑连接层与物理连接层(2)">逻辑连接层与物理连接层(2)</a> (1)</li><li>2010/01/21 -- <a href="http://www.anysql.net/tools/anysql-jdbc-driver.html" title="AnySQL JDBC Driver">AnySQL JDBC Driver</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-nagivation-links.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>报表页面自动刷新属性</title>
		<link>http://www.anysql.net/tools/webchart-auto-reload-page.html</link>
		<comments>http://www.anysql.net/tools/webchart-auto-reload-page.html#comments</comments>
		<pubDate>Fri, 04 Dec 2009 02:57:47 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebChart]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.anysql.net/?p=719</guid>
		<description><![CDATA[&#160; &#160; 以前一直是我自已在用DataReport展示数据, 如今天随着数据越来越多, 我的同事也开始使用DataReport来展示数据了. 在他们使用的过程中, 渐渐显示出某些需要改进和完善的地方. 对于我的同事来讲, 编辑报表定义文件已不是问题, 但编辑用于控制报表显示的XSL文件则相当痛苦, 我也充分理解这种痛苦. &#160; &#160; 比如让页面隔一定时间自动刷新的功能, 几经思量, 终于想出了一个解决的方法, 在报表定义中新增了一个属性. WEBCHART.RELOAD=Refresh Time&#124;Reload URL &#160; &#160; 比如在报表定义文件中加入如下一行. WEBCHART.RELOAD=30&#124;$REQUEST.FILE$?PDAY=$PDAY &#160; &#160; 在生成的XML数据流中, 就会有如下数据. &#60;reload time=&#8221;30&#8243;&#62;test.rhtml?PDAY=20091204&#60;/reload&#62; &#160; &#160; 在XSL文件中, 就可以用统一的方式进行HTML转换. &#8230;&#8230; &#60;xsl:apply-templates select=&#8221;reload&#8221; /&#62; &#8230;&#8230; &#60;xsl:template match=&#8221;reload&#8221; &#62; &#160; &#160; &#60;script language=&#8221;JavaScript&#8221;&#62; &#160; &#160; &#160; &#160; window.timer=window.setTimeout( &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 以前一直是我自已在用DataReport展示数据, 如今天随着数据越来越多, 我的同事也开始使用DataReport来展示数据了. 在他们使用的过程中, 渐渐显示出某些需要改进和完善的地方. 对于我的同事来讲, 编辑报表定义文件已不是问题, 但编辑用于控制报表显示的XSL文件则相当痛苦, 我也充分理解这种痛苦. </p>
<p>&nbsp; &nbsp; 比如让页面隔一定时间自动刷新的功能, 几经思量, 终于想出了一个解决的方法, 在报表定义中新增了一个属性. </p>
<blockquote class="prefont"><p>
WEBCHART.RELOAD=Refresh Time|Reload URL
</p></blockquote>
<p>&nbsp; &nbsp; 比如在报表定义文件中加入如下一行. </p>
<blockquote class="prefont"><p>
WEBCHART.RELOAD=30|$REQUEST.FILE$?PDAY=$PDAY
</p></blockquote>
<p>&nbsp; &nbsp; 在生成的XML数据流中, 就会有如下数据. </p>
<blockquote class="prefont"><p>
&lt;reload time=&#8221;30&#8243;&gt;test.rhtml?PDAY=20091204&lt;/reload&gt;
</p></blockquote>
<p>&nbsp; &nbsp; 在XSL文件中, 就可以用统一的方式进行HTML转换. </p>
<blockquote class="prefont"><p>
&#8230;&#8230;<br />
&lt;xsl:apply-templates select=&#8221;reload&#8221; /&gt;<br />
&#8230;&#8230;<br />
&lt;xsl:template match=&#8221;reload&#8221; &gt;<br />
&nbsp; &nbsp; &lt;script language=&#8221;JavaScript&#8221;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; window.timer=window.setTimeout(<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8216;window.location.href=&#8221;&lt;xsl:value-of select=&#8221;.&#8221; /&gt;&#8221;;&#8217;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;xsl:value-of select=&#8221;@time&#8221; /&gt; * 1000);<br />
&nbsp; &nbsp; &lt;/script&gt;<br />
&lt;/xsl:template&gt;<br />
&#8230;&#8230;
</p></blockquote>
<p>&nbsp; &nbsp; 将原本需要在XSL中定义的内容, 移到报表定义文件的属性中, 增加XSL文件的通用性. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2009/12/04 -- <a href="http://www.anysql.net/tools/webchart-nagivation-links.html" title="报表页面导航链接定义">报表页面导航链接定义</a> (1)</li><li>2009/12/02 -- <a href="http://www.anysql.net/tools/webchart-xml-html-escape-chars.html" title="添加URL/HTML字符转义功能">添加URL/HTML字符转义功能</a> (1)</li><li>2009/06/04 -- <a href="http://www.anysql.net/tools/webchart-new-xsl-template.html" title="如何打开WebChart的链接?">如何打开WebChart的链接?</a> (0)</li><li>2009/02/17 -- <a href="http://www.anysql.net/tools/webchart_xml.html" title="WebChart中的XML技术">WebChart中的XML技术</a> (1)</li><li>2010/05/07 -- <a href="http://www.anysql.net/tools/webchart-batch-query.html" title="批量数据查询需求">批量数据查询需求</a> (0)</li><li>2010/03/04 -- <a href="http://www.anysql.net/tools/webchart-rows-filter.html" title="为DataReport增加条件过滤功能">为DataReport增加条件过滤功能</a> (1)</li><li>2010/02/26 -- <a href="http://www.anysql.net/tools/webchart-dbconn-config2.html" title="WebChart的DB连接配置2">WebChart的DB连接配置2</a> (0)</li><li>2010/02/20 -- <a href="http://www.anysql.net/tools/webchart-multidb-support.html" title="定义不同数据源的SQL">定义不同数据源的SQL</a> (4)</li><li>2010/01/26 -- <a href="http://www.anysql.net/tools/webchart-logical-dbaccess2.html" title="逻辑连接层与物理连接层(2)">逻辑连接层与物理连接层(2)</a> (1)</li><li>2010/01/21 -- <a href="http://www.anysql.net/tools/anysql-jdbc-driver.html" title="AnySQL JDBC Driver">AnySQL JDBC Driver</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/tools/webchart-auto-reload-page.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
