Joe Walnes has released Squiggle, a small Java library for dynamically building complicated SQL SELECT statements. Squiggle is open source code that has one missions only: It generates SELECT statements based on criteria you give it. It's sweet spot is for applications that need to build up complicated queries with criteria that changes at runtime.
- Posted by: Dion Almaer
- Posted on: January 08 2004 09:36 EST
- Concise and intuitive API.
- Simple code, so easy to customize.
- No dependencies on classes outside of JDK1.2.
- Small, lightweight, fast.
- Generates clean SQL designed that is very human readable.
- Supports joins and sub-selects.
Visit the Squiggle tutorial to see how it all works.
Squiggle Home Page
Download Squiggle (zip, tgz)
- How does it compare with Hibernate Query by Criteria? by c tang on January 08 2004 13:23 EST
- Squiggle SQL Builder for Java Released by Vladimir Goncharov on January 08 2004 14:39 EST
- What about INSERT, UPDATE, DELETE ??? by Gabriel Chua on January 08 2004 18:00 EST
- Good work by Ganesh Prasad on January 08 2004 18:08 EST
- Yet another util libray by Linards Kanenbergs on January 09 2004 02:58 EST
- just the select? by jag huang on January 11 2004 19:39 EST
- Most links are dead by Lukas Eder on November 21 2013 10:42 EST
How does squiggle compare with the Query by Criteria feature of Hibernate?
Is this DB aware and can represent convert(), TO_CHAR, sysdate, current, AVG, SUM, etc. for different database. Otherwise the entire idea doesnt make sense, I guess.
What about INSERT, UPDATE, DELETE ???
Any plan for it???
Seems neat. It shouldn't be too hard to support INSERT, DELETE and UPDATE as well with very little effort.
What would be really useful are slightly out-of-the-way features like
INSERT INTO <table>
i.e., insert based on a selection rather than just a plain INSERT of values,
SET <column> = <column> <operator> value
i.e., update of existing values rather than new values.
Well, there is fate blog about this post :
Probably most of TSS readers already have their preffered or their own SQL libraries.
My post was not about this (I don't know why anyone would think that either!).
This library is small and very focussed on its own core task. This is EXACTLY how all util libs should be. My rant is against generic dumping ground type util libraries where people just put in everything. The stuff that gets released doesn't address any particular problem particularly elegantly, it isn't focussed, you're just expected to take on some crap and use it 'generically' in some magical way.
I wish util libs instead do what this one does, which is stick to one problem domain and address that as best as possible.
Thanks for clarifying this.
I agree, but I have seen 10+ implementations of this idea. Basically what follows after is that people begin to add stuff, like all DB compatibility, inserts, updates, DB structure alteration, and so on, and the original idea become diluted. Not that these all ideas in ideal implementation would not be useful, they just becomes unnecessary when you reuse library in next project.
Interface usability is dependant on project size. What is good for small things, is not good for big and vice versa.
This library is for small things.
I have the same idea with you by sql.
I am so grant to see this tool.
but,just the "select"?
how about "update","delete"......?
Most links in this article are dead, much as Squiggle itself is. I've recently (two years ago) checked back with the Squiggle "community" whether they are still alive and how they would compare themselves to jOOQ:
Here's the answer of the author:
Squiggle is a project I originally wrote a very long time ago. 1999! I
honestly can't remember the last time I even thought about it, until
now. So, no, I have no plans to continue working on it.
So, compared to jOOQ, that's pretty dead :-)