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

HTML railroad diagrams

上级 11095888
......@@ -16,11 +16,33 @@ Data Types
<!-- } -->
<h1>Data Types</h1>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="dataTypes">
<a href="#${item.link}">${item.topic}</a><br />
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</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">
<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
<code>ResultSetMetaData.getColumnName()</code> should return the name of the column
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>.
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>,
or set the system property <a href="../javadoc/org/h2/constant/SysProperties.html#h2.aliasColumnName"><code>h2.aliasColumnName</code></a>.
</p>
......
......@@ -24,7 +24,7 @@ Initial Developer: H2 Group
<td class="search" colspan="2">
<!-- translate
<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>
translate -->
</td>
......@@ -94,7 +94,18 @@ translate -->
</div></td></tr></table>
<script type="text/javascript" src="index.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
<h1>Functions</h1>
<h2>Aggregate Functions</h2>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="functionsAggregate">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</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>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="functionsNumeric">
<a href="#${item.link}">${item.topic}</a><br />
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</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>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="functionsString">
<a href="#${item.link}">${item.topic}</a><br />
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</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>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="functionsTimeDate">
<a href="#${item.link}">${item.topic}</a><br />
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</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>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="functionsSystem">
<a href="#${item.link}">${item.topic}</a><br />
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</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">
<h3 id="${item.link}" class="notranslate">${item.topic}</h3>
......
......@@ -17,32 +17,116 @@ SQL Grammar
<h1>SQL Grammar</h1>
<h2>Commands (Data Manipulation)</h2>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="commandsDML">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</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>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="commandsDDL">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</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>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="commandsOther">
<a href="#${item.link}">${item.topic}</a><br />
</c:forEach>
</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>
<!-- syntax-start
<p class="notranslate">
<c:forEach var="item" items="otherGrammar">
<a href="#${item.link}" >${item.topic}</a><br />
</c:forEach>
</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>
<p class="notranslate">
......
......@@ -214,6 +214,29 @@ td.content {
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 {
border: 0px;
padding: 0px;
......
......@@ -131,3 +131,25 @@ em.u {
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 @@
package org.h2.server.web;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.h2.util.New;
......@@ -92,7 +92,7 @@ public class PageParser {
String items = readParam("items");
read(">");
int start = pos;
ArrayList<Object> list = (ArrayList<Object>) get(items);
List<Object> list = (List<Object>) get(items);
if (list == null) {
result.append("?items?");
list = New.arrayList();
......
......@@ -16,6 +16,7 @@ import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.h2.bnf.Bnf;
import org.h2.engine.Constants;
......@@ -69,15 +70,15 @@ public class GenerateDoc {
// String help = "SELECT * FROM INFORMATION_SCHEMA.HELP WHERE SECTION";
String help = "SELECT ROWNUM ID, * FROM CSVREAD('" + inHelp + "') WHERE SECTION ";
map("commands", help + "LIKE 'Commands%' ORDER BY ID", true);
map("commandsDML", help + "= 'Commands (DML)' ORDER BY ID", true);
map("commandsDDL", help + "= 'Commands (DDL)' ORDER BY ID", true);
map("commandsOther", help + "= 'Commands (Other)' ORDER BY ID", true);
map("commandsDML", help + "= 'Commands (DML)' ORDER BY ID", false);
map("commandsDDL", help + "= 'Commands (DDL)' ORDER BY ID", false);
map("commandsOther", help + "= 'Commands (Other)' ORDER BY ID", false);
map("otherGrammar", help + "= 'Other Grammar' ORDER BY ID", true);
map("functionsAggregate", help + "= 'Functions (Aggregate)' ORDER BY ID", true);
map("functionsNumeric", help + "= 'Functions (Numeric)' ORDER BY ID", true);
map("functionsString", help + "= 'Functions (String)' ORDER BY ID", true);
map("functionsTimeDate", help + "= 'Functions (Time and Date)' ORDER BY ID", true);
map("functionsSystem", help + "= 'Functions (System)' ORDER BY ID", true);
map("functionsAggregate", help + "= 'Functions (Aggregate)' ORDER BY ID", false);
map("functionsNumeric", help + "= 'Functions (Numeric)' ORDER BY ID", false);
map("functionsString", help + "= 'Functions (String)' ORDER BY ID", false);
map("functionsTimeDate", help + "= 'Functions (Time and Date)' ORDER BY ID", false);
map("functionsSystem", help + "= 'Functions (System)' ORDER BY ID", false);
map("functionsAll", help + "LIKE 'Functions%' 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 "
......@@ -160,6 +161,12 @@ public class GenerateDoc {
list.add(map);
}
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 {
JdbcUtils.closeSilently(rs);
JdbcUtils.closeSilently(stat);
......
......@@ -25,10 +25,9 @@ import org.h2.util.StringUtils;
public class WebSite {
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 type=\"text/javascript\">var pageTracker=_gat._getTracker(\"UA-2351060-1\");pageTracker._initData();pageTracker._trackPageview();</script>\n" +
"<script type=\"text/javascript\" src=\"http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit\"></script>";
"<script type=\"text/javascript\">var pageTracker=_gat._getTracker(\"UA-2351060-1\");pageTracker._initData();pageTracker._trackPageview();</script>";
private static final String TRANSLATE_START = "<!-- translate";
private static final String TRANSLATE_END = "translate -->";
......@@ -139,7 +138,7 @@ public class WebSite {
if (name.endsWith(".html")) {
String page = new String(bytes, "UTF-8");
if (web) {
page = StringUtils.replaceAll(page, ANALYTICS_TAG, ANALYTICS_AND_TRANSLATE_SCRIPT);
page = StringUtils.replaceAll(page, ANALYTICS_TAG, ANALYTICS_SCRIPT);
}
if (replaceFragments) {
page = replaceFragments(name, page);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论