Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
260fab0d
提交
260fab0d
authored
8月 28, 2011
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Source code switching using //## has been simplified.
上级
2c6aa619
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
58 行增加
和
58 行删除
+58
-58
FullTextLucene.java
h2/src/main/org/h2/fulltext/FullTextLucene.java
+34
-34
JdbcConnectionPool.java
h2/src/main/org/h2/jdbcx/JdbcConnectionPool.java
+10
-10
JdbcDataSource.java
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
+8
-8
JdbcXAConnection.java
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
+6
-6
没有找到文件。
h2/src/main/org/h2/fulltext/FullTextLucene.java
浏览文件 @
260fab0d
...
@@ -38,11 +38,11 @@ import org.h2.util.New;
...
@@ -38,11 +38,11 @@ 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
;
import
org.h2.util.Utils
;
import
org.h2.util.Utils
;
/*## LUCENE2
begin
##
/*## LUCENE2 ##
import org.apache.lucene.index.IndexModifier;
import org.apache.lucene.index.IndexModifier;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.Hits;
## LUCENE2 end ##
*/
//
*/
//## LUCENE3
begin
##
//## LUCENE3 ##
import
java.io.File
;
import
java.io.File
;
import
org.apache.lucene.search.ScoreDoc
;
import
org.apache.lucene.search.ScoreDoc
;
import
org.apache.lucene.search.TopDocs
;
import
org.apache.lucene.search.TopDocs
;
...
@@ -50,7 +50,7 @@ import org.apache.lucene.store.FSDirectory;
...
@@ -50,7 +50,7 @@ import org.apache.lucene.store.FSDirectory;
import
org.apache.lucene.store.Directory
;
import
org.apache.lucene.store.Directory
;
import
org.apache.lucene.util.Version
;
import
org.apache.lucene.util.Version
;
import
org.apache.lucene.index.IndexWriter
;
import
org.apache.lucene.index.IndexWriter
;
//
## LUCENE3 end ##
//
*/
/**
/**
* This class implements the full text search based on Apache Lucene.
* This class implements the full text search based on Apache Lucene.
...
@@ -255,13 +255,13 @@ public class FullTextLucene extends FullText {
...
@@ -255,13 +255,13 @@ public class FullTextLucene extends FullText {
IndexAccess
access
=
INDEX_ACCESS
.
get
(
path
);
IndexAccess
access
=
INDEX_ACCESS
.
get
(
path
);
if
(
access
==
null
)
{
if
(
access
==
null
)
{
try
{
try
{
/*## LUCENE2
begin
##
/*## LUCENE2 ##
boolean recreate = !IndexReader.indexExists(path);
boolean recreate = !IndexReader.indexExists(path);
Analyzer analyzer = new StandardAnalyzer();
Analyzer analyzer = new StandardAnalyzer();
access = new IndexAccess();
access = new IndexAccess();
access.modifier = new IndexModifier(path, analyzer, recreate);
access.modifier = new IndexModifier(path, analyzer, recreate);
## LUCENE2 end ##
*/
//
*/
//## LUCENE3
begin
##
//## LUCENE3 ##
File
f
=
new
File
(
path
);
File
f
=
new
File
(
path
);
Directory
indexDir
=
FSDirectory
.
open
(
f
);
Directory
indexDir
=
FSDirectory
.
open
(
f
);
boolean
recreate
=
!
IndexReader
.
indexExists
(
indexDir
);
boolean
recreate
=
!
IndexReader
.
indexExists
(
indexDir
);
...
@@ -274,7 +274,7 @@ public class FullTextLucene extends FullText {
...
@@ -274,7 +274,7 @@ public class FullTextLucene extends FullText {
access
.
writer
=
writer
;
access
.
writer
=
writer
;
access
.
reader
=
reader
;
access
.
reader
=
reader
;
access
.
searcher
=
new
IndexSearcher
(
reader
);
access
.
searcher
=
new
IndexSearcher
(
reader
);
//
## LUCENE3 end ##
//
*/
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
convertException
(
e
);
throw
convertException
(
e
);
}
}
...
@@ -348,15 +348,15 @@ public class FullTextLucene extends FullText {
...
@@ -348,15 +348,15 @@ public class FullTextLucene extends FullText {
synchronized
(
INDEX_ACCESS
)
{
synchronized
(
INDEX_ACCESS
)
{
try
{
try
{
INDEX_ACCESS
.
remove
(
indexPath
);
INDEX_ACCESS
.
remove
(
indexPath
);
/*## LUCENE2
begin
##
/*## LUCENE2 ##
access.modifier.flush();
access.modifier.flush();
access.modifier.close();
access.modifier.close();
## LUCENE2 end ##
*/
//
*/
//## LUCENE3
begin
##
//## LUCENE3 ##
access
.
searcher
.
close
();
access
.
searcher
.
close
();
access
.
reader
.
close
();
access
.
reader
.
close
();
access
.
writer
.
close
();
access
.
writer
.
close
();
//
## LUCENE3 end ##
//
*/
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
convertException
(
e
);
throw
convertException
(
e
);
}
}
...
@@ -385,7 +385,7 @@ public class FullTextLucene extends FullText {
...
@@ -385,7 +385,7 @@ public class FullTextLucene extends FullText {
}
}
try
{
try
{
IndexAccess
access
=
getIndexAccess
(
conn
);
IndexAccess
access
=
getIndexAccess
(
conn
);
/*## LUCENE2
begin
##
/*## LUCENE2 ##
access.modifier.flush();
access.modifier.flush();
String path = getIndexPath(conn);
String path = getIndexPath(conn);
IndexReader reader = IndexReader.open(path);
IndexReader reader = IndexReader.open(path);
...
@@ -401,8 +401,8 @@ public class FullTextLucene extends FullText {
...
@@ -401,8 +401,8 @@ public class FullTextLucene extends FullText {
for (int i = 0; i < limit && i + offset < max; i++) {
for (int i = 0; i < limit && i + offset < max; i++) {
Document doc = hits.doc(i + offset);
Document doc = hits.doc(i + offset);
float score = hits.score(i + offset);
float score = hits.score(i + offset);
## LUCENE2 end ##
*/
//
*/
//## LUCENE3
begin
##
//## LUCENE3 ##
// take a reference as the searcher may change
// take a reference as the searcher may change
Searcher
searcher
=
access
.
searcher
;
Searcher
searcher
=
access
.
searcher
;
// reuse the same analyzer; it's thread-safe;
// reuse the same analyzer; it's thread-safe;
...
@@ -426,7 +426,7 @@ public class FullTextLucene extends FullText {
...
@@ -426,7 +426,7 @@ public class FullTextLucene extends FullText {
ScoreDoc
sd
=
docs
.
scoreDocs
[
i
+
offset
];
ScoreDoc
sd
=
docs
.
scoreDocs
[
i
+
offset
];
Document
doc
=
searcher
.
doc
(
sd
.
doc
);
Document
doc
=
searcher
.
doc
(
sd
.
doc
);
float
score
=
sd
.
score
;
float
score
=
sd
.
score
;
//
## LUCENE3 end ##
//
*/
String
q
=
doc
.
get
(
LUCENE_FIELD_QUERY
);
String
q
=
doc
.
get
(
LUCENE_FIELD_QUERY
);
if
(
data
)
{
if
(
data
)
{
int
idx
=
q
.
indexOf
(
" WHERE "
);
int
idx
=
q
.
indexOf
(
" WHERE "
);
...
@@ -449,10 +449,10 @@ public class FullTextLucene extends FullText {
...
@@ -449,10 +449,10 @@ public class FullTextLucene extends FullText {
result
.
addRow
(
q
,
score
);
result
.
addRow
(
q
,
score
);
}
}
}
}
/*## LUCENE2
begin
##
/*## LUCENE2 ##
// TODO keep it open if possible
// TODO keep it open if possible
reader.close();
reader.close();
## LUCENE2 end ##
*/
//
*/
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
convertException
(
e
);
throw
convertException
(
e
);
}
}
...
@@ -582,7 +582,7 @@ public class FullTextLucene extends FullText {
...
@@ -582,7 +582,7 @@ public class FullTextLucene extends FullText {
* @param row the row
* @param row the row
*/
*/
protected
void
insert
(
Object
[]
row
)
throws
SQLException
{
protected
void
insert
(
Object
[]
row
)
throws
SQLException
{
/*## LUCENE2
begin
##
/*## LUCENE2 ##
String query = getQuery(row);
String query = getQuery(row);
Document doc = new Document();
Document doc = new Document();
doc.add(new Field(LUCENE_FIELD_QUERY, query,
doc.add(new Field(LUCENE_FIELD_QUERY, query,
...
@@ -614,8 +614,8 @@ public class FullTextLucene extends FullText {
...
@@ -614,8 +614,8 @@ public class FullTextLucene extends FullText {
} catch (IOException e) {
} catch (IOException e) {
throw convertException(e);
throw convertException(e);
}
}
## LUCENE2 end ##
*/
//
*/
//## LUCENE3
begin
##
//## LUCENE3 ##
String
query
=
getQuery
(
row
);
String
query
=
getQuery
(
row
);
Document
doc
=
new
Document
();
Document
doc
=
new
Document
();
doc
.
add
(
new
Field
(
LUCENE_FIELD_QUERY
,
query
,
doc
.
add
(
new
Field
(
LUCENE_FIELD_QUERY
,
query
,
...
@@ -655,7 +655,7 @@ public class FullTextLucene extends FullText {
...
@@ -655,7 +655,7 @@ public class FullTextLucene extends FullText {
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
convertException
(
e
);
throw
convertException
(
e
);
}
}
//
## LUCENE3 end ##
//
*/
}
}
/**
/**
...
@@ -667,12 +667,12 @@ public class FullTextLucene extends FullText {
...
@@ -667,12 +667,12 @@ public class FullTextLucene extends FullText {
String
query
=
getQuery
(
row
);
String
query
=
getQuery
(
row
);
try
{
try
{
Term
term
=
new
Term
(
LUCENE_FIELD_QUERY
,
query
);
Term
term
=
new
Term
(
LUCENE_FIELD_QUERY
,
query
);
/*## LUCENE2
begin
##
/*## LUCENE2 ##
indexAccess.modifier.deleteDocuments(term);
indexAccess.modifier.deleteDocuments(term);
## LUCENE2 end ##
*/
//
*/
//## LUCENE3
begin
##
//## LUCENE3 ##
indexAccess
.
writer
.
deleteDocuments
(
term
);
indexAccess
.
writer
.
deleteDocuments
(
term
);
//
## LUCENE3 end ##
//
*/
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
convertException
(
e
);
throw
convertException
(
e
);
}
}
...
@@ -706,30 +706,30 @@ public class FullTextLucene extends FullText {
...
@@ -706,30 +706,30 @@ public class FullTextLucene extends FullText {
/**
/**
* The index modified.
* The index modified.
*/
*/
/*## LUCENE2
begin
##
/*## LUCENE2 ##
IndexModifier modifier;
IndexModifier modifier;
## LUCENE2 end ##
*/
//
*/
/**
/**
* The index writer.
* The index writer.
*/
*/
//## LUCENE3
begin
##
//## LUCENE3 ##
IndexWriter
writer
;
IndexWriter
writer
;
//
## LUCENE3 end ##
//
*/
/**
/**
* The index reader.
* The index reader.
*/
*/
//## LUCENE3
begin
##
//## LUCENE3 ##
IndexReader
reader
;
IndexReader
reader
;
//
## LUCENE3 end ##
//
*/
/**
/**
* The index searcher.
* The index searcher.
*/
*/
//## LUCENE3
begin
##
//## LUCENE3 ##
Searcher
searcher
;
Searcher
searcher
;
//
## LUCENE3 end ##
//
*/
}
}
}
}
h2/src/main/org/h2/jdbcx/JdbcConnectionPool.java
浏览文件 @
260fab0d
...
@@ -31,13 +31,13 @@ import javax.sql.DataSource;
...
@@ -31,13 +31,13 @@ import javax.sql.DataSource;
import
javax.sql.PooledConnection
;
import
javax.sql.PooledConnection
;
import
org.h2.util.New
;
import
org.h2.util.New
;
//## Java 1.6
begin
##
//## Java 1.6 ##
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
//
## Java 1.6 end ##
//
*/
/*## Java 1.7
begin
##
/*## Java 1.7 ##
import java.util.logging.Logger;
import java.util.logging.Logger;
## Java 1.7 end ##
*/
//
*/
/**
/**
* A simple standalone JDBC connection pool.
* A simple standalone JDBC connection pool.
...
@@ -310,31 +310,31 @@ public class JdbcConnectionPool implements DataSource, ConnectionEventListener {
...
@@ -310,31 +310,31 @@ public class JdbcConnectionPool implements DataSource, ConnectionEventListener {
*
*
* @param iface the class
* @param iface the class
*/
*/
//## Java 1.6
begin
##
//## Java 1.6 ##
public
<
T
>
T
unwrap
(
Class
<
T
>
iface
)
throws
SQLException
{
public
<
T
>
T
unwrap
(
Class
<
T
>
iface
)
throws
SQLException
{
throw
DbException
.
getUnsupportedException
(
"unwrap"
);
throw
DbException
.
getUnsupportedException
(
"unwrap"
);
}
}
//
## Java 1.6 end ##
//
*/
/**
/**
* [Not supported] Checks if unwrap can return an object of this class.
* [Not supported] Checks if unwrap can return an object of this class.
*
*
* @param iface the class
* @param iface the class
*/
*/
//## Java 1.6
begin
##
//## Java 1.6 ##
public
boolean
isWrapperFor
(
Class
<?>
iface
)
throws
SQLException
{
public
boolean
isWrapperFor
(
Class
<?>
iface
)
throws
SQLException
{
throw
DbException
.
getUnsupportedException
(
"isWrapperFor"
);
throw
DbException
.
getUnsupportedException
(
"isWrapperFor"
);
}
}
//
## Java 1.6 end ##
//
*/
/**
/**
* [Not supported]
* [Not supported]
*/
*/
/*## Java 1.7
begin
##
/*## Java 1.7 ##
public Logger getParentLogger() {
public Logger getParentLogger() {
return null;
return null;
}
}
## Java 1.7 end ##
*/
//
*/
}
}
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
浏览文件 @
260fab0d
...
@@ -26,9 +26,9 @@ import org.h2.jdbc.JdbcConnection;
...
@@ -26,9 +26,9 @@ import org.h2.jdbc.JdbcConnection;
import
org.h2.message.TraceObject
;
import
org.h2.message.TraceObject
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
/*## Java 1.7
begin
##
/*## Java 1.7 ##
import java.util.logging.Logger;
import java.util.logging.Logger;
## Java 1.7 end ##
*/
//
*/
/**
/**
* A data source for H2 database connections. It is a factory for XAConnection
* A data source for H2 database connections. It is a factory for XAConnection
...
@@ -361,31 +361,31 @@ public class JdbcDataSource extends TraceObject
...
@@ -361,31 +361,31 @@ public class JdbcDataSource extends TraceObject
*
*
* @param iface the class
* @param iface the class
*/
*/
//## Java 1.6
begin
##
//## Java 1.6 ##
public
<
T
>
T
unwrap
(
Class
<
T
>
iface
)
throws
SQLException
{
public
<
T
>
T
unwrap
(
Class
<
T
>
iface
)
throws
SQLException
{
throw
unsupported
(
"unwrap"
);
throw
unsupported
(
"unwrap"
);
}
}
//
## Java 1.6 end ##
//
*/
/**
/**
* [Not supported] Checks if unwrap can return an object of this class.
* [Not supported] Checks if unwrap can return an object of this class.
*
*
* @param iface the class
* @param iface the class
*/
*/
//## Java 1.6
begin
##
//## Java 1.6 ##
public
boolean
isWrapperFor
(
Class
<?>
iface
)
throws
SQLException
{
public
boolean
isWrapperFor
(
Class
<?>
iface
)
throws
SQLException
{
throw
unsupported
(
"isWrapperFor"
);
throw
unsupported
(
"isWrapperFor"
);
}
}
//
## Java 1.6 end ##
//
*/
/**
/**
* [Not supported]
* [Not supported]
*/
*/
/*## Java 1.7
begin
##
/*## Java 1.7 ##
public Logger getParentLogger() {
public Logger getParentLogger() {
return null;
return null;
}
}
## Java 1.7 end ##
*/
//
*/
/**
/**
* INTERNAL
* INTERNAL
...
...
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
260fab0d
...
@@ -25,9 +25,9 @@ import org.h2.util.New;
...
@@ -25,9 +25,9 @@ import org.h2.util.New;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.message.TraceObject
;
import
org.h2.message.TraceObject
;
//## Java 1.6
begin
##
//## Java 1.6 ##
import
javax.sql.StatementEventListener
;
import
javax.sql.StatementEventListener
;
//
## Java 1.6 end ##
//
*/
/**
/**
* This class provides support for distributed transactions.
* This class provides support for distributed transactions.
...
@@ -369,22 +369,22 @@ public class JdbcXAConnection extends TraceObject implements XAConnection, XARes
...
@@ -369,22 +369,22 @@ public class JdbcXAConnection extends TraceObject implements XAConnection, XARes
*
*
* @param listener the new statement event listener
* @param listener the new statement event listener
*/
*/
//## Java 1.6
begin
##
//## Java 1.6 ##
public
void
addStatementEventListener
(
StatementEventListener
listener
)
{
public
void
addStatementEventListener
(
StatementEventListener
listener
)
{
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
//
## Java 1.6 end ##
//
*/
/**
/**
* [Not supported] Remove a statement event listener.
* [Not supported] Remove a statement event listener.
*
*
* @param listener the statement event listener
* @param listener the statement event listener
*/
*/
//## Java 1.6
begin
##
//## Java 1.6 ##
public
void
removeStatementEventListener
(
StatementEventListener
listener
)
{
public
void
removeStatementEventListener
(
StatementEventListener
listener
)
{
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
//
## Java 1.6 end ##
//
*/
/**
/**
* INTERNAL
* INTERNAL
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论