Using PostgreSQL with Compojure

This article has been archived because much better Clojure resources are available now. Some of my favorite Clojure learning resources include Learn Clojure and Clojure web applications on Heroku. You can also find commercial support at Clojure Core.



Filed under Programming

9 responses to “Using PostgreSQL with Compojure

  1. Pingback: Using PostgreSQL with Compojure - DbRunas

  2. Mathias Dahl

    Great stuff! Now I only need to convert all my old webjure syntax to compojure. Poor hands… 🙂

  3. Nicolas Buduroi

    Just to point out that it would be better wrapping the page’s html with an html tag, like that: (html [:html [:head …

    BTW: nice article, Compojure really need more of them!

  4. Soon there will be a standard page layout so that I can place the :html tag in just one place and have it used in all of the views.

  5. Pingback: Compojure security: authentication and authorization « Eric Lavigne

  6. Pingback: Clojure roundup « Clojure Study Group DC

  7. Updated to work with the latest versions of Compojure (namespace changes) and Clojure-contrib (sql/with-query-results API change).

  8. Christian Romney

    Looks nice. Keep the articles coming! I’m especially anxious to see this evolve as you start to optimize the SQL. For a small number of articles filter approach seems reasonable, but I imagine you’ll alter your SQL at some point to load just the article you need. Of course, if you expose the key in the URL and just hand it to your query you’ll need to worry about SQL injection…

    • Christian,

      I like pretty URLs, so I liked the idea of generating a URL title by replacing a few problematic characters in the real title.

      If I made another column to hold the URL title, I could directly query for the record that I want. I didn’t do that because, when I wrote this article, clojure.contrib.sql did not yet support parameterized queries. It would have been my job to defend against SQL injection, and I didn’t want to do that. The library has improved since then, but I haven’t found time to update the article yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s