AnantLabs / xerial

Automatically exported from code.google.com/p/xerial
0 stars 0 forks source link

Collations Support #102

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open a Database
2. Perform a Select from a table with a user-defined Collation Sequence

What is the expected output? What do you see instead?
Expect: Get the results from the query
Instead: Exception because the collation is not implemented in the Driver, no 
way to get around this and no way to get to the data of that table with the 
current version of the JDBC Driver

What version of the product are you using? On what operating system?
3.7.8-SNAPSHOT
on Windows 7 x64

Please provide any additional information below.

After searching for two weeks daily, I couldn't find any SQLite Java 
implementation solving the Collations problem and since I really needed that 
stuff to work for my bachelor's thesis I sat down and implemented the changes 
myself. My main motivation for this was reading and modifying tables from the 
Android contacts2.db where Android stores address books and call logs. It makes 
use of a custom collation called PHONEBOOK that is not included with any of the 
freely available SQLite implementations.

Attached is a Patch adding an implementation for the create_collation function 
of the SQLite C API. It makes use of the Java Collator Interface as a Java 
resemblance to the Collations concept of SQLite.

This is my first patch provided to an Open Source project and while this works 
well for me I'm not entirely sure about the coding style.
Any feedback is highly appreciated.

Original issue reported on code.google.com by Mastache...@gmail.com on 30 Apr 2012 at 11:18

Attachments:

GoogleCodeExporter commented 9 years ago
Hi. I am looking exactly for this extension but I have problems to implement 
it. Could you share your solution with me, please? 

Original comment by ple...@gmail.com on 17 Nov 2014 at 6:28

GoogleCodeExporter commented 9 years ago
> Could you share your solution with me, please? 
Sure, where do you need help?
With the patch itself or with implementing a new Collation in Java after 
applying the patch to your version of the library?

Original comment by Mastache...@gmail.com on 17 Nov 2014 at 7:36

GoogleCodeExporter commented 9 years ago
I understand how it works and how it use in Java, when sqlite already supports 
it. I try to fix latest version 3.8.7 to add this feature. I looks like sqlite 
library was a little bit rearranged since your patch was created. For example 
Conn class use for private field in Collation class doesn't exist anymore, etc.

Original comment by ple...@gmail.com on 17 Nov 2014 at 7:53

GoogleCodeExporter commented 9 years ago
Ok, I think, I fixed everything. There is a last step, compile NativeDB.c to 
support new links to native libraries. Could you suggest some right (and 
simple) way, please? 

Original comment by ple...@gmail.com on 17 Nov 2014 at 8:30

GoogleCodeExporter commented 9 years ago
Doesn't that happen automatically when you build the project using Maven?
> "make native"
Sorry, I try my best to remember, but this has been over 2 years and I've 
basically not touched any C code ever since.

Original comment by Mastache...@gmail.com on 17 Nov 2014 at 8:39

GoogleCodeExporter commented 9 years ago
Thank you. I am sure I find a way, just there was a hope to ask and get some 
ideas. I was surprised that this useful feature is missing even a support is so 
simple. For example custom functions are supported and this is very similar. 
Have a nice evening (or day).

Original comment by ple...@gmail.com on 17 Nov 2014 at 8:46