http://www.jooq.org/
e.g. SELECT AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, COUNT(*) FROM AUTHOR JOIN BOOK ON AUTHOR.ID = BOOK.AUTHOR_ID WHERE BOOK.LANGUAGE = 'DE' AND BOOK.PUBLISHED > DATE '2008-01-01' GROUP BY AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME HAVING COUNT(*) > 5 ORDER BY AUTHOR.LAST_NAME ASC NULLS FIRST LIMIT 2 OFFSET 1 gives (Java): create.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, count()) .from(AUTHOR) .join(BOOK).on(AUTHOR.ID.equal(BOOK.AUTHOR_ID)) .where(BOOK.LANGUAGE.eq("DE")) .and(BOOK.PUBLISHED.gt(date("2008-01-01"))) .groupBy(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME) .having(count().gt(5)) .orderBy(AUTHOR.LAST_NAME.asc().nullsFirst()) .limit(2) .offset(1) I know that we have GLORP but this is not the same thing. Phil |
Glorp is not ready to do that, but it is not far from being able to do
it. At least in the reverse order. I already asked foor a jOOQ like tool for Pharo before. Now we're two the persons interested on it. By the time we're five somebody will have to build it. :) Regards, Esteban A. Maringolo 2016-10-07 18:37 GMT-03:00 [hidden email] <[hidden email]>: > http://www.jooq.org/ > > e.g. > > SELECT AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, COUNT(*) > FROM AUTHOR > JOIN BOOK ON AUTHOR.ID = BOOK.AUTHOR_ID > WHERE BOOK.LANGUAGE = 'DE' > AND BOOK.PUBLISHED > DATE '2008-01-01' > GROUP BY AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME > HAVING COUNT(*) > 5 > ORDER BY AUTHOR.LAST_NAME ASC NULLS FIRST > LIMIT 2 > OFFSET 1 > > gives (Java): > > create.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, count()) > .from(AUTHOR) > .join(BOOK).on(AUTHOR.ID.equal(BOOK.AUTHOR_ID)) > .where(BOOK.LANGUAGE.eq("DE")) > .and(BOOK.PUBLISHED.gt(date("2008-01-01"))) > .groupBy(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME) > .having(count().gt(5)) > .orderBy(AUTHOR.LAST_NAME.asc().nullsFirst()) > .limit(2) > .offset(1) > > I know that we have GLORP but this is not the same thing. > > Phil |
PetitParser contains a SQL (Lite?) grammar and some visitor hooks.
Writing a simple visitor which outputs the Smalltalk equivalent of the SQL you passed in shouldn't be hard. I'm just not sure how easy it is to transfer the semantics of the parsed SQL. CU, Udo On 08/10/16 00:04, Esteban A. Maringolo wrote: > Glorp is not ready to do that, but it is not far from being able to do > it. At least in the reverse order. > > I already asked foor a jOOQ like tool for Pharo before. Now we're two > the persons interested on it. > By the time we're five somebody will have to build it. :) > > Regards, > > > Esteban A. Maringolo > > > 2016-10-07 18:37 GMT-03:00 [hidden email] <[hidden email]>: >> http://www.jooq.org/ >> >> e.g. >> >> SELECT AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, COUNT(*) >> FROM AUTHOR >> JOIN BOOK ON AUTHOR.ID = BOOK.AUTHOR_ID >> WHERE BOOK.LANGUAGE = 'DE' >> AND BOOK.PUBLISHED > DATE '2008-01-01' >> GROUP BY AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME >> HAVING COUNT(*) > 5 >> ORDER BY AUTHOR.LAST_NAME ASC NULLS FIRST >> LIMIT 2 >> OFFSET 1 >> >> gives (Java): >> >> create.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, count()) >> .from(AUTHOR) >> .join(BOOK).on(AUTHOR.ID.equal(BOOK.AUTHOR_ID)) >> .where(BOOK.LANGUAGE.eq("DE")) >> .and(BOOK.PUBLISHED.gt(date("2008-01-01"))) >> .groupBy(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME) >> .having(count().gt(5)) >> .orderBy(AUTHOR.LAST_NAME.asc().nullsFirst()) >> .limit(2) >> .offset(1) >> >> I know that we have GLORP but this is not the same thing. >> >> Phil > > |
Free forum by Nabble | Edit this page |