diff options
author | David A. Madore <david+git@madore.org> | 2014-10-12 17:59:13 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2014-10-12 17:59:54 +0200 |
commit | 4e7ceb1dde219d03e577c7c038e19f977c9abc29 (patch) | |
tree | a45dfa00055bff48662fef644e4d955f873fc121 /org/madore/damlengine/WeblogSummary.java | |
parent | fc921ecbda441f37ff33a1e4b76581434fc3c954 (diff) | |
download | damlengine-4e7ceb1dde219d03e577c7c038e19f977c9abc29.tar.gz damlengine-4e7ceb1dde219d03e577c7c038e19f977c9abc29.tar.bz2 damlengine-4e7ceb1dde219d03e577c7c038e19f977c9abc29.zip |
Separate the "has_cut" property from "do_single_page".
Note: the following SQL should be used to upgrade the database:
ALTER TABLE entries ADD COLUMN has_cut boolean NOT NULL DEFAULT FALSE ;
UPDATE entries SET has_cut = (array_length(xpath('.//d:cut-here', content, ARRAY[ARRAY['d', 'http://www.madore.org/~david/NS/daml/']]), 1) NOTNULL) ;
-- Check that the following returns nothing:
SELECT edate , id FROM entries WHERE has_cut != ( do_single_page NOTNULL ) ;
Diffstat (limited to 'org/madore/damlengine/WeblogSummary.java')
-rw-r--r-- | org/madore/damlengine/WeblogSummary.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/org/madore/damlengine/WeblogSummary.java b/org/madore/damlengine/WeblogSummary.java index 4819017..662c1d2 100644 --- a/org/madore/damlengine/WeblogSummary.java +++ b/org/madore/damlengine/WeblogSummary.java @@ -15,16 +15,18 @@ public final class WeblogSummary { String lang; String title; String titleXml; String doSinglePage; + boolean hasCut; HashSet<String> catSet; public EntrySummary(int id, String date, String lang, String title, String titleXml, - String doSinglePage) { + String doSinglePage, boolean hasCut) { this.id = id; this.date = date; this.lang = lang; this.title = title; this.titleXml = titleXml; this.doSinglePage = doSinglePage; + this.hasCut = hasCut; this.catSet = null; } } @@ -49,7 +51,7 @@ public final class WeblogSummary { singleton.obtainedTime = System.currentTimeMillis(); final Connection conn = WeblogDatabaseConnection.getConnection(); final PreparedStatement selSt - = conn.prepareStatement("SELECT id , edate , lang , title , title_xml , do_single_page FROM entries"); + = conn.prepareStatement("SELECT id , edate , lang , title , title_xml , do_single_page , has_cut FROM entries"); final ResultSet selRes = selSt.executeQuery(); while ( selRes.next() ) { int id = selRes.getInt(1); @@ -58,7 +60,8 @@ public final class WeblogSummary { String title = selRes.getString(4); String titleXml = selRes.getString(5); String doSinglePage = selRes.getString(6); - singleton.entries.put(id, new EntrySummary(id, date, lang, title, titleXml, doSinglePage)); + boolean hasCut = selRes.getBoolean(7); + singleton.entries.put(id, new EntrySummary(id, date, lang, title, titleXml, doSinglePage, hasCut)); } final PreparedStatement catSt = conn.prepareStatement("SELECT id , code FROM incat"); |