Fork me on GitHub
#sql
<
2017-07-14
>
kurt-o-sys01:07:20

@seancorfield Right, I see. So I'll stick to the standard. This leaves me with a few not-so-important questions, like: * if the author copies the code base and rewrites it, why wouldn't he submit to the original one? * if there are really some goodies in clojure.jdbc (better performance? less code duplication? sub-transaction support? ...? - according to the author: http://funcool.github.io/clojure.jdbc/latest/#why-another-jdbc-wrapper ), why not take parts of that code and add it to yours (and acknowledge the author of clojure.jdbc)? It's just awkward to me to have 2 libs, doing the same, without being substentially different. The author of clojure.jdbc claims it's completely different: > Is this a fork of java.jdbc? No. It is an alternative implementation. is not really true, is it?

seancorfield01:07:56

@kurt-o-sys Because the Clojure Contrib libraries are managed under a Contributor’s Agreement and the EPL license. The clojure.jdbc author’s work would need to be submitted as patches and they’d have to agree to the CA and the legal aspects of it.

seancorfield01:07:45

Andrey Antukh hasn’t signed a CA.

kurt-o-sys02:07:39

right. too bad, I suppose...

seancorfield02:07:47

Here’s the thread where this all blew up on the mailing list https://groups.google.com/forum/#!msg/clojure/Louc1PRdb_s/eGDvnW4XUxkJ

seancorfield02:07:11

(took me a while to track it down — he talks about why he wouldn’t contribute to clojure.java.jdbc (after lifting a bunch of its code!) and why he wouldn’t contribute to the community documentation either)

seancorfield02:07:37

You’ll see why I have zero sympathy or patience for that library 🙂

kurt-o-sys02:07:04

reading it 🙂

kurt-o-sys02:07:41

quick question: there's no 'create table if not exists'-function, is there?

donaldball02:07:54

iirc that’s not officially sql/ddl but most dbs have a syntax for it

kurt-o-sys02:07:00

ok. So I'll just check it.

seancorfield03:07:23

@kurt-o-sys It's "cheating" but you can do (create-table-ddl "IF NOT EXISTS tablename" [[...]])

seancorfield03:07:05

Maybe it would be a nice enhancement to the create/drop functions to have a conditional option somehow...?

seancorfield06:07:19

I'm going to add a :conditional? option to both create-table-ddl and drop-table-ddl that will insert the IF NOT EXISTS or IF EXISTS clause that works on some DBs. it can be boolean or a string (in which case it will insert the specified string -- which is how the :explain? option works on query).

kurt-o-sys06:07:40

would be awesome... :conditional?. Or why not :if-not-exists?

kurt-o-sys09:07:45

other small question: if I want to add several tables in 1 transaction, I see a few functions: db-do-commands and with-db-transaction. Which one to use? (Both seem to run 1 transaction, if I'm not mistaken)

seancorfield16:07:28

Because it might not be "if not exists" in all dialects (hence, it can be a string) and also it means both create-table-ddl and drop-table-ddl can be "conditional", even tho' the condition is the opposite between them (`drop table if exists foo`, create table if not exists foo).

seancorfield16:07:36

db-do-commands is for DDL -- see the community docs http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html -- with-db-transaction is for wrapping calls in a transaction (so you might use them together). Note that some DBs don't let you wrap DDL in a transaction: it's always auto-committed in some.