fwbrasil / activate

Abandoned: Pluggable persistence in Scala
GNU Lesser General Public License v2.1
299 stars 46 forks source link

Adds support for SQL Array #91

Closed vchuravy closed 9 years ago

vchuravy commented 10 years ago

This is still a WIP, but I would like to get your feedback..

The only missing piece in the possible to get the basic to work and that I can start testing it is the mapping between List and java.sql.Array in line 153.

http://stackoverflow.com/questions/2880304/convert-java-util-liststring-into-java-sql-array

Would it be possible to get the jdbc.connection in the postgresqlDIOM?

fwbrasil commented 10 years ago

I think you can get the connection from the prepared statement.

http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#getConnection()

fwbrasil commented 10 years ago

Could you also see if the other sql databases support the array type? If there are others, we can turn this into something more generic.

vchuravy commented 10 years ago

I will definitely look into that. Maybe when we should introduce profiles we should create the feature sets from the SQLStandards and a db profile would then unlock those feature sets. So for Arrays there is a difference between SQL99 and SQL03 in SQL99 you can create arrays but these have to be fixed size and you cannot create multi dimensional arrays, in SQL03 those limitations have been dropped and you can create unlimited arrays (or vendor limited max size) and you can create multi-dimensional arrays. http://farrago.sourceforge.net/design/CollectionTypes.html

So when we introduce profiles it seems reasonable to differentiate between SQL standards and then add vendor exclusive extensions.

vchuravy commented 10 years ago

So I finally found some time to work on this further, but I ran into a problem while creating a SQL.Array I need underlying Type Information. One way to so that would be using reflection, but that would be messy and kinda defeat the whole point of it. The second option would be introduction a ListStorageValue[StorageValue] and still use reflection to map this type to SQL.Array but it would allow for a more typesafe way or we could use TypeMappers like slick does https://gist.github.com/Pyppe/5526629

fwbrasil commented 10 years ago

We already have the array type on the ListStorageValue.emptyStorageValue. It isn't enough?

vchuravy commented 10 years ago

So at least that compile, there are some ugly hacks in there so please take a look and let me know what you think and I still have to write test cases.

fwbrasil commented 10 years ago

@wallnuss Did you have progress on this PR? I also need this feature now... :)

vchuravy commented 10 years ago

Still missing is also jdbc-async, but as soon as I am sure the test work and everything works thats easy to add.