My first problem was to save a timestamp value. I defined a field in
pgsql as "timestamp" and wasn't able to store a simple timestamp value
because I got type mismatch errors and it also displayed the statement
which I could copy and execute successfully in pgadmin which confused
me a lot.

I seem to recall being able to store a java.sql.Timestamp in my PG DB.

E.g., I have a "now" function:

  (java.sql.Timestamp. (.getTime (java.util.Date.)))


so I could successfully save timestamps to my db by "casting" my
strings to a java timestamp (timestamp (params :foobar)).

This is really nothing to do with c.c.sql: JDBC is in charge of converting Java objects into native DB datatypes. It simply doesn't know how to cast a String to a Timestamp.


However, what I complain about is that in no fracking example any
typecast was used and I assumed this is normal as supposed to other
interfaces/libs I've used in the past.

I've never used typecasts in this way. Using the correct Java class has always been my solution.

Possibly you're experiencing a disconnect when you're investigating issues. In every case where some Java object is being interpolated into a query, it's JDBC that's doing the work. Thus, you should be searching for

http://www.google.com/search?q=jdbc+timestamp+postgresql

(981,000 results)

not

http://www.google.com/search?q=clojure.contrib.sql+timestamp+postgresql

(1,030 irrelevant results)

c.c.sql is a handy wrapper around JDBC.

HTH,

-R

--
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
Note that posts from new members are moderated - please be patient with your 
first post.
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