LauJensen / clojureql

ClojureQL is superior SQL integration for Clojure
https://clojureql.sabrecms.com
Eclipse Public License 1.0
284 stars 39 forks source link

conj! on mysql #76

Closed ostronom closed 13 years ago

ostronom commented 13 years ago

I'm using ClojureQL 1.1.0-SNAPSHOT.

When i'm trying to conj! a record in db, i get:

 SQLException:
      Message: Generated keys not requested. You need to specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate() or Connection.prepareStatement().
 SQLState: S1009
 Error Code: 0
 java.lang.Exception: transaction rolled back: Generated keys not requested. You need to specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate() or Connection.prepareStatement(). (NO_SOURCE_FILE:0)
LauJensen commented 13 years ago

Please attach the code and a description of the table

ostronom commented 13 years ago

CREATE TABLE entry ( id int(11) NOT NULL AUTO_INCREMENT, title varchar(200) NOT NULL, slug varchar(200) NOT NULL, shortlink varchar(200) NOT NULL DEFAULT '', date datetime NOT NULL, text text NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=utf8

ostronom commented 13 years ago

Oops.. 'Comment and close' :(

LauJensen commented 13 years ago

Alright, now we're only missing the clojure code...almost there :)

ostronom commented 13 years ago

Everything was fine, when i was using '1.0.0'. :)

 (conj! (table :entry) {:title "A" :text "A" :slug "A" :date "2010-11-11"}))
LauJensen commented 13 years ago

So am I to assume that you're wrapping this is a connection object using with-connection? Can you show me the struct?

LauJensen commented 13 years ago

And please stop closing the issue

ostronom commented 13 years ago

I have this https://gist.github.com/857725, then i do lein repl and (use 'cljblog.db), (in-ns 'cljblog.db) and (conj! (table :entry) {:title "A" :text "A" :slug "A" :date "2010-11-11"})).

LauJensen commented 13 years ago

Alright, thanks, I'll have a look

LauJensen commented 13 years ago

I assume you're using the 5.1.7 connector, could you please try with version 5.1.6 ?

ostronom commented 13 years ago

Yes, that fixes the problem.

LauJensen commented 13 years ago

Alright. The good thing is, that it solves your problem. That bad thing is that its out of my hands to fix.

ghost commented 13 years ago

The problem is still here with 5.1.16 connector, and IMO it leads to the bad user experience. I think it'd be reasonable to have "Compatibility with connectors" section (or something like this) on the clojureql.org, and explicitily state there that only 5.1.6 version is supported.