DerbyAdapter

11 views
Skip to first unread message

Marco Rico-Gomez

unread,
Jan 13, 2011, 4:06:54 AM1/13/11
to squeryl-co...@googlegroups.com
Hi all,

I really like Squeryl and it would be great if it had support for
Derby databases.

I had a look at the sources and realized that this shouldn't be a very
hard task. So I implemented
a DerbyAdapter myself which I'd love to contribute now.

The implementation can be found in my fork on github:
https://github.com/mrico/Squeryl

It passes all tests! However, I haven't used it in a real world project yet.

Here is a short summary of what I've done:
* Implemented a DerbyAdapter (of course)
* added the derby driver to the project's dependencies
* added a method allTestsOnDerby to the Tests object which uses a
in-memory derby db.
* added a call to 'Session.cleanupResources' to the overridden drop
method in SchoolDb and MusicDb to prevent 'open resultset errors'

Here is a list of known limitations:
* the string concat operator '||' doesn't work with numeric types in
derby (see https://issues.apache.org/jira/browse/DERBY-1306)
* Paging is not supported since derby has no limit/ offset functions
* Full outer joins are not supported
* Regular expressions are not supported

What do you think?

Greetings

\ Marco
--
Twitter: @mricog
Website: http://mrico.eu

Maxime Lévesque

unread,
Jan 13, 2011, 7:50:42 AM1/13/11
to squeryl-co...@googlegroups.com

Hi Marco, thanks for writing this adapter, I checked your code and it all looks good,

there is just one thing that I would like you to change : if you look at the diffs here :

  https://github.com/mrico/Squeryl/commit/e70b215752022aad738eea2d4cc0fde927f8e966

for some files, git sees it as if the whole file had changed, this is a known issue with git :

  http://stackoverflow.com/questions/861995/is-it-possible-for-git-merge-to-ignore-line-ending-differences

If I pull the change like this, the merges will be painful for those that have pending changes to push.
(I think you can do it by just changing your git config and then by amending your last commit...)

What would also be nice is if you could update the doc :

  http://squeryl.org/schema-definition.html   (the section : "Correspondance of field types to database column types")

  http://squeryl.org/supported-databases.html

to include the Derby support.

Changing the doc is just a matter of editing some textile files in a special branch called gh-pages, it's quite trivial once you get set up with github pages :

  http://pages.github.com/


Cheers !

Marco Rico-Gomez

unread,
Jan 13, 2011, 8:24:24 AM1/13/11
to squeryl-co...@googlegroups.com
2011/1/13 Maxime Lévesque <maxime....@gmail.com>:

>
> Hi Marco, thanks for writing this adapter, I checked your code and it all
> looks good,

Great!

>
> there is just one thing that I would like you to change : if you look at the
> diffs here :
>
>
> https://github.com/mrico/Squeryl/commit/e70b215752022aad738eea2d4cc0fde927f8e966
>
> for some files, git sees it as if the whole file had changed, this is a
> known issue with git :
>
>
> http://stackoverflow.com/questions/861995/is-it-possible-for-git-merge-to-ignore-line-ending-differences
>
> If I pull the change like this, the merges will be painful for those that
> have pending changes to push.
> (I think you can do it by just changing your git config and then by amending
> your last commit...)

Sure, I'll fix that! This should not have happened.

>
> What would also be nice is if you could update the doc :
>
>   http://squeryl.org/schema-definition.html   (the section : "Correspondance
> of field types to database column types")
>
>   http://squeryl.org/supported-databases.html
>
> to include the Derby support.
>
> Changing the doc is just a matter of editing some textile files in a special
> branch called gh-pages, it's quite trivial once you get set up with github
> pages :
>
>   http://pages.github.com/
>

No problem, I'll change the docs.

Thanks for your fast response.

--

Marco Rico-Gomez

unread,
Jan 13, 2011, 10:06:42 AM1/13/11
to squeryl-co...@googlegroups.com
Hi Max,

I converted the line-endings with the unix2dos tool, rebased the
commit with the previous one and pushed it to my github fork. As far
as I can see the diffs looks good now.

I'll ping you again when I've changed the docs.

Greetings
Marco


2011/1/13 Marco Rico-Gomez <m.ric...@googlemail.com>:

Marco Rico-Gomez

unread,
Jan 13, 2011, 2:16:37 PM1/13/11
to squeryl-co...@googlegroups.com
Hi Maxime,

ok, the docs are updated. While I was editing the data type table in schema-definition.textile I realized that 'boolean' was missing, so I added this information for all databases.

See https://github.com/mrico/Squeryl/commit/0549eac3f46198e57349a1c17d2ac845d79bdfe0

Cheers!

Reply all
Reply to author
Forward
0 new messages