summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-09-13 11:31:33 +0200
committerDavid A. Madore <david+git@madore.org>2011-09-13 11:31:33 +0200
commitec6dc4079d2ad28d0ee62b5faf223acaaf48ef59 (patch)
treea7e769de25b9cbbc6fb11a18bf06f0a160a2f7f5
parent0ed3ffe0e3bf5f41bd6c4f0f8755988771e87312 (diff)
downloaddamlengine-ec6dc4079d2ad28d0ee62b5faf223acaaf48ef59.tar.gz
damlengine-ec6dc4079d2ad28d0ee62b5faf223acaaf48ef59.tar.bz2
damlengine-ec6dc4079d2ad28d0ee62b5faf223acaaf48ef59.zip
Impose format for entry cdate attribute.
-rw-r--r--org/madore/damlengine/WeblogPopulate.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/org/madore/damlengine/WeblogPopulate.java b/org/madore/damlengine/WeblogPopulate.java
index c3b76b9..9b6694e 100644
--- a/org/madore/damlengine/WeblogPopulate.java
+++ b/org/madore/damlengine/WeblogPopulate.java
@@ -53,6 +53,8 @@ public final class WeblogPopulate {
= 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 checkDateSt
+ = conn.prepareStatement("SELECT to_char(cdate,'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"') FROM entries WHERE id=?");
final PreparedStatement clearCatSt
= conn.prepareStatement("DELETE FROM incat WHERE id=?");
final PreparedStatement setCatSt
@@ -135,6 +137,14 @@ public final class WeblogPopulate {
insertSt.setString(8, cdate);
insertSt.executeUpdate();
}
+ if ( ! Pattern.matches("^\\d{4}-\\d{2}-\\d{2}T\\d{2}\\:\\d{2}(?:\\:\\d{2})?(?:Z|[\\+\\-]\\d{2}\\:\\d{2})$", cdate) ) {
+ checkDateSt.setInt(1, id);
+ ResultSet checkDate = checkDateSt.executeQuery();
+ checkDate.next();
+ String checkDateStr = checkDate.getString(1);
+ System.err.println("cdate for entry "+id+": "
+ +checkDateStr);
+ }
clearCatSt.setInt(1, id);
clearCatSt.executeUpdate();
for ( String cat : catList ) {
@@ -152,6 +162,7 @@ public final class WeblogPopulate {
insertCSt.close();
updateNSt.close();
updateCSt.close();
+ checkDateSt.close();
clearCatSt.close();
setCatSt.close();