Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
37b58591
提交
37b58591
authored
12月 20, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve MODE documentation
上级
65c90c51
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
104 行增加
和
98 行删除
+104
-98
features.html
h2/src/docsrc/html/features.html
+56
-50
Mode.java
h2/src/main/org/h2/engine/Mode.java
+44
-46
help.csv
h2/src/main/org/h2/res/help.csv
+4
-2
没有找到文件。
h2/src/docsrc/html/features.html
浏览文件 @
37b58591
...
...
@@ -121,7 +121,7 @@ Features
</li><li>
Sequence and autoincrement columns, computed columns (can be used for function based indexes)
</li><li>
ORDER BY, GROUP BY, HAVING, UNION, LIMIT, TOP
</li><li>
Collation support, users, roles
</li><li>
Compatibility modes for
HSQLDB, MySQL and PostgreSQL
</li><li>
Compatibility modes for
IBM DB2, Apache Derby, HSQLDB, MS SQL Server, MySQL, Oracle, and PostgreSQL.
</li></ul>
<h3>
Security Features
</h3>
...
...
@@ -1036,34 +1036,26 @@ Not all features or differences of those databases are implemented.
Here is the list of currently supported modes and the difference to the regular mode:
</p>
<h3>
PostgreSQL
Compatibility Mode
</h3>
<h3>
DB2
Compatibility Mode
</h3>
<p>
To use the
PostgreSQL mode, use the database URL
<code>
jdbc:h2:~/test;MODE=PostgreSQL
</code>
or the SQL statement
<code>
SET MODE
PostgreSQL
</code>
.
To use the
IBM DB2 mode, use the database URL
<code>
jdbc:h2:~/test;MODE=DB2
</code>
or the SQL statement
<code>
SET MODE
DB2
</code>
.
</p>
<ul><li>
Concatenation of a NULL with another value results in NULL. Usually, the NULL is treated as an empty
string if only one of the operators is NULL, and NULL is only returned if both values are NULL.
</li><li>
When converting a floating point number to a integer, the fractional
digits should not be truncated, but the value should be rounded.
</li><li>
The system columns 'CTID' and 'OID' should be supported.
</li><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
<ul><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
</li><li>
Support for the syntax [OFFSET .. ROW] [FETCH ... ONLY]
as an alternative syntax for LIMIT .. OFFSET.
</li></ul>
<h3>
MySQL
Compatibility Mode
</h3>
<h3>
Derby
Compatibility Mode
</h3>
<p>
To use the
MySQL mode, use the database URL
<code>
jdbc:h2:~/test;MODE=MySQL
</code>
or the SQL statement
<code>
SET MODE
MySQL
</code>
.
To use the
Apache Derby mode, use the database URL
<code>
jdbc:h2:~/test;MODE=Derby
</code>
or the SQL statement
<code>
SET MODE
Derby
</code>
.
</p>
<ul><li>
When inserting data, if a column is defined to be NOT NULL and NULL is inserted,
then a 0 (or empty string, or the current timestamp for timestamp columns) value is used.
Usually, this operation is not allowed and an exception is thrown.
</li><li>
When converting a floating point number to a integer, the fractional
digits should not be truncated, but the value should be rounded.
</li><li>
The identifiers should be returned in lower case.
</li><li>
Creating indexes in the CREATE TABLE statement should be supported.
</li><li>
For aliased columns, ResultSetMetaData.getColumnName() and getTableName()
return the real column and table name.
<ul><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
</li><li>
For unique indexes, NULL is distinct. That means only one row with NULL
in one of the columns is allowed.
</li></ul>
<h3>
HSQLDB Compatibility Mode
</h3>
...
...
@@ -1071,15 +1063,14 @@ or the SQL statement <code>SET MODE MySQL</code>.
To use the HSQLDB mode, use the database URL
<code>
jdbc:h2:~/test;MODE=HSQLDB
</code>
or the SQL statement
<code>
SET MODE HSQLDB
</code>
.
</p>
<ul><li>
Concatenation of a NULL with another value results in NULL. Usually, the NULL is treated as an empty
string if only one of the operators is NULL, and NULL is only returned if both values are NULL
.
<ul><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null
.
</li><li>
When converting the scale of decimal data, the number is only converted if the new scale is
smaller then current scale. Usually, the scale is converted and 0s are added if required.
</li><li>
When using unique indexes, multiple rows with NULL in one of the columns
are allowed by default. However many databases view NULL as distinct in
this regard and only allow one row with NULL.
</li><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
smaller then current scale. Usually, the scale is converted and 0s are added if required.
</li><li>
Concatenation of a NULL with another value results in NULL. Usually, the NULL is treated as an empty
string if only one of the operators is NULL, and NULL is only returned if both values are NULL.
</li><li>
For unique indexes, NULL is distinct. That means only one row with NULL
in one of the columns is allowed.
</li></ul>
<h3>
MS SQL Server Compatibility Mode
</h3>
...
...
@@ -1087,24 +1078,25 @@ or the SQL statement <code>SET MODE HSQLDB</code>.
To use the MS SQL Server mode, use the database URL
<code>
jdbc:h2:~/test;MODE=MSSQLServer
</code>
or the SQL statement
<code>
SET MODE MSSQLServer
</code>
.
</p>
<ul><li>
Identifiers may be quoted using square brackets as in [Test].
</li><li>
When using unique indexes, multiple rows with NULL in one of the columns
are allowed by default. However many databases view NULL as distinct in
this regard and only allow one row with NULL.
</li><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
<ul><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
</li><li>
Identifiers may be quoted using square brackets as in [Test].
</li><li>
For unique indexes, NULL is distinct. That means only one row with NULL
in one of the columns is allowed.
</li></ul>
<h3>
Derby
Compatibility Mode
</h3>
<h3>
MySQL
Compatibility Mode
</h3>
<p>
To use the
Derby mode, use the database URL
<code>
jdbc:h2:~/test;MODE=Derby
</code>
or the SQL statement
<code>
SET MODE
Derby
</code>
.
To use the
MySQL mode, use the database URL
<code>
jdbc:h2:~/test;MODE=MySQL
</code>
or the SQL statement
<code>
SET MODE
MySQL
</code>
.
</p>
<ul><li>
When using unique indexes, multiple rows with NULL in one of the columns
are allowed by default. However many databases view NULL as distinct in
this regard and only allow one row with NULL.
</li><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
<ul><li>
When inserting data, if a column is defined to be NOT NULL and NULL is inserted,
then a 0 (or empty string, or the current timestamp for timestamp columns) value is used.
Usually, this operation is not allowed and an exception is thrown.
</li><li>
Creating indexes in the CREATE TABLE statement should be supported.
</li><li>
The identifiers should be returned in lower case.
</li><li>
When converting a floating point number to a integer, the fractional
digits should not be truncated, but the value should be rounded.
</li></ul>
<h3>
Oracle Compatibility Mode
</h3>
...
...
@@ -1112,11 +1104,25 @@ or the SQL statement <code>SET MODE Derby</code>.
To use the Oracle mode, use the database URL
<code>
jdbc:h2:~/test;MODE=Oracle
</code>
or the SQL statement
<code>
SET MODE Oracle
</code>
.
</p>
<ul><li>
When using unique indexes, multiple rows with NULL in one of the columns
are allowed by default. However many databases view NULL as distinct in
this regard and only allow one row with NULL.
</li><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
<ul><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
</li><li>
When using unique indexes, multiple rows with NULL in all columns
are allowed, however it is not allowed to have multiple rows with the
same values otherwise.
</li></ul>
<h3>
PostgreSQL Compatibility Mode
</h3>
<p>
To use the PostgreSQL mode, use the database URL
<code>
jdbc:h2:~/test;MODE=PostgreSQL
</code>
or the SQL statement
<code>
SET MODE PostgreSQL
</code>
.
</p>
<ul><li>
For aliased columns, ResultSetMetaData.getColumnName() returns the alias name
and getTableName() returns null.
</li><li>
Concatenation of a NULL with another value results in NULL. Usually, the NULL is treated as an empty
string if only one of the operators is NULL, and NULL is only returned if both values are NULL.
</li><li>
When converting a floating point number to a integer, the fractional
digits should not be truncated, but the value should be rounded.
</li><li>
The system columns 'CTID' and 'OID' should be supported.
</li></ul>
<br
/><a
name=
"auto_reconnect"
></a>
...
...
h2/src/main/org/h2/engine/Mode.java
浏览文件 @
37b58591
...
...
@@ -27,11 +27,12 @@ public class Mode {
// Modes are also documented in the features section
/**
* Concatenation of a NULL with another value results in NULL. Usually, the
* NULL is treated as an empty string if only one of the operators is NULL,
* and NULL is only returned if both values are NULL.
* When enabled, aliased columns (as in SELECT ID AS I FROM TEST) return the
* alias (I in this case) in ResultSetMetaData.getColumnName() and 'null' in
* getTableName(). If disabled, the real column name (ID in this case) and
* table name is returned.
*/
public
boolean
nullConcatIsNull
;
public
boolean
aliasColumnName
;
/**
* When inserting data, if a column is defined to be NOT NULL and NULL is
...
...
@@ -49,10 +50,9 @@ public class Mode {
public
boolean
convertOnlyToSmallerScale
;
/**
* When converting a floating point number to a integer, the fractional
* digits should not be truncated, but the value should be rounded.
* Creating indexes in the CREATE TABLE statement should be supported.
*/
public
boolean
roundWhenConvertToLong
;
public
boolean
indexDefinitionInCreateTable
;
/**
* The identifiers should be returned in lower case.
...
...
@@ -60,14 +60,17 @@ public class Mode {
public
boolean
lowerCaseIdentifiers
;
/**
* Creating indexes in the CREATE TABLE statement should be supported.
* Concatenation of a NULL with another value results in NULL. Usually, the
* NULL is treated as an empty string if only one of the operators is NULL,
* and NULL is only returned if both values are NULL.
*/
public
boolean
indexDefinitionInCreateTable
;
public
boolean
nullConcatIsNull
;
/**
* The system columns 'CTID' and 'OID' should be supported.
* When converting a floating point number to a integer, the fractional
* digits should not be truncated, but the value should be rounded.
*/
public
boolean
systemColumns
;
public
boolean
roundWhenConvertToLong
;
/**
* Identifiers may be quoted using square brackets as in [Test].
...
...
@@ -75,32 +78,28 @@ public class Mode {
public
boolean
squareBracketQuotedNames
;
/**
* When using unique indexes, multiple rows with NULL in one of the columns
* are allowed by default. However many databases view NULL as distinct in
* this regard and only allow one row with NULL.
* Support for the syntax [OFFSET .. ROW] [FETCH ... ONLY]
* as an alternative syntax for LIMIT .. OFFSET.
*/
public
boolean
uniqueIndexSingleNull
;
public
boolean
supportOffsetFetch
;
/**
* When using unique indexes, multiple rows with NULL in all columns
* are allowed, however it is not allowed to have multiple rows with the
* same values otherwise. This is how Oracle works.
* The system columns 'CTID' and 'OID' should be supported.
*/
public
boolean
uniqueIndexSingleNullExceptAllColumnsAreNull
;
public
boolean
systemColumns
;
/**
*
If the syntax [OFFSET .. ROW] [FETCH ... ONLY] should be supported.
*
This is an alternative syntax for LIMIT .. OFFSET
.
*
For unique indexes, NULL is distinct. That means only one row with NULL
*
in one of the columns is allowed
.
*/
public
boolean
supportOffsetFetch
;
public
boolean
uniqueIndexSingleNull
;
/**
* When enabled, aliased columns (as in SELECT ID AS I FROM TEST) return the
* alias (I in this case) in ResultSetMetaData.getColumnName() and 'null' in
* getTableName(). If disabled, the real column name (ID in this case) and
* table name is returned.
* When using unique indexes, multiple rows with NULL in all columns
* are allowed, however it is not allowed to have multiple rows with the
* same values otherwise.
*/
public
boolean
aliasColumnName
;
public
boolean
uniqueIndexSingleNullExceptAllColumnsAreNull
;
private
String
name
;
...
...
@@ -109,48 +108,47 @@ public class Mode {
mode
.
aliasColumnName
=
SysProperties
.
ALIAS_COLUMN_NAME
;
add
(
mode
);
mode
=
new
Mode
(
"PostgreSQL"
);
mode
.
nullConcatIsNull
=
true
;
mode
.
roundWhenConvertToLong
=
true
;
mode
.
systemColumns
=
true
;
mode
=
new
Mode
(
"DB2"
);
mode
.
aliasColumnName
=
true
;
mode
.
supportOffsetFetch
=
true
;
add
(
mode
);
mode
=
new
Mode
(
"MySQL"
);
mode
.
convertInsertNullToZero
=
true
;
mode
.
roundWhenConvertToLong
=
true
;
mode
.
lowerCaseIdentifiers
=
true
;
mode
.
indexDefinitionInCreateTable
=
true
;
mode
=
new
Mode
(
"Derby"
);
mode
.
aliasColumnName
=
true
;
mode
.
uniqueIndexSingleNull
=
true
;
add
(
mode
);
mode
=
new
Mode
(
"HSQLDB"
);
mode
.
nullConcatIsNull
=
true
;
mode
.
aliasColumnName
=
true
;
mode
.
convertOnlyToSmallerScale
=
true
;
mode
.
nullConcatIsNull
=
true
;
mode
.
uniqueIndexSingleNull
=
true
;
mode
.
aliasColumnName
=
true
;
add
(
mode
);
mode
=
new
Mode
(
"MSSQLServer"
);
mode
.
aliasColumnName
=
true
;
mode
.
squareBracketQuotedNames
=
true
;
mode
.
uniqueIndexSingleNull
=
true
;
mode
.
aliasColumnName
=
true
;
add
(
mode
);
mode
=
new
Mode
(
"Derby"
);
mode
.
uniqueIndexSingleNull
=
true
;
mode
.
aliasColumnName
=
true
;
mode
=
new
Mode
(
"MySQL"
);
mode
.
convertInsertNullToZero
=
true
;
mode
.
indexDefinitionInCreateTable
=
true
;
mode
.
lowerCaseIdentifiers
=
true
;
mode
.
roundWhenConvertToLong
=
true
;
add
(
mode
);
mode
=
new
Mode
(
"Oracle"
);
mode
.
uniqueIndexSingleNullExceptAllColumnsAreNull
=
true
;
mode
.
aliasColumnName
=
true
;
mode
.
uniqueIndexSingleNullExceptAllColumnsAreNull
=
true
;
add
(
mode
);
mode
=
new
Mode
(
"DB2"
);
mode
.
supportOffsetFetch
=
true
;
mode
=
new
Mode
(
"PostgreSQL"
);
mode
.
aliasColumnName
=
true
;
mode
.
nullConcatIsNull
=
true
;
mode
.
roundWhenConvertToLong
=
true
;
mode
.
systemColumns
=
true
;
add
(
mode
);
}
private
Mode
(
String
name
)
{
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
37b58591
...
...
@@ -1044,9 +1044,11 @@ SET MAX_OPERATION_MEMORY 0
"
"Commands (Other)","SET MODE","
SET MODE {REGULAR | HSQLDB | POSTGRESQL | MYSQL}
SET MODE {REGULAR | DB2 | DERBY | HSQLDB |
MSSQLSERVER | MYSQL | ORACLE | POSTGRESQL}
","
Changes to another database mode.
Changes to another database compatibility mode.
For details, see Compatibility Modes in the feature section.
This setting is not persistent.
Admin rights are required to execute this command.
This setting can be appended to the database URL: jdbc:h2:test;MODE=MYSQL
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论