summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine
diff options
context:
space:
mode:
Diffstat (limited to 'org/madore/damlengine')
-rw-r--r--org/madore/damlengine/WeblogPopulate.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/org/madore/damlengine/WeblogPopulate.java b/org/madore/damlengine/WeblogPopulate.java
index 0cc6620..c3b76b9 100644
--- a/org/madore/damlengine/WeblogPopulate.java
+++ b/org/madore/damlengine/WeblogPopulate.java
@@ -49,8 +49,10 @@ public final class WeblogPopulate {
= conn.prepareStatement("INSERT INTO entries(id,edate,lang,title,title_xml,content,sha1) VALUES (?,?,?,?,?::xml,?::xml,?)");
final PreparedStatement insertCSt
= conn.prepareStatement("INSERT INTO entries(id,edate,lang,title,title_xml,content,sha1,cdate) VALUES (?,?,?,?,?::xml,?::xml,?,?::timestamptz)");
- final PreparedStatement updateSt
+ final PreparedStatement updateNSt
= conn.prepareStatement("UPDATE entries SET (edate,mdate,lang,title,title_xml,content,sha1)=(?,DEFAULT,?,?,?::xml,?::xml,?) WHERE id=?");
+ final PreparedStatement updateCSt
+ = conn.prepareStatement("UPDATE entries SET (edate,mdate,lang,title,title_xml,content,sha1,cdate)=(?,DEFAULT,?,?,?::xml,?::xml,?,?::timestamptz) WHERE id=?");
final PreparedStatement clearCatSt
= conn.prepareStatement("DELETE FROM incat WHERE id=?");
final PreparedStatement setCatSt
@@ -97,13 +99,23 @@ public final class WeblogPopulate {
conn.setAutoCommit(false);
if ( exists ) {
System.err.println("Updating entry "+id);
+ PreparedStatement updateSt;
+ if ( cdate == null )
+ updateSt = updateNSt;
+ else
+ updateSt = updateCSt;
updateSt.setString(1, date);
updateSt.setString(2, lang);
updateSt.setString(3, titleTxt);
updateSt.setString(4, titleXml);
updateSt.setString(5, content);
updateSt.setString(6, digest);
- updateSt.setInt(7, id);
+ if ( cdate != null ) {
+ updateSt.setString(7, cdate);
+ updateSt.setInt(8, id);
+ } else {
+ updateSt.setInt(7, id);
+ }
updateSt.executeUpdate();
} else {
System.err.println("Registering entry "+id);
@@ -138,7 +150,8 @@ public final class WeblogPopulate {
checkSt.close();
insertNSt.close();
insertCSt.close();
- updateSt.close();
+ updateNSt.close();
+ updateCSt.close();
clearCatSt.close();
setCatSt.close();