Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
511fceff
提交
511fceff
authored
12 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move method to StringUtils to avoid classloading problems on Android.
上级
b9337c2d
master
noel-pr1
plus33-master
pr/267
stumc-Issue#576
version-1.4.198
version-1.4.197
version-1.4.196
version-1.4.195
version-1.4.194
version-1.4.193
version-1.4.192
version-1.4.191
version-1.4.190
version-1.4.188
version-1.4.187
version-1.4.186
version-1.4.185
version-1.4.184
version-1.4.183
version-1.4.182
version-1.4.181
version-1.4.178
version-1.4.177
version-1.3
无相关合并请求
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
27 行增加
和
30 行删除
+27
-30
FullText.java
h2/src/main/org/h2/fulltext/FullText.java
+5
-6
FullTextLucene.java
h2/src/main/org/h2/fulltext/FullTextLucene.java
+5
-6
UpdatableRow.java
h2/src/main/org/h2/result/UpdatableRow.java
+4
-5
JdbcUtils.java
h2/src/main/org/h2/util/JdbcUtils.java
+0
-13
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+13
-0
没有找到文件。
h2/src/main/org/h2/fulltext/FullText.java
浏览文件 @
511fceff
...
@@ -36,7 +36,6 @@ import org.h2.jdbc.JdbcConnection;
...
@@ -36,7 +36,6 @@ import org.h2.jdbc.JdbcConnection;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.New
;
import
org.h2.util.New
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
...
@@ -847,8 +846,8 @@ public class FullText {
...
@@ -847,8 +846,8 @@ public class FullText {
ArrayList
<
String
>
keyList
=
New
.
arrayList
();
ArrayList
<
String
>
keyList
=
New
.
arrayList
();
DatabaseMetaData
meta
=
conn
.
getMetaData
();
DatabaseMetaData
meta
=
conn
.
getMetaData
();
ResultSet
rs
=
meta
.
getColumns
(
null
,
ResultSet
rs
=
meta
.
getColumns
(
null
,
Jdbc
Utils
.
escapeMetaDataPattern
(
schemaName
),
String
Utils
.
escapeMetaDataPattern
(
schemaName
),
Jdbc
Utils
.
escapeMetaDataPattern
(
tableName
),
String
Utils
.
escapeMetaDataPattern
(
tableName
),
null
);
null
);
ArrayList
<
String
>
columnList
=
New
.
arrayList
();
ArrayList
<
String
>
columnList
=
New
.
arrayList
();
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
...
@@ -861,15 +860,15 @@ public class FullText {
...
@@ -861,15 +860,15 @@ public class FullText {
index
.
columns
=
new
String
[
columnList
.
size
()];
index
.
columns
=
new
String
[
columnList
.
size
()];
columnList
.
toArray
(
index
.
columns
);
columnList
.
toArray
(
index
.
columns
);
rs
=
meta
.
getColumns
(
null
,
rs
=
meta
.
getColumns
(
null
,
Jdbc
Utils
.
escapeMetaDataPattern
(
schemaName
),
String
Utils
.
escapeMetaDataPattern
(
schemaName
),
Jdbc
Utils
.
escapeMetaDataPattern
(
tableName
),
String
Utils
.
escapeMetaDataPattern
(
tableName
),
null
);
null
);
for
(
int
i
=
0
;
rs
.
next
();
i
++)
{
for
(
int
i
=
0
;
rs
.
next
();
i
++)
{
columnTypes
[
i
]
=
rs
.
getInt
(
"DATA_TYPE"
);
columnTypes
[
i
]
=
rs
.
getInt
(
"DATA_TYPE"
);
}
}
if
(
keyList
.
size
()
==
0
)
{
if
(
keyList
.
size
()
==
0
)
{
rs
=
meta
.
getPrimaryKeys
(
null
,
rs
=
meta
.
getPrimaryKeys
(
null
,
Jdbc
Utils
.
escapeMetaDataPattern
(
schemaName
),
String
Utils
.
escapeMetaDataPattern
(
schemaName
),
tableName
);
tableName
);
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
keyList
.
add
(
rs
.
getString
(
"COLUMN_NAME"
));
keyList
.
add
(
rs
.
getString
(
"COLUMN_NAME"
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/fulltext/FullTextLucene.java
浏览文件 @
511fceff
...
@@ -33,7 +33,6 @@ import org.h2.expression.ExpressionColumn;
...
@@ -33,7 +33,6 @@ import org.h2.expression.ExpressionColumn;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.New
;
import
org.h2.util.New
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
...
@@ -531,8 +530,8 @@ public class FullTextLucene extends FullText {
...
@@ -531,8 +530,8 @@ public class FullTextLucene extends FullText {
ArrayList
<
String
>
keyList
=
New
.
arrayList
();
ArrayList
<
String
>
keyList
=
New
.
arrayList
();
DatabaseMetaData
meta
=
conn
.
getMetaData
();
DatabaseMetaData
meta
=
conn
.
getMetaData
();
ResultSet
rs
=
meta
.
getColumns
(
null
,
ResultSet
rs
=
meta
.
getColumns
(
null
,
Jdbc
Utils
.
escapeMetaDataPattern
(
schemaName
),
String
Utils
.
escapeMetaDataPattern
(
schemaName
),
Jdbc
Utils
.
escapeMetaDataPattern
(
tableName
),
String
Utils
.
escapeMetaDataPattern
(
tableName
),
null
);
null
);
ArrayList
<
String
>
columnList
=
New
.
arrayList
();
ArrayList
<
String
>
columnList
=
New
.
arrayList
();
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
...
@@ -542,15 +541,15 @@ public class FullTextLucene extends FullText {
...
@@ -542,15 +541,15 @@ public class FullTextLucene extends FullText {
columns
=
new
String
[
columnList
.
size
()];
columns
=
new
String
[
columnList
.
size
()];
columnList
.
toArray
(
columns
);
columnList
.
toArray
(
columns
);
rs
=
meta
.
getColumns
(
null
,
rs
=
meta
.
getColumns
(
null
,
Jdbc
Utils
.
escapeMetaDataPattern
(
schemaName
),
String
Utils
.
escapeMetaDataPattern
(
schemaName
),
Jdbc
Utils
.
escapeMetaDataPattern
(
tableName
),
String
Utils
.
escapeMetaDataPattern
(
tableName
),
null
);
null
);
for
(
int
i
=
0
;
rs
.
next
();
i
++)
{
for
(
int
i
=
0
;
rs
.
next
();
i
++)
{
columnTypes
[
i
]
=
rs
.
getInt
(
"DATA_TYPE"
);
columnTypes
[
i
]
=
rs
.
getInt
(
"DATA_TYPE"
);
}
}
if
(
keyList
.
size
()
==
0
)
{
if
(
keyList
.
size
()
==
0
)
{
rs
=
meta
.
getPrimaryKeys
(
null
,
rs
=
meta
.
getPrimaryKeys
(
null
,
Jdbc
Utils
.
escapeMetaDataPattern
(
schemaName
),
String
Utils
.
escapeMetaDataPattern
(
schemaName
),
tableName
);
tableName
);
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
keyList
.
add
(
rs
.
getString
(
"COLUMN_NAME"
));
keyList
.
add
(
rs
.
getString
(
"COLUMN_NAME"
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/result/UpdatableRow.java
浏览文件 @
511fceff
...
@@ -14,7 +14,6 @@ import java.util.ArrayList;
...
@@ -14,7 +14,6 @@ import java.util.ArrayList;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.New
;
import
org.h2.util.New
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
...
@@ -66,8 +65,8 @@ public class UpdatableRow {
...
@@ -66,8 +65,8 @@ public class UpdatableRow {
}
}
final
DatabaseMetaData
meta
=
conn
.
getMetaData
();
final
DatabaseMetaData
meta
=
conn
.
getMetaData
();
ResultSet
rs
=
meta
.
getTables
(
null
,
ResultSet
rs
=
meta
.
getTables
(
null
,
Jdbc
Utils
.
escapeMetaDataPattern
(
schemaName
),
String
Utils
.
escapeMetaDataPattern
(
schemaName
),
Jdbc
Utils
.
escapeMetaDataPattern
(
tableName
),
String
Utils
.
escapeMetaDataPattern
(
tableName
),
new
String
[]
{
"TABLE"
});
new
String
[]
{
"TABLE"
});
if
(!
rs
.
next
())
{
if
(!
rs
.
next
())
{
return
;
return
;
...
@@ -83,7 +82,7 @@ public class UpdatableRow {
...
@@ -83,7 +82,7 @@ public class UpdatableRow {
boolean
toUpper
=
!
table
.
equals
(
tableName
)
&&
table
.
equalsIgnoreCase
(
tableName
);
boolean
toUpper
=
!
table
.
equals
(
tableName
)
&&
table
.
equalsIgnoreCase
(
tableName
);
key
=
New
.
arrayList
();
key
=
New
.
arrayList
();
rs
=
meta
.
getPrimaryKeys
(
null
,
rs
=
meta
.
getPrimaryKeys
(
null
,
Jdbc
Utils
.
escapeMetaDataPattern
(
schemaName
),
String
Utils
.
escapeMetaDataPattern
(
schemaName
),
tableName
);
tableName
);
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
String
c
=
rs
.
getString
(
"COLUMN_NAME"
);
String
c
=
rs
.
getString
(
"COLUMN_NAME"
);
...
@@ -95,7 +94,7 @@ public class UpdatableRow {
...
@@ -95,7 +94,7 @@ public class UpdatableRow {
}
}
key
.
clear
();
key
.
clear
();
rs
=
meta
.
getIndexInfo
(
null
,
rs
=
meta
.
getIndexInfo
(
null
,
Jdbc
Utils
.
escapeMetaDataPattern
(
schemaName
),
String
Utils
.
escapeMetaDataPattern
(
schemaName
),
tableName
,
true
,
true
);
tableName
,
true
,
true
);
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
int
pos
=
rs
.
getShort
(
"ORDINAL_POSITION"
);
int
pos
=
rs
.
getShort
(
"ORDINAL_POSITION"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/JdbcUtils.java
浏览文件 @
511fceff
...
@@ -118,19 +118,6 @@ public class JdbcUtils {
...
@@ -118,19 +118,6 @@ public class JdbcUtils {
return
getConnection
(
driver
,
url
,
prop
);
return
getConnection
(
driver
,
url
,
prop
);
}
}
/**
* Escape table or schema patterns used for DatabaseMetaData functions.
*
* @param pattern the pattern
* @return the escaped pattern
*/
public
static
String
escapeMetaDataPattern
(
String
pattern
)
{
if
(
pattern
==
null
||
pattern
.
length
()
==
0
)
{
return
pattern
;
}
return
StringUtils
.
replaceAll
(
pattern
,
"\\"
,
"\\\\"
);
}
/**
/**
* Open a new database connection with the given settings.
* Open a new database connection with the given settings.
*
*
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
511fceff
...
@@ -1078,4 +1078,17 @@ public class StringUtils {
...
@@ -1078,4 +1078,17 @@ public class StringUtils {
}
}
}
}
/**
* Escape table or schema patterns used for DatabaseMetaData functions.
*
* @param pattern the pattern
* @return the escaped pattern
*/
public
static
String
escapeMetaDataPattern
(
String
pattern
)
{
if
(
pattern
==
null
||
pattern
.
length
()
==
0
)
{
return
pattern
;
}
return
replaceAll
(
pattern
,
"\\"
,
"\\\\"
);
}
}
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论