OK I have posted a new version of extension-functions.tgz on
sqlite.org/contrib.  This version includes definitions for READ_UTF8,
sqlite3ReadUtf8, SKIP_UTF8, sqlite3utf8CharLen, xtra_utf8_bytes,
xtra_utf8_bits, utf_mask taken from the 3.3.13 source code, so it should
continue to work in sqlite 3.4.

Liam

On 9/1/07, Liam Healy <[EMAIL PROTECTED]> wrote:
>
> Good point.  I guess my intent is this: I'd like to use the external
> API completely if possible.  If not, I'm not sure whether to include
> source
> or use the current library (I can see advantages to each).  I guess there
> aren't external API calls that do the needed tasks, so I'll have to figure
> out what to do.
>
> Liam
>
>
> On 9/1/07, Joe Wilson < [EMAIL PROTECTED]> wrote:
> >
> > --- Liam Healy < [EMAIL PROTECTED]> wrote:
> > > Thanks.  I have  changed the use of sqlite3CreateFunc to
> > > sqlite3_create_function.  I did not need to include the source code
> > for
> > > sqlite3utf8CharLen because there's a sqlite3Utf8CharLen (note
> > different
> > > capitalization) in the library.  However, the definition
> >
> > How you intend to integrate your new SQL extension functions into
> > sqlite?
> > As a loadable module or as an sqlite3 source code patch?
> >
> > You can't use sqlite3 internal functions such as sqlite3Utf8CharLen
> > if you're making an external loadable module, which is why it was
> > suggested
> > to copy the function into your code statically. You can only use the
> > published sqlite3 external API in this case. But your library will
> > survive
> > without modifications over new sqlite3 releases.
> >
> > If you're not making an external loable module and are making an sqlite3
> > source patch, just use the script provided earlier in this thread to
> > change
> > the old extension sources to be compatible with the 3.4.x sqlite3.c
> > amalgamation. Mind you, if you're doing the patch approach you may have
> > to
> > keep updating it with every new sqlite release.
> >
> > > of sqlite3ReadUtf8 and needed definitions READ_UTF8, xtra_utf8_bytes,
> > > xtra_utf8_bits, utf_mask are not in 3.4.2, so I needed to
> > > salvage from 3.3.13 source.  This compiles and loads OK, but I'm
> > wondering
> > > if there is a 3.4 way of doing what sqlite3ReadUtf8 did
> > > so that I don't have to carry the definitions.   If anyone has a
> > suggestion
> > > I'd appreciate hearing about it.
> > >
> > > Liam
> > >
> > >
> > > On 8/31/07, Joe Wilson < [EMAIL PROTECTED]> wrote:
> > > >
> > > > --- Liam Healy <[EMAIL PROTECTED]> wrote:
> > > > > I was the one who packaged up extension-functions.tgz and posted
> > on
> > > > > contrib.  I didn't author the original code but I'd like to fix
> > this up.
> > > > > I'm not clear on what needs to be changed.  I gather that
> > > > sqlite3utf8CharLen
> > > > > and sqlite3CreateFunc shouldn't be used.  I'm not sure how to
> > convert to
> > > > use
> > > > > the external API.  Anyone have a pointer?
> > > >
> > > > See:
> > > >
> > > >   http://www.sqlite.org/capi3ref.html#sqlite3_create_function
> > > >
> > > >   http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions
> > > >
> > > > And include this statically in your code, if you require it:
> > > >
> > > > #define SQLITE_SKIP_UTF8(zIn) {                        \
> > > >   if( (*(zIn++))>=0xc0 ){                              \
> > > >     while( (*zIn & 0xc0)==0x80 ){ zIn++; }             \
> > > >   }                                                    \
> > > > }
> > > >
> > > > int sqlite3Utf8CharLen(const char *zIn, int nByte){
> > > >   int r = 0;
> > > >   const u8 *z = (const u8*)zIn;
> > > >   const u8 *zTerm;
> > > >   if( nByte>=0 ){
> > > >     zTerm = &z[nByte];
> > > >   }else{
> > > >     zTerm = (const u8*)(-1);
> > > >   }
> > > >   assert( z<=zTerm );
> > > >   while( *z!=0 && z<zTerm ){
> > > >     SQLITE_SKIP_UTF8(z);
> > > >     r++;
> > > >   }
> > > >   return r;
> > > > }
>
>

Reply via email to