The sample code for the book now includes a clojure.contrib.sql  
example with date handling that may be helpful [1]. I tested with  
HSQLDB, please let me know if it doesn't work with postgresql.
Cheers,
Stuart

[1] 
http://github.com/stuarthalloway/programming-clojure/tree/master/examples/snippet.clj

>
> (defn inse []
>  (sql/with-connection db
>    (sql/transaction
>     (insert-rows :r [[1 2 "date '2008-12-03'" 3]])))
>  nil)
>
> I have tried all kinds of variations. it works perfectly with another
> table, like (int,int,int,int) and passing [1,2,3,4]
> so it is the type of column 3 that is the problem.
>
> "2008-12-03"
> "'2008-12-03'"
> "date 2008-12-03"
> etc
> tried all combos.
>
>
>
> java.lang.Exception: transaction rolled back: Batch entry 0 insert
> into reviews  values (1488844,1,2005-09-06,3) was aborted.  Call
> getNextException to see the cause. (parsing.clj:0)
> user=> java.lang.Exception: transaction rolled back: Batch entry 0
> insert into reviews  values (1,2,2008-12-02,3) was aborted.  Call
> getNextException to see the cause. (pg.clj:0)
> user=> java.lang.Exception: transaction rolled back: Batch entry 0
> insert into reviews  values (1,2,2008-12-02,3) was aborted.  Call
> getNextException to see the cause. (pg.clj:0)
> user=> (.getNextException)
> java.lang.IllegalArgumentException: Malformed member expression,
> expecting (.member target ...) (NO_SOURCE_FILE:50)
> user=> (.getNextException 1)
> java.lang.IllegalArgumentException: No matching field found:
> getNextException for class java.lang.Integer (NO_SOURCE_FILE:0)
> user=> (.getNextException java.lang.Exception)
> java.lang.IllegalArgumentException: No matching field found:
> getNextException for class java.lang.Class (NO_SOURCE_FILE:0)
> user=> (.getNextException e)
> java.lang.Exception: Unable to resolve symbol: e in this context
> (NO_SOURCE_FILE:53)
> user=> (printStackTrace)
> java.lang.Exception: Unable to resolve symbol: printStackTrace in this
> context (NO_SOURCE_FILE:54)
> user=> (.printStackTrace)
> java.lang.IllegalArgumentException: Malformed member expression,
> expecting (.member target ...) (NO_SOURCE_FILE:55)
> user=> .printStackTrace
> java.lang.Exception: Unable to resolve symbol: .printStackTrace in
> this context (NO_SOURCE_FILE:0)
> user=> (System/getProperty "java.vm.version")
>
> "10.0-b22"
> user=> java.lang.Exception: transaction rolled back: Batch entry 0
> insert into r  values (1,2,2008-12-02,3) was aborted.  Call
> getNextException to see the cause. (pg.clj:0)
> user=> ("2008-12")
> java.lang.ClassCastException: java.lang.String cannot be cast to
> clojure.lang.IFn (NO_SOURCE_FILE:0)
> user=> java.lang.Exception: transaction rolled back: Batch entry 0
> insert into r  values (1,2,"2008-12-02",3) was aborted.  Call
> getNextException to see the cause. (pg.clj:0)
> user=> java.lang.Exception: Unsupported escape character: \' (pg.clj:
> 59)
> user=> java.lang.NumberFormatException: Invalid number: 2008-12-02
> (pg.clj:59)
> user=> java.lang.Exception: transaction rolled back: Batch entry 0
> insert into r  values (1,2,'2008-12-02',3) was aborted.  Call
> getNextException to see the cause. (pg.clj:0)
> user=> (System/getNextException)
> java.lang.NoSuchFieldException: getNextException (NO_SOURCE_FILE:65)
> user=> java.lang.Exception: transaction rolled back: Batch entry 0
> insert into r  values (1,2,2008-12-02,3) was aborted.  Call
> getNextException to see the cause. (pg.clj:0)
> user=> (System/getNextException)
> java.lang.NoSuchFieldException: getNextException (NO_SOURCE_FILE:67)
> user=> (System/getNextException)
> java.lang.NoSuchFieldException: getNextException (NO_SOURCE_FILE:68)
> user=> (System/getNextException)
> java.lang.NoSuchFieldException: getNextException (NO_SOURCE_FILE:69)
> user=> (System/getNextException)
> java.lang.NoSuchFieldException: getNextException (NO_SOURCE_FILE:70)
> user=> nil
> user=> nil
> user=> java.lang.Exception: transaction rolled back: Batch entry 0
> insert into r  values (1,2,NULL,3) was aborted.  Call getNextException
> to see the cause. (pg.clj:0)
> user=> java.lang.Exception: Unsupported escape character: \' (pg.clj:
> 59)
> user=> (.replace '2008-12-025' "5" "")
> java.lang.NumberFormatException: Invalid number: 2008-12-025
> user=> "5"
> user=> ""
> user=> java.lang.Exception: Unmatched delimiter: )
> user=> (.replace "2008-12-025" "5" "")
> "2008-12-02"
> user=> java.lang.Exception: transaction rolled back: Batch entry 0
> insert into r  values (1,2,'2008-12-03',3) was aborted.  Call
> getNextException to see the cause. (pg.clj:0)
> user=> java.lang.Exception: transaction rolled back: Batch entry 0
> insert into r  values (1,2,date '2008-12-03',3) was aborted.  Call
> getNextException to see the cause. (pg.clj:0)
> user=>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to