⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 select.tag

📁 某石油系统正在使用的实时报表平台系统
💻 TAG
字号:
<%@ tag body-content="scriptless" %>
<%@ attribute name="var" type="java.lang.String" rtexprvalue="false" required="true" %>
<%@ variable name-from-attribute="var" alias="v_row" scope="NESTED" %>
<%@ attribute name="table"   required="true"  %>
<%@ attribute name="columns" required="false" %>
<%@ attribute name="where"   required="false" %>
<%@ attribute name="groupBy" required="false" %>
<%@ attribute name="having"  required="false" %>
<%@ attribute name="orderBy" required="false" %>
<%@ attribute name="startRow" required="false" %>
<%@ attribute name="maxRows" required="false" %>
<%@ attribute name="pageNo" required="false" %>
<%@ attribute name="autoList" required="false" %>
<%@ include file="init.tagf" %>

<c:if test="${empty pageNo && empty startRow && empty maxRows}" var="noPage"/>
<c:if test="${!noPage}">
	<c:if test="${empty sessionScope.pageVolume}"><c:set var="pageVolume" value="20" scope="session"/></c:if>
	<c:if test="${empty maxRows}"><c:set var="maxRows" value="${sessionScope.pageVolume}"/></c:if>
	<c:if test="${maxRows > 100}"><c:set var="maxRows" value="100"/></c:if>
	
	<c:if test="${empty startRow}">
	<c:if test="${empty pageNo}"><c:set var="startRow" value="0"/></c:if>
	<c:if test="${!empty pageNo}"><c:set var="startRow" value="${(pageNo-1)*sessionScope.pageVolume}"/></c:if>
	</c:if>
</c:if>

<c:catch var="errormsg">
<sql:query dataSource="${tags_tour_dataSource}" var="v_result">
<c:if test="${noPage}">
SELECT ${empty columns ?"*" : columns} FROM  ${table}
	<c:if test="${!empty where}">   WHERE    ${where}   </c:if>
	<c:if test="${!empty groupBy}"> GROUP BY ${groupBy} </c:if>
	<c:if test="${!empty having}">  HAVING   ${having}  </c:if>
	<c:if test="${!empty orderBy}"> ORDER BY ${orderBy} </c:if>
</c:if>

<c:if test="${!noPage}">
SELECT ${empty columns ? "*" : columns} FROM  (
	SELECT
		<c:if test="${empty columns}">${table}.*</c:if><c:if test="${!empty columns}">${columns}</c:if>
		, rownum rnRowNum FROM  ${table}
		WHERE <c:if test="${!empty where}"> ${where} AND</c:if>	rownum<=${startRow+maxRows}
		<c:if test="${!empty groupBy}"> GROUP BY ${groupBy} </c:if>
		<c:if test="${!empty having}">  HAVING   ${having}  </c:if>
		<c:if test="${!empty orderBy}"> ORDER BY ${orderBy} </c:if>
) WHERE rnRowNum > ${startRow}
</c:if>
</sql:query>
</c:catch>

<c:if test="${!empty errormsg}">
<pre><c:out value="${errormsg}" /></pre>
</c:if>

<c:if test="${empty errormsg}">
	<c:if test="${autoList != true}">
		<c:forEach var="v_row" items="${v_result.rows}">
		<jsp:doBody/>
		</c:forEach>
	</c:if>

	<c:if test="${autoList == true}">
<h1>Name:${table}</h1>
<table border=1>
<c:forEach var="v_col_name" items="${v_result.columnNames}" >
  <th>${v_col_name}</th>
</c:forEach>
<c:forEach var="v_row" items="${v_result.rowsByIndex}">
<tr>
	<c:forEach var="v_col" items="${v_row}">
	<td><c:out value="${v_col}" default="NULL" /></td>
	</c:forEach>
</tr>
</c:forEach>
</table>

${v_result.rowCount} lines displayed.
	</c:if>
</c:if>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -