summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-09-05 19:54:02 +0200
committerDavid A. Madore <david+git@madore.org>2011-09-05 19:54:02 +0200
commitff2d05fd5dfb34cb369b1a700d9b439d9ad628e4 (patch)
treec4a384466d5505fc4541a9ee751f5e7a62f4870f
parentb401a170b030525ae6ba3937d743856667c17d90 (diff)
parent3c7dc3cc8c6a07c758af062607158c5ffbc57ea0 (diff)
downloaddamlengine-ff2d05fd5dfb34cb369b1a700d9b439d9ad628e4.tar.gz
damlengine-ff2d05fd5dfb34cb369b1a700d9b439d9ad628e4.tar.bz2
damlengine-ff2d05fd5dfb34cb369b1a700d9b439d9ad628e4.zip
Merge branch 'master' of git.madore.org:damlengine
-rw-r--r--org/madore/damlengine/Resolver.java1
-rw-r--r--org/madore/damlengine/WeblogPopulate.java19
2 files changed, 16 insertions, 4 deletions
diff --git a/org/madore/damlengine/Resolver.java b/org/madore/damlengine/Resolver.java
index fdbfe97..575764c 100644
--- a/org/madore/damlengine/Resolver.java
+++ b/org/madore/damlengine/Resolver.java
@@ -1,6 +1,5 @@
package org.madore.damlengine;
-import java.io.StringReader;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
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();