InstantDB Project
About InstantDB
Project Mail Lists
Short History
Reporting Bugs
Screen Shots
3rd Party Examples
FAQs

Software
Downloads
Documentation
CVS Repositories
Roadmap
License

About Enhydra.org
Who We Are
News, Articles & Events
Getting Involved
Contact Us

Community
Demos
Contributions
Resources
Case Studies
On The Edge! -NEW-
Commercial Vendors


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: InstantDB: ORDER BY CollationKey?


Hi Dick

> 1) In your example, what java methods does the order clause
>   use to compare java.lang.Object's that are returned by the
>   function "lower"?  That is, what methods are used to compare 
>   arbitrary objects that are returned by the evaluate method of 
>   the sqlFunction interface?

It knows they're strings that get returned from the lower function, so 
it'll do java.lang.String.equals or compareTo on them.

> 2) I suppose that my orginal question boils down to: can
>   order clauses be used on BINARY columns?

Not really. I think it'll accept ORDER BY on binaries, but the default 
collation sequence is just to just compare their lengths - not very 
useful. You really would need to write a function to do something 
sensible with these.

> Although the idea of writing my own sql function is attractive,
> I may shy away from it because I assume that it will reduce the
> degree to which my application is portable.  (I have no idea
> how general the notion of user-defined sql functions really is.)

IDB's way of doing this is totally non-portable. I guess you would 
write a callable SQL function in PL/SQL for something like Oracle. I 
think it'd be pretty different whatever database you migrated to.

FWIW, the little bit of SQL I sent in my earlier mail should be pretty 
portable though.

Pete
----- Original Message -----
From: Dick Repasky <drepasky@bio.indiana.edu>
Date: Sunday, December 10, 2000 5:36 pm
Subject: Re: InstantDB: ORDER BY CollationKey?

> Pete,
> 
> Thanks for the reply, and on Sunday, no less!
> 
> Two questions: one about your suggestion and one about my original
> post.
> 
> 
> 2) I suppose that my orginal question boils down to: can
>   order clauses be used on BINARY columns?
>   
> Although the idea of writing my own sql function is attractive,
> I may shy away from it because I assume that it will reduce the
> degree to which my application is portable.  (I have no idea
> how general the notion of user-defined sql functions really is.)
> 
> Thanks,
> 
> Dick
> 
> Most recent message:
> > From: Peter Hearty <peter.hearty@lutris.com>
> > To: instantDB@enhydra.org
> > Date: Sun, 10 Dec 2000 15:39:07 GMT
> > Subject: Re: InstantDB: ORDER BY CollationKey?
> >
> >Dick
> >
> >Don't know if this is exactly what you asked for, but this 
> extract from 
> >a ScriptTool script illustrates how to alter the collation 
> sequence 
> >using a string function
> >
> >drop table test;
> >create table test (id int, name char(40) );
> >insert into test values (1, "Zog");
> >insert into test values (2, "alan");
> >q select * from test order by name;
> >q select lower(name),test.* from test order by 1;
> >
> >As you can write your own functions, you can effectively have any 
> >collation sequence that you like.
> >
> >Regards
> >
> >Pete
> >
> >----- Original Message -----
> >From: Dick Repasky <drepasky@bio.indiana.edu>
> >Date: Sunday, December 10, 2000 2:13 am
> >Subject: InstantDB: ORDER BY CollationKey?
> >
> >> 
> >> Hello, all,
> >> 
> >> This is my first post.
> >> 
> >> I'd like to use the ORDER clause on strings and have them be 
> ordered>> as they would be by a java Collator.  (What counts is 
> that lower and
> >> upper cases be honored but grouped together by first letter 
> rather 
> >> thanappearing as all upper case instances of all letters 
> followed 
> >> by all
> >> lower case instances of all letters.  I'm also interested in 
> >> supportingmultiple languages.)  I understand that this is not 
> >> possible in instantdb
> >> by default.
> >> 
> >> The question is: can I obtain the desired effect by using a 
> table 
> >> columnthat contains CollationKeys and use the ORDER clause on 
> the 
> >> key column?
> >> The idea is to use the toByteArray() method of CollationKey to 
> get a
> >> plain form of the keys and then put the bytes into a column of type
> >> BINARY in the table and use ORDER on that column.  Presto?
> >> 
> >> Thanks,
> >> 
> >> Dick
> >> ----------------------------------------------------------------
> ---
> >> ----------
> >> To unsubscribe from this mailing list, send email to 
> >> majordomo@enhydra.orgwith the text "unsubscribe instantdb" in 
> the 
> >> body of the email.
> >> If you have other questions regarding this mailing list, send 
> >> email to
> >> the list admin at owner-instantdb@enhydra.org.
> >> 
> >
> >------------------------------------------------------------------
> -----------
> >To unsubscribe from this mailing list, send email to 
> majordomo@enhydra.org>with the text "unsubscribe instantdb" in the 
> body of the email.
> >If you have other questions regarding this mailing list, send 
> email to
> >the list admin at owner-instantdb@enhydra.org.
> >
> -------------------------------------------------------------------
> ----------
> To unsubscribe from this mailing list, send email to 
> majordomo@enhydra.orgwith the text "unsubscribe instantdb" in the 
> body of the email.
> If you have other questions regarding this mailing list, send 
> email to
> the list admin at owner-instantdb@enhydra.org.
> 

-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.