db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: Loading Unicode in ij SQL
Date Mon, 13 Mar 2006 00:53:39 GMT
Michael Hackett wrote:

> On Fri, 2006-10-03 at 20:28 -0800, Daniel John Debrunner wrote:
> 
>>Michael Hackett wrote:
>>
>>>Is there some other way to specify non-ASCII characters in SQL scripts
>>>for ij?
>>
>>I don't believe ij is limited to ascii characters, it uses java streams
>>and readers.
>>
>>If you can create a file that contains the script you want with the
>>greek characters and load that into ij using the correct encoding then
>>everything should work fine.
> 
> 
> I'm trying to avoid inserting extended characters into text files, as
> some editors we use mess them up, and over a remote terminal, I can't
> seem to insert them. Anyway, my solution was to define a function that
> calls a method in Apache Commons-Lang that does exactly what I needed:
> 
> create function unescapeJava( str varchar(255) )
>     returns varchar(255)
>     language java
>     external name
>         'org.apache.commons.lang.StringEscapeUtils.unescapeJava'
>     parameter style java
>     no sql
>     returns null on null input;
> 
> Now I can create strings with Unicode characters like so:
> 
>    values (unescapeJava('\u00B5'))
> 
> And then I drop the function at the end of the script.
> 
> Perhaps that will be of some use to others in the same situation.

That's nice.

If could find the time, you could add it as an example to Derby's wiki:

http://wiki.apache.org/db-derby/DerbySQLroutines#head-9bb2536ab5ed15720e8b5a4cd0876d70ab85cce9

Thanks,
Dan.


Mime
View raw message