提交 4486b387 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Remove Type suffix from data types in documentation

上级 4d3a9d03
...@@ -71,35 +71,35 @@ public class GenerateDoc { ...@@ -71,35 +71,35 @@ public class GenerateDoc {
String help = "SELECT ROWNUM ID, * FROM CSVREAD('" + String help = "SELECT ROWNUM ID, * FROM CSVREAD('" +
IN_HELP + "', NULL, 'lineComment=#') WHERE SECTION "; IN_HELP + "', NULL, 'lineComment=#') WHERE SECTION ";
map("commandsDML", map("commandsDML",
help + "= 'Commands (DML)' ORDER BY ID", true); help + "= 'Commands (DML)' ORDER BY ID", true, false);
map("commandsDDL", map("commandsDDL",
help + "= 'Commands (DDL)' ORDER BY ID", true); help + "= 'Commands (DDL)' ORDER BY ID", true, false);
map("commandsOther", map("commandsOther",
help + "= 'Commands (Other)' ORDER BY ID", true); help + "= 'Commands (Other)' ORDER BY ID", true, false);
map("datetimeFields", map("datetimeFields",
help + "= 'Datetime fields' ORDER BY ID", true); help + "= 'Datetime fields' ORDER BY ID", true, false);
map("otherGrammar", map("otherGrammar",
help + "= 'Other Grammar' ORDER BY ID", true); help + "= 'Other Grammar' ORDER BY ID", true, false);
map("functionsAggregate", map("functionsAggregate",
help + "= 'Functions (Aggregate)' ORDER BY ID", true); help + "= 'Functions (Aggregate)' ORDER BY ID", true, false);
map("functionsNumeric", map("functionsNumeric",
help + "= 'Functions (Numeric)' ORDER BY ID", true); help + "= 'Functions (Numeric)' ORDER BY ID", true, false);
map("functionsString", map("functionsString",
help + "= 'Functions (String)' ORDER BY ID", true); help + "= 'Functions (String)' ORDER BY ID", true, false);
map("functionsTimeDate", map("functionsTimeDate",
help + "= 'Functions (Time and Date)' ORDER BY ID", true); help + "= 'Functions (Time and Date)' ORDER BY ID", true, false);
map("functionsSystem", map("functionsSystem",
help + "= 'Functions (System)' ORDER BY ID", true); help + "= 'Functions (System)' ORDER BY ID", true, false);
map("dataTypes", map("dataTypes",
help + "LIKE 'Data Types%' ORDER BY SECTION, ID", true); help + "LIKE 'Data Types%' ORDER BY SECTION, ID", true, true);
map("intervalDataTypes", map("intervalDataTypes",
help + "LIKE 'Interval Data Types%' ORDER BY SECTION, ID", true); help + "LIKE 'Interval Data Types%' ORDER BY SECTION, ID", true, true);
map("informationSchema", "SELECT TABLE_NAME TOPIC, " + map("informationSchema", "SELECT TABLE_NAME TOPIC, " +
"GROUP_CONCAT(COLUMN_NAME " + "GROUP_CONCAT(COLUMN_NAME " +
"ORDER BY ORDINAL_POSITION SEPARATOR ', ') SYNTAX " + "ORDER BY ORDINAL_POSITION SEPARATOR ', ') SYNTAX " +
"FROM INFORMATION_SCHEMA.COLUMNS " + "FROM INFORMATION_SCHEMA.COLUMNS " +
"WHERE TABLE_SCHEMA='INFORMATION_SCHEMA' " + "WHERE TABLE_SCHEMA='INFORMATION_SCHEMA' " +
"GROUP BY TABLE_NAME ORDER BY TABLE_NAME", false); "GROUP BY TABLE_NAME ORDER BY TABLE_NAME", false, false);
processAll(""); processAll("");
conn.close(); conn.close();
} }
...@@ -134,7 +134,7 @@ public class GenerateDoc { ...@@ -134,7 +134,7 @@ public class GenerateDoc {
out.close(); out.close();
} }
private void map(String key, String sql, boolean railroads) private void map(String key, String sql, boolean railroads, boolean forDataTypes)
throws Exception { throws Exception {
ResultSet rs = null; ResultSet rs = null;
Statement stat = null; Statement stat = null;
...@@ -146,13 +146,17 @@ public class GenerateDoc { ...@@ -146,13 +146,17 @@ public class GenerateDoc {
while (rs.next()) { while (rs.next()) {
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
ResultSetMetaData meta = rs.getMetaData(); ResultSetMetaData meta = rs.getMetaData();
for (int i = 0; i < meta.getColumnCount(); i++) { for (int i = 1; i <= meta.getColumnCount(); i++) {
String k = StringUtils.toLowerEnglish(meta.getColumnLabel(i + 1)); String k = StringUtils.toLowerEnglish(meta.getColumnLabel(i));
String value = rs.getString(i + 1); String value = rs.getString(i);
value = value.trim(); value = value.trim();
map.put(k, PageParser.escapeHtml(value)); map.put(k, PageParser.escapeHtml(value));
} }
String topic = rs.getString("TOPIC"); String topic = rs.getString("TOPIC");
// Convert "INT Type" to "INT" etc.
if (forDataTypes && topic.endsWith(" Type")) {
map.put("topic", topic.substring(0, topic.length() - 5));
}
String syntax = rs.getString("SYNTAX").trim(); String syntax = rs.getString("SYNTAX").trim();
if (railroads) { if (railroads) {
BnfRailroad r = new BnfRailroad(); BnfRailroad r = new BnfRailroad();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论