提交 81d5594e authored 作者: Thomas Mueller's avatar Thomas Mueller

Native fulltext search: before inserting or deleting data, FT_INIT() had to be called.

上级 99382477
...@@ -18,7 +18,11 @@ Change Log ...@@ -18,7 +18,11 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>The .trace.db file is now only created if required. <ul><li>The user home directory prefix (~) is now only expanded when followed by a slash
or backslash, or standing alone.
</li><li>Native fulltext search: before inserting or deleting data, FT_INIT() had to be called.
This is no longer required.
</li><li>The .trace.db file is now only created if required.
</li><li>Shell tool: improved PostgreSQL compatibility. </li><li>Shell tool: improved PostgreSQL compatibility.
</li><li>Trying to open a database in read-only mode when a .lock.db file exists will now fail </li><li>Trying to open a database in read-only mode when a .lock.db file exists will now fail
with a nice error message. with a nice error message.
......
...@@ -788,6 +788,9 @@ public class FullText { ...@@ -788,6 +788,9 @@ public class FullText {
public void init(Connection conn, String schemaName, String triggerName, public void init(Connection conn, String schemaName, String triggerName,
String tableName, boolean before, int type) throws SQLException { String tableName, boolean before, int type) throws SQLException {
setting = FullTextSettings.getInstance(conn); setting = FullTextSettings.getInstance(conn);
if (!setting.isInitialized()) {
FullText.init(conn);
}
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,
...@@ -1006,4 +1009,12 @@ public class FullText { ...@@ -1006,4 +1009,12 @@ public class FullText {
} }
/**
* INTERNAL
* Close all fulltext settings, freeing up memory.
*/
public static void closeAll() {
FullTextSettings.closeAll();
}
} }
...@@ -198,4 +198,11 @@ public class FullTextSettings { ...@@ -198,4 +198,11 @@ public class FullTextSettings {
return initialized; return initialized;
} }
/**
* Close all fulltext settings, freeing up memory.
*/
protected static void closeAll() {
SETTINGS.clear();
}
} }
...@@ -57,6 +57,7 @@ public class TestFullText extends TestBase { ...@@ -57,6 +57,7 @@ public class TestFullText extends TestBase {
println("Class not found, not tested: " + luceneFullTextClassName); println("Class not found, not tested: " + luceneFullTextClassName);
// ok // ok
} }
FullText.closeAll();
deleteDb("fullText"); deleteDb("fullText");
deleteDb("fullTextReopen"); deleteDb("fullTextReopen");
} }
...@@ -188,6 +189,12 @@ public class TestFullText extends TestBase { ...@@ -188,6 +189,12 @@ public class TestFullText extends TestBase {
stat.executeQuery("SELECT * FROM " + prefix + "_SEARCH(NULL, 0, 0)"); stat.executeQuery("SELECT * FROM " + prefix + "_SEARCH(NULL, 0, 0)");
stat.execute("INSERT INTO TEST VALUES(2, NULL)"); stat.execute("INSERT INTO TEST VALUES(2, NULL)");
conn.close(); conn.close();
FullText.closeAll();
conn = getConnection("fullTextReopen");
stat = conn.createStatement();
stat.execute("INSERT INTO TEST VALUES(3, 'Hello')");
conn.close();
} }
private void testPerformance(boolean lucene) throws SQLException { private void testPerformance(boolean lucene) throws SQLException {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论