Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
3f04419e
提交
3f04419e
authored
4月 16, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
H2 Console: the built-in commands are now documented.
上级
5b6845c0
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
322 行增加
和
138 行删除
+322
-138
tutorial.html
h2/src/docsrc/html/tutorial.html
+164
-0
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+143
-138
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+15
-0
没有找到文件。
h2/src/docsrc/html/tutorial.html
浏览文件 @
3f04419e
...
...
@@ -18,6 +18,8 @@ Tutorial
<h1>
Tutorial
</h1>
<a
href=
"#tutorial_starting_h2_console"
>
Starting and Using the H2 Console
</a><br
/>
<a
href=
"#console_syntax"
>
Special H2 Console Syntax
</a><br
/>
<a
href=
"#console_settings"
>
Settings of the H2 Console
</a><br
/>
<a
href=
"#connecting_using_jdbc"
>
...
...
@@ -228,6 +230,168 @@ press [Ctrl]+[C] in the console where the server was started (Windows),
or close the console window.
</p>
<h2
id=
"console_settings"
>
Special H2 Console Syntax
</h2>
<p>
The H2 Console supports a few built-in commands.
Those are interpreted within the H2 Console, that means they work with any database.
They need to be at the beginning of a statement (before any remarks),
otherwise they are not parsed correctly. If in doubt, add ';' before the command.
</p>
<table>
<tr>
<th>
Command(s)
</th>
<th>
Description
</th>
</tr>
<tr>
<td
class=
"notranslate"
>
@autocommit_true;
<br
/>
@autocommit_false;
</td>
<td>
Enable or disable autocommit.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@cancel;
</td>
<td>
Cancel the currently running statement.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@columns null null TEST;
<br
/>
@index_info
null
null
TEST;
<br
/>
@tables;
<br
/>
@tables null null TEST;
<br
/>
</td>
<td>
Call the corresponding DatabaseMetaData.get method.
Patterns are case sensitive (usually identifiers are uppercase).
For information about the parameters, see the Javadoc documentation.
Missing parameters at the end are set to null. The complete list of commands is:
<code>
@attributes @best_row_identifier @catalogs @columns
@column_privileges @cross_references @exported_keys
@imported_keys @index_info @primary_keys @procedures
@procedure_columns @schemas @super_tables @super_types
@tables @table_privileges @table_types @type_info @udts
@version_columns
</code>
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@edit select * from test;
</td>
<td>
Use an updatable result set.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@generated
insert
into
test()
values();
</td>
<td>
Show the result of
<code>
Statement.getGeneratedKeys()
</code>
.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@history;
</td>
<td>
Show the command history.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@info;
</td>
<td>
Display the result of various
<code>
Connection
</code>
and
<code>
DatabaseMetaData
</code>
methods.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@list select * from test;
</td>
<td>
Show the result set in list format (each column on its own line, with row numbers).
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@loop 1000 select ?, ?/*rnd*/;
<br
/>
@loop 1000 @statement select ?;
</td>
<td>
Run the statement this many times.
Parameters (
<code>
?
</code>
) are set using a loop from 0 up to x - 1.
Random values are used for each
<code>
?/*rnd*/
</code>
.
A Statement object is used instead of a PreparedStatement if
<code>
@statement
</code>
is used.
Result sets are read until
<code>
ResultSet.next()
</code>
returns
<code>
false
</code>
.
Timing information is printed.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@maxrows
20;
</td>
<td>
Set the maximum number of rows to display.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@memory;
</td>
<td>
Show the used and free memory. This will call
<code>
System.gc()
</code>
.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@meta
select
1;
</td>
<td>
List the
<code>
ResultSetMetaData
</code>
after running the query.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@parameter_meta
select
?;
</td>
<td>
Show the result of the
<code>
PreparedStatement.getParameterMetaData()
</code>
calls.
The statement is not executed.
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@prof_start;
<br
/>
call
hash('SHA256',
'',
1000000);
<br
/>
@prof_stop;
</td>
<td>
Start / stop the built-in profiling tool.
The top 3 stack traces of the statement(s) between start and stop are listed
(if there are 3).
</td>
</tr>
<tr>
<td
class=
"notranslate"
>
@transaction_isolation;
<br
/>
@transaction_isolation
2;
</td>
<td>
Display (without parameters) or change
(with parameters 1, 2, 4, 8) the transaction isolation level.
</td>
</tr>
</table>
<h2
id=
"console_settings"
>
Settings of the H2 Console
</h2>
<p>
The settings of the H2 Console are stored in a configuration file
...
...
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
3f04419e
差异被折叠。
点击展开。
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
3f04419e
...
...
@@ -80,6 +80,21 @@ public class StringUtils {
return
s
.
toLowerCase
(
Locale
.
ENGLISH
);
}
/**
* Check is a string starts with another string, ignoring the case.
*
* @param s the string to check (must be longer than start)
* @param start the prefix of s
* @return true if start is a prefix of s
*/
public
static
boolean
startsWithIgnoreCase
(
String
s
,
String
start
)
{
if
(
s
.
length
()
<
start
.
length
())
{
return
false
;
}
return
s
.
substring
(
0
,
start
.
length
()).
equalsIgnoreCase
(
start
);
}
/**
* Convert a string to a SQL literal. Null is converted to NULL. The text is
* enclosed in single quotes. If there are any special characters, the method
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论