Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c7ab9de0
提交
c7ab9de0
authored
9月 11, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The native fulltext index kept a reference to a database after the database was closed.
上级
45d8571a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
25 行删除
+16
-25
FullText.java
h2/src/main/org/h2/fulltext/FullText.java
+4
-9
FullTextSettings.java
h2/src/main/org/h2/fulltext/FullTextSettings.java
+12
-16
没有找到文件。
h2/src/main/org/h2/fulltext/FullText.java
浏览文件 @
c7ab9de0
...
...
@@ -51,6 +51,8 @@ public class FullText {
private
static
final
String
TRIGGER_PREFIX
=
"FT_"
;
private
static
final
String
SCHEMA
=
"FT"
;
private
static
final
String
SELECT_MAP_BY_WORD_ID
=
"SELECT ROWID FROM "
+
SCHEMA
+
".MAP WHERE WORDID=?"
;
private
static
final
String
SELECT_ROW_BY_ID
=
"SELECT KEY, INDEXID FROM "
+
SCHEMA
+
".ROWS WHERE ID=?"
;
/**
* A column name of the result set returned by the searchData method.
...
...
@@ -517,7 +519,7 @@ public class FullText {
HashSet
<
Integer
>
rIds
=
null
,
lastRowIds
=
null
;
HashMap
<
String
,
Integer
>
allWords
=
setting
.
getWordList
();
PreparedStatement
prepSelectMapByWordId
=
setting
.
getPrepSelectMapByWordId
(
);
PreparedStatement
prepSelectMapByWordId
=
setting
.
prepare
(
conn
,
SELECT_MAP_BY_WORD_ID
);
for
(
String
word
:
words
)
{
lastRowIds
=
rIds
;
rIds
=
New
.
hashSet
();
...
...
@@ -537,7 +539,7 @@ public class FullText {
if
(
rIds
==
null
||
rIds
.
size
()
==
0
)
{
return
result
;
}
PreparedStatement
prepSelectRowById
=
setting
.
getPrepSelectRowById
(
);
PreparedStatement
prepSelectRowById
=
setting
.
prepare
(
conn
,
SELECT_ROW_BY_ID
);
int
rowCount
=
0
;
for
(
int
rowId
:
rIds
)
{
prepSelectRowById
.
setInt
(
1
,
rowId
);
...
...
@@ -787,13 +789,6 @@ public class FullText {
"DELETE FROM "
+
SCHEMA
+
".MAP WHERE ROWID=? AND WORDID=?"
);
prepSelectRow
=
conn
.
prepareStatement
(
"SELECT ID FROM "
+
SCHEMA
+
".ROWS WHERE HASH=? AND INDEXID=? AND KEY=?"
);
PreparedStatement
prepSelectMapByWordId
=
conn
.
prepareStatement
(
"SELECT ROWID FROM "
+
SCHEMA
+
".MAP WHERE WORDID=?"
);
PreparedStatement
prepSelectRowById
=
conn
.
prepareStatement
(
"SELECT KEY, INDEXID FROM "
+
SCHEMA
+
".ROWS WHERE ID=?"
);
setting
.
setPrepSelectMapByWordId
(
prepSelectMapByWordId
);
setting
.
setPrepSelectRowById
(
prepSelectRowById
);
}
/**
...
...
h2/src/main/org/h2/fulltext/FullTextSettings.java
浏览文件 @
c7ab9de0
...
...
@@ -14,6 +14,7 @@ import java.sql.Statement;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
org.h2.util.New
;
import
org.h2.util.SoftHashMap
;
/**
* The global settings of a full text search.
...
...
@@ -26,8 +27,7 @@ class FullTextSettings {
private
HashSet
<
String
>
ignoreList
=
New
.
hashSet
();
private
HashMap
<
String
,
Integer
>
words
=
New
.
hashMap
();
private
HashMap
<
Integer
,
IndexInfo
>
indexes
=
New
.
hashMap
();
private
PreparedStatement
prepSelectMapByWordId
;
private
PreparedStatement
prepSelectRowById
;
private
SoftHashMap
<
String
,
PreparedStatement
>
cache
=
new
SoftHashMap
<
String
,
PreparedStatement
>();
private
FullTextSettings
()
{
// don't allow construction
...
...
@@ -104,20 +104,16 @@ class FullTextSettings {
return
path
;
}
PreparedStatement
getPrepSelectMapByWordId
()
{
return
prepSelectMapByWordId
;
synchronized
PreparedStatement
prepare
(
Connection
conn
,
String
sql
)
throws
SQLException
{
PreparedStatement
prep
=
cache
.
get
(
sql
);
if
(
prep
!=
null
&&
prep
.
getConnection
().
isClosed
())
{
prep
=
null
;
}
void
setPrepSelectMapByWordId
(
PreparedStatement
prepSelectMapByWordId
)
{
this
.
prepSelectMapByWordId
=
prepSelectMapByWordId
;
}
PreparedStatement
getPrepSelectRowById
()
{
return
prepSelectRowById
;
if
(
prep
==
null
)
{
prep
=
conn
.
prepareStatement
(
sql
);
cache
.
put
(
sql
,
prep
);
}
void
setPrepSelectRowById
(
PreparedStatement
prepSelectRowById
)
{
this
.
prepSelectRowById
=
prepSelectRowById
;
return
prep
;
}
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论