提交 2a1545d7 authored 作者: Thomas Mueller's avatar Thomas Mueller

HTML railroad diagrams

上级 11095888
...@@ -16,11 +16,33 @@ Data Types ...@@ -16,11 +16,33 @@ Data Types
<!-- } --> <!-- } -->
<h1>Data Types</h1> <h1>Data Types</h1>
<!-- syntax-start
<p class="notranslate"> <p class="notranslate">
<c:forEach var="item" items="dataTypes"> <c:forEach var="item" items="dataTypes">
<a href="#${item.link}">${item.topic}</a><br /> <a href="#${item.link}" >${item.topic}</a><br />
</c:forEach> </c:forEach>
</p> </p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<c:forEach var="item" items="dataTypes-0">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="dataTypes-1">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="dataTypes-2">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<c:forEach var="item" items="dataTypes"> <c:forEach var="item" items="dataTypes">
<h3 id="${item.link}" class="notranslate">${item.topic}</h3> <h3 id="${item.link}" class="notranslate">${item.topic}</h3>
......
...@@ -190,7 +190,7 @@ This is not a bug. According the the JDBC specification, the method ...@@ -190,7 +190,7 @@ This is not a bug. According the the JDBC specification, the method
<code>ResultSetMetaData.getColumnName()</code> should return the name of the column <code>ResultSetMetaData.getColumnName()</code> should return the name of the column
and not the alias name. If you need the alias name, use and not the alias name. If you need the alias name, use
<a href="http://java.sun.com/javase/6/docs/api/java/sql/ResultSetMetaData.html#getColumnLabel(int)"><code>ResultSetMetaData.getColumnLabel()</code></a>. <a href="http://java.sun.com/javase/6/docs/api/java/sql/ResultSetMetaData.html#getColumnLabel(int)"><code>ResultSetMetaData.getColumnLabel()</code></a>.
Other database don't work like this (they don't follow the JDBC standard). Other database don't work like this (they don't follow the JDBC specification).
If you need compatibility with those databases, use the <a href="features.html#compatibility">Compatibility Mode</a>, If you need compatibility with those databases, use the <a href="features.html#compatibility">Compatibility Mode</a>,
or set the system property <a href="../javadoc/org/h2/constant/SysProperties.html#h2.aliasColumnName"><code>h2.aliasColumnName</code></a>. or set the system property <a href="../javadoc/org/h2/constant/SysProperties.html#h2.aliasColumnName"><code>h2.aliasColumnName</code></a>.
</p> </p>
......
...@@ -24,7 +24,7 @@ Initial Developer: H2 Group ...@@ -24,7 +24,7 @@ Initial Developer: H2 Group
<td class="search" colspan="2"> <td class="search" colspan="2">
<!-- translate <!-- translate
<a href="http://translate.google.com/translate?u=http%3A%2F%2Fh2database.com" <a href="http://translate.google.com/translate?u=http%3A%2F%2Fh2database.com"
onclick="javascript:document.getElementById('translate').style.display='';return false;">Translate</a> onclick="javascript:startTranslate();return false;">Translate</a>
<div id = "translate" style="display:none"><div id = "google_translate_element"></div></div> <div id = "translate" style="display:none"><div id = "google_translate_element"></div></div>
translate --> translate -->
</td> </td>
...@@ -94,7 +94,18 @@ translate --> ...@@ -94,7 +94,18 @@ translate -->
</div></td></tr></table> </div></td></tr></table>
<script type="text/javascript" src="index.js"></script> <script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="search.js"></script> <script type="text/javascript" src="search.js"></script>
<script type="text/javascript">function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element'); } </script> <script type="text/javascript">
function startTranslate() {
document.getElementById('translate').style.display='';
var script=document.createElement('script');
script.setAttribute("type","text/javascript");
script.setAttribute("src", "http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit");
document.getElementsByTagName("head")[0].appendChild(script);
}
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
<!-- } --> <!-- } -->
......
...@@ -18,39 +18,144 @@ Functions ...@@ -18,39 +18,144 @@ Functions
<h1>Functions</h1> <h1>Functions</h1>
<h2>Aggregate Functions</h2> <h2>Aggregate Functions</h2>
<!-- syntax-start
<p class="notranslate"> <p class="notranslate">
<c:forEach var="item" items="functionsAggregate"> <c:forEach var="item" items="functionsAggregate">
<a href="#${item.link}" >${item.topic}</a><br /> <a href="#${item.link}" >${item.topic}</a><br />
</c:forEach> </c:forEach>
</p> </p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<c:forEach var="item" items="functionsAggregate-0">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="functionsAggregate-1">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="functionsAggregate-2">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<h2>Numeric Functions</h2> <h2>Numeric Functions</h2>
<!-- syntax-start
<p class="notranslate"> <p class="notranslate">
<c:forEach var="item" items="functionsNumeric"> <c:forEach var="item" items="functionsNumeric">
<a href="#${item.link}">${item.topic}</a><br /> <a href="#${item.link}" >${item.topic}</a><br />
</c:forEach> </c:forEach>
</p> </p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<c:forEach var="item" items="functionsNumeric-0">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="functionsNumeric-1">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="functionsNumeric-2">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<h2>String Functions</h2> <h2>String Functions</h2>
<!-- syntax-start
<p class="notranslate"> <p class="notranslate">
<c:forEach var="item" items="functionsString"> <c:forEach var="item" items="functionsString">
<a href="#${item.link}">${item.topic}</a><br /> <a href="#${item.link}" >${item.topic}</a><br />
</c:forEach> </c:forEach>
</p> </p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<c:forEach var="item" items="functionsString-0">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="functionsString-1">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="functionsString-2">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<h2>Time and Date Functions</h2> <h2>Time and Date Functions</h2>
<!-- syntax-start
<p class="notranslate"> <p class="notranslate">
<c:forEach var="item" items="functionsTimeDate"> <c:forEach var="item" items="functionsTimeDate">
<a href="#${item.link}">${item.topic}</a><br /> <a href="#${item.link}" >${item.topic}</a><br />
</c:forEach> </c:forEach>
</p> </p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<c:forEach var="item" items="functionsTimeDate-0">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="functionsTimeDate-1">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="functionsTimeDate-2">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<h2>System Functions</h2> <h2>System Functions</h2>
<!-- syntax-start
<p class="notranslate"> <p class="notranslate">
<c:forEach var="item" items="functionsSystem"> <c:forEach var="item" items="functionsSystem">
<a href="#${item.link}">${item.topic}</a><br /> <a href="#${item.link}" >${item.topic}</a><br />
</c:forEach> </c:forEach>
</p> </p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<c:forEach var="item" items="functionsSystem-0">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="functionsSystem-1">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="functionsSystem-2">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<c:forEach var="item" items="functionsAll"> <c:forEach var="item" items="functionsAll">
<h3 id="${item.link}" class="notranslate">${item.topic}</h3> <h3 id="${item.link}" class="notranslate">${item.topic}</h3>
......
...@@ -17,32 +17,116 @@ SQL Grammar ...@@ -17,32 +17,116 @@ SQL Grammar
<h1>SQL Grammar</h1> <h1>SQL Grammar</h1>
<h2>Commands (Data Manipulation)</h2> <h2>Commands (Data Manipulation)</h2>
<!-- syntax-start
<p class="notranslate"> <p class="notranslate">
<c:forEach var="item" items="commandsDML"> <c:forEach var="item" items="commandsDML">
<a href="#${item.link}">${item.topic}</a><br /> <a href="#${item.link}">${item.topic}</a><br />
</c:forEach> </c:forEach>
</p> </p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<c:forEach var="item" items="commandsDML-0">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="commandsDML-1">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="commandsDML-2">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<h2>Commands (Data Definition)</h2> <h2>Commands (Data Definition)</h2>
<!-- syntax-start
<p class="notranslate"> <p class="notranslate">
<c:forEach var="item" items="commandsDDL"> <c:forEach var="item" items="commandsDDL">
<a href="#${item.link}">${item.topic}</a><br /> <a href="#${item.link}">${item.topic}</a><br />
</c:forEach> </c:forEach>
</p> </p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<c:forEach var="item" items="commandsDDL-0">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="commandsDDL-1">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="commandsDDL-2">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<h2>Commands (Other)</h2> <h2>Commands (Other)</h2>
<!-- syntax-start
<p class="notranslate"> <p class="notranslate">
<c:forEach var="item" items="commandsOther"> <c:forEach var="item" items="commandsOther">
<a href="#${item.link}">${item.topic}</a><br /> <a href="#${item.link}">${item.topic}</a><br />
</c:forEach> </c:forEach>
</p> </p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<c:forEach var="item" items="commandsOther-0">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="commandsOther-1">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="commandsOther-2">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<h2>Other Grammar</h2> <h2>Other Grammar</h2>
<!-- syntax-start
<p class="notranslate"> <p class="notranslate">
<c:forEach var="item" items="otherGrammar"> <c:forEach var="item" items="otherGrammar">
<a href="#${item.link}" >${item.topic}</a><br /> <a href="#${item.link}" >${item.topic}</a><br />
</c:forEach> </c:forEach>
</p> </p>
syntax-end -->
<!-- railroad-start -->
<table class="notranslate index">
<tr>
<td class="index">
<c:forEach var="item" items="otherGrammar-0">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="otherGrammar-1">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td><td class="index">
<c:forEach var="item" items="otherGrammar-2">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</td>
</tr>
</table>
<!-- railroad-end -->
<h2>System Tables</h2> <h2>System Tables</h2>
<p class="notranslate"> <p class="notranslate">
......
...@@ -214,6 +214,29 @@ td.content { ...@@ -214,6 +214,29 @@ td.content {
color: #800; color: #800;
} }
table.index {
width: 100%;
border: 0px;
padding: 0px;
margin: 0px;
border: 0px none;
border-collapse: collapse;
}
/* width: 570px;
width: 190px;
*/
td.index {
width: 33%;
border: 0px;
padding: 0px;
margin: 0px;
border: 0px none;
border-collapse: collapse;
vertical-align: top;
}
.railroad { .railroad {
border: 0px; border: 0px;
padding: 0px; padding: 0px;
......
...@@ -131,3 +131,25 @@ em.u { ...@@ -131,3 +131,25 @@ em.u {
color: #800; color: #800;
} }
table.index {
width: 100%;
border: 0px;
padding: 0px;
margin: 0px;
border: 0px none;
border-collapse: collapse;
}
/* width: 570px;
width: 190px;
*/
td.index {
width: 33%;
border: 0px;
padding: 0px;
margin: 0px;
border: 0px none;
border-collapse: collapse;
vertical-align: top;
}
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
package org.h2.server.web; package org.h2.server.web;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.h2.util.New; import org.h2.util.New;
...@@ -92,7 +92,7 @@ public class PageParser { ...@@ -92,7 +92,7 @@ public class PageParser {
String items = readParam("items"); String items = readParam("items");
read(">"); read(">");
int start = pos; int start = pos;
ArrayList<Object> list = (ArrayList<Object>) get(items); List<Object> list = (List<Object>) get(items);
if (list == null) { if (list == null) {
result.append("?items?"); result.append("?items?");
list = New.arrayList(); list = New.arrayList();
......
...@@ -16,6 +16,7 @@ import java.sql.ResultSetMetaData; ...@@ -16,6 +16,7 @@ import java.sql.ResultSetMetaData;
import java.sql.Statement; import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import org.h2.bnf.Bnf; import org.h2.bnf.Bnf;
import org.h2.engine.Constants; import org.h2.engine.Constants;
...@@ -69,15 +70,15 @@ public class GenerateDoc { ...@@ -69,15 +70,15 @@ public class GenerateDoc {
// String help = "SELECT * FROM INFORMATION_SCHEMA.HELP WHERE SECTION"; // String help = "SELECT * FROM INFORMATION_SCHEMA.HELP WHERE SECTION";
String help = "SELECT ROWNUM ID, * FROM CSVREAD('" + inHelp + "') WHERE SECTION "; String help = "SELECT ROWNUM ID, * FROM CSVREAD('" + inHelp + "') WHERE SECTION ";
map("commands", help + "LIKE 'Commands%' ORDER BY ID", true); map("commands", help + "LIKE 'Commands%' ORDER BY ID", true);
map("commandsDML", help + "= 'Commands (DML)' ORDER BY ID", true); map("commandsDML", help + "= 'Commands (DML)' ORDER BY ID", false);
map("commandsDDL", help + "= 'Commands (DDL)' ORDER BY ID", true); map("commandsDDL", help + "= 'Commands (DDL)' ORDER BY ID", false);
map("commandsOther", help + "= 'Commands (Other)' ORDER BY ID", true); map("commandsOther", help + "= 'Commands (Other)' ORDER BY ID", false);
map("otherGrammar", help + "= 'Other Grammar' ORDER BY ID", true); map("otherGrammar", help + "= 'Other Grammar' ORDER BY ID", true);
map("functionsAggregate", help + "= 'Functions (Aggregate)' ORDER BY ID", true); map("functionsAggregate", help + "= 'Functions (Aggregate)' ORDER BY ID", false);
map("functionsNumeric", help + "= 'Functions (Numeric)' ORDER BY ID", true); map("functionsNumeric", help + "= 'Functions (Numeric)' ORDER BY ID", false);
map("functionsString", help + "= 'Functions (String)' ORDER BY ID", true); map("functionsString", help + "= 'Functions (String)' ORDER BY ID", false);
map("functionsTimeDate", help + "= 'Functions (Time and Date)' ORDER BY ID", true); map("functionsTimeDate", help + "= 'Functions (Time and Date)' ORDER BY ID", false);
map("functionsSystem", help + "= 'Functions (System)' ORDER BY ID", true); map("functionsSystem", help + "= 'Functions (System)' ORDER BY ID", false);
map("functionsAll", help + "LIKE 'Functions%' ORDER BY SECTION, ID", true); map("functionsAll", help + "LIKE 'Functions%' ORDER BY SECTION, ID", true);
map("dataTypes", help + "LIKE 'Data Types%' ORDER BY SECTION, ID", true); map("dataTypes", help + "LIKE 'Data Types%' ORDER BY SECTION, ID", true);
map("informationSchema", "SELECT TABLE_NAME TOPIC, GROUP_CONCAT(COLUMN_NAME " map("informationSchema", "SELECT TABLE_NAME TOPIC, GROUP_CONCAT(COLUMN_NAME "
...@@ -160,6 +161,12 @@ public class GenerateDoc { ...@@ -160,6 +161,12 @@ public class GenerateDoc {
list.add(map); list.add(map);
} }
session.put(key, list); session.put(key, list);
int div = 3;
int part = (list.size() + div - 1) / div;
for (int i = 0, start = 0; i < div; i++, start += part) {
List<HashMap<String, String>> listThird = list.subList(start, Math.min(start + part, list.size()));
session.put(key + "-" + i, listThird);
}
} finally { } finally {
JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(rs);
JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(stat);
......
...@@ -25,10 +25,9 @@ import org.h2.util.StringUtils; ...@@ -25,10 +25,9 @@ import org.h2.util.StringUtils;
public class WebSite { public class WebSite {
private static final String ANALYTICS_TAG = "<!-- analytics -->"; private static final String ANALYTICS_TAG = "<!-- analytics -->";
private static final String ANALYTICS_AND_TRANSLATE_SCRIPT = private static final String ANALYTICS_SCRIPT =
"<script src=\"http://www.google-analytics.com/ga.js\" type=\"text/javascript\"></script>\n" + "<script src=\"http://www.google-analytics.com/ga.js\" type=\"text/javascript\"></script>\n" +
"<script type=\"text/javascript\">var pageTracker=_gat._getTracker(\"UA-2351060-1\");pageTracker._initData();pageTracker._trackPageview();</script>\n" + "<script type=\"text/javascript\">var pageTracker=_gat._getTracker(\"UA-2351060-1\");pageTracker._initData();pageTracker._trackPageview();</script>";
"<script type=\"text/javascript\" src=\"http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit\"></script>";
private static final String TRANSLATE_START = "<!-- translate"; private static final String TRANSLATE_START = "<!-- translate";
private static final String TRANSLATE_END = "translate -->"; private static final String TRANSLATE_END = "translate -->";
...@@ -139,7 +138,7 @@ public class WebSite { ...@@ -139,7 +138,7 @@ public class WebSite {
if (name.endsWith(".html")) { if (name.endsWith(".html")) {
String page = new String(bytes, "UTF-8"); String page = new String(bytes, "UTF-8");
if (web) { if (web) {
page = StringUtils.replaceAll(page, ANALYTICS_TAG, ANALYTICS_AND_TRANSLATE_SCRIPT); page = StringUtils.replaceAll(page, ANALYTICS_TAG, ANALYTICS_SCRIPT);
} }
if (replaceFragments) { if (replaceFragments) {
page = replaceFragments(name, page); page = replaceFragments(name, page);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论