On Aug 21, 2009, at 2:49 PM, Shaun Seckman (Firaxis) wrote:

> This is great!  Exactly what I was looking for.  Do you by any chance
> know the function name of the standard collation used for string
> comparisons?  I'd like to use that as a foundation for building a new
> one.
>


/*
** This is the default collating function named "BINARY" which is always
** available.
**
** If the padFlag argument is not NULL then space padding at the end
** of strings is ignored.  This implements the RTRIM collation.
*/
static int binCollFunc(
   void *padFlag,
   int nKey1, const void *pKey1,
   int nKey2, const void *pKey2
){
   int rc, n;
   n = nKey1<nKey2 ? nKey1 : nKey2;
   rc = memcmp(pKey1, pKey2, n);
   if( rc==0 ){
     if( padFlag
      && allSpaces(((char*)pKey1)+n, nKey1-n)
      && allSpaces(((char*)pKey2)+n, nKey2-n)
     ){
       /* Leave rc unchanged at 0 */
     }else{
       rc = nKey1 - nKey2;
     }
   }
   return rc;
}




D. Richard Hipp
d...@hwaci.com



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to