Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
0baa19ed
提交
0baa19ed
authored
9月 21, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The database upgrade classes have been renamed (shorter class name).
上级
bad3c174
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
27 行增加
和
32 行删除
+27
-32
Driver.java
h2/src/main/org/h2/Driver.java
+1
-2
DbUpgrade.java
h2/src/main/org/h2/upgrade/DbUpgrade.java
+20
-24
DbUpgradeFromVersion1.java
h2/src/main/org/h2/upgrade/DbUpgradeFromVersion1.java
+6
-6
没有找到文件。
h2/src/main/org/h2/Driver.java
浏览文件 @
0baa19ed
...
@@ -59,7 +59,7 @@ public class Driver implements java.sql.Driver {
...
@@ -59,7 +59,7 @@ public class Driver implements java.sql.Driver {
}
}
boolean
noUpgrade
=
StringUtils
.
toUpperEnglish
(
url
).
indexOf
(
";NO_UPGRADE=TRUE"
)
>=
0
;
boolean
noUpgrade
=
StringUtils
.
toUpperEnglish
(
url
).
indexOf
(
";NO_UPGRADE=TRUE"
)
>=
0
;
url
=
StringUtils
.
replaceAllIgnoreCase
(
url
,
";NO_UPGRADE=TRUE"
,
""
);
url
=
StringUtils
.
replaceAllIgnoreCase
(
url
,
";NO_UPGRADE=TRUE"
,
""
);
if
(
DbUpgrade
.
are
V1dot1
ClassesPresent
())
{
if
(
DbUpgrade
.
are
Upgrade
ClassesPresent
())
{
if
(
noUpgrade
)
{
if
(
noUpgrade
)
{
Connection
connection
=
DbUpgrade
.
connectWithOldVersion
(
url
,
info
);
Connection
connection
=
DbUpgrade
.
connectWithOldVersion
(
url
,
info
);
if
(
connection
!=
null
)
{
if
(
connection
!=
null
)
{
...
@@ -69,7 +69,6 @@ public class Driver implements java.sql.Driver {
...
@@ -69,7 +69,6 @@ public class Driver implements java.sql.Driver {
DbUpgrade
.
upgrade
(
url
,
info
);
DbUpgrade
.
upgrade
(
url
,
info
);
}
}
}
}
return
new
JdbcConnection
(
url
,
info
);
return
new
JdbcConnection
(
url
,
info
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
DbException
.
toSQLException
(
e
);
throw
DbException
.
toSQLException
(
e
);
...
...
h2/src/main/org/h2/upgrade/DbUpgrade.java
浏览文件 @
0baa19ed
...
@@ -26,14 +26,14 @@ import org.h2.util.Utils;
...
@@ -26,14 +26,14 @@ import org.h2.util.Utils;
*/
*/
public
class
DbUpgrade
{
public
class
DbUpgrade
{
private
static
boolean
v1dot1
ClassesPresent
;
private
static
boolean
upgrade
ClassesPresent
;
private
static
Map
<
String
,
DbUpgrade
NonPageStoreToCurrent
>
runningConversions
;
private
static
Map
<
String
,
DbUpgrade
FromVersion1
>
runningConversions
;
static
{
static
{
// static initialize block
// static initialize block
v1dot1
ClassesPresent
=
Utils
.
isClassPresent
(
"org.h2.upgrade.v1_1.Driver"
);
upgrade
ClassesPresent
=
Utils
.
isClassPresent
(
"org.h2.upgrade.v1_1.Driver"
);
runningConversions
=
Collections
.
synchronizedMap
(
new
Hashtable
<
String
,
DbUpgrade
NonPageStoreToCurrent
>(
1
));
runningConversions
=
Collections
.
synchronizedMap
(
new
Hashtable
<
String
,
DbUpgrade
FromVersion1
>(
1
));
}
}
/**
/**
...
@@ -41,12 +41,12 @@ public class DbUpgrade {
...
@@ -41,12 +41,12 @@ public class DbUpgrade {
*
*
* @return true if it is
* @return true if it is
*/
*/
public
static
boolean
are
V1dot1
ClassesPresent
()
{
public
static
boolean
are
Upgrade
ClassesPresent
()
{
return
v1dot1
ClassesPresent
;
return
upgrade
ClassesPresent
;
}
}
/**
/**
* Connects to an old
1.1 database
* Connects to an old
(version 1.1) database.
*
*
* @param url The connection string
* @param url The connection string
* @param info The connection properties
* @param info The connection properties
...
@@ -98,23 +98,19 @@ public class DbUpgrade {
...
@@ -98,23 +98,19 @@ public class DbUpgrade {
* @throws SQLException
* @throws SQLException
*/
*/
public
static
synchronized
void
upgrade
(
String
url
,
Properties
info
)
throws
SQLException
{
public
static
synchronized
void
upgrade
(
String
url
,
Properties
info
)
throws
SQLException
{
if
(
v1dot1ClassesPresent
)
{
if
(
upgradeClassesPresent
)
{
upgradeFromNonPageStore
(
url
,
info
);
if
(
runningConversions
.
containsKey
(
url
))
{
}
// do not migrate, because we are currently migrating, and this is
}
// the connection where "runscript from" will be executed
return
;
private
static
void
upgradeFromNonPageStore
(
String
url
,
Properties
info
)
throws
SQLException
{
}
if
(
runningConversions
.
containsKey
(
url
))
{
try
{
// do not migrate, because we are currently migrating, and this is
DbUpgradeFromVersion1
instance
=
new
DbUpgradeFromVersion1
(
url
,
info
);
// the connection where "runscript from" will be executed
runningConversions
.
put
(
url
,
instance
);
return
;
instance
.
upgrade
();
}
}
finally
{
try
{
runningConversions
.
remove
(
url
);
DbUpgradeNonPageStoreToCurrent
instance
=
new
DbUpgradeNonPageStoreToCurrent
(
url
,
info
);
}
runningConversions
.
put
(
url
,
instance
);
instance
.
upgrade
();
}
finally
{
runningConversions
.
remove
(
url
);
}
}
}
}
...
...
h2/src/main/org/h2/upgrade/DbUpgrade
NonPageStoreToCurrent
.java
→
h2/src/main/org/h2/upgrade/DbUpgrade
FromVersion1
.java
浏览文件 @
0baa19ed
...
@@ -20,10 +20,10 @@ import org.h2.util.StringUtils;
...
@@ -20,10 +20,10 @@ import org.h2.util.StringUtils;
import
org.h2.util.Utils
;
import
org.h2.util.Utils
;
/**
/**
* Class to convert a 1.1
DB (non page store) to a 1.2 DB (page store) format.
* Class to convert a 1.1
database (non page store) to the 1.2 (page store)
* Conversion is done via "script to" and "runscript from".
*
format.
Conversion is done via "script to" and "runscript from".
*/
*/
public
class
DbUpgrade
NonPageStoreToCurrent
{
public
class
DbUpgrade
FromVersion1
{
private
static
boolean
scriptInTmpDir
;
private
static
boolean
scriptInTmpDir
;
private
static
boolean
deleteOldDb
;
private
static
boolean
deleteOldDb
;
...
@@ -53,7 +53,7 @@ public class DbUpgradeNonPageStoreToCurrent {
...
@@ -53,7 +53,7 @@ public class DbUpgradeNonPageStoreToCurrent {
* @param info The connection properties
* @param info The connection properties
* @throws SQLException if an exception occurred
* @throws SQLException if an exception occurred
*/
*/
public
DbUpgrade
NonPageStoreToCurrent
(
String
url
,
Properties
info
)
throws
SQLException
{
public
DbUpgrade
FromVersion1
(
String
url
,
Properties
info
)
throws
SQLException
{
this
.
url
=
url
;
this
.
url
=
url
;
this
.
info
=
info
;
this
.
info
=
info
;
init
();
init
();
...
@@ -216,7 +216,7 @@ public class DbUpgradeNonPageStoreToCurrent {
...
@@ -216,7 +216,7 @@ public class DbUpgradeNonPageStoreToCurrent {
* located in the temp directory.
* located in the temp directory.
*/
*/
public
static
void
setScriptInTmpDir
(
boolean
scriptInTmpDir
)
{
public
static
void
setScriptInTmpDir
(
boolean
scriptInTmpDir
)
{
DbUpgrade
NonPageStoreToCurrent
.
scriptInTmpDir
=
scriptInTmpDir
;
DbUpgrade
FromVersion1
.
scriptInTmpDir
=
scriptInTmpDir
;
}
}
/**
/**
...
@@ -227,7 +227,7 @@ public class DbUpgradeNonPageStoreToCurrent {
...
@@ -227,7 +227,7 @@ public class DbUpgradeNonPageStoreToCurrent {
* @param deleteOldDb if true, the old db files will be deleted.
* @param deleteOldDb if true, the old db files will be deleted.
*/
*/
public
static
void
setDeleteOldDb
(
boolean
deleteOldDb
)
{
public
static
void
setDeleteOldDb
(
boolean
deleteOldDb
)
{
DbUpgrade
NonPageStoreToCurrent
.
deleteOldDb
=
deleteOldDb
;
DbUpgrade
FromVersion1
.
deleteOldDb
=
deleteOldDb
;
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论