dbdimp.c
/*
** Create a new tokenizer instance.
** Will be called whenever a FTS3 table is created with
**   CREATE .. USING fts3( ... , tokenize=perl qualified::function::name)
** where qualified::function::name is a fully qualified perl function
*/
Create a new tokenizer instance.
Will be called whenever a FTS3 table is created with
CREATE .. USING fts3( ...
Create a new tokenizer instance . Will be called whenever a FTS3 table is created with CREATE .. USING fts3 ( ...
static int perl_tokenizer_Create(
    int argc, const char * const *argv,
    sqlite3_tokenizer **ppTokenizer
){
    dTHX;
    dSP;
    int n_retval;
    SV *retval;
    perl_tokenizer *t;
    if (!argc) {
        return SQLITE_ERROR;
    }
    t = (perl_tokenizer *) sqlite3_malloc(sizeof(*t));
    if( t==NULL ) return SQLITE_NOMEM;
    memset(t, 0, sizeof(*t));
    ENTER;
    SAVETMPS;
    PUSHMARK(SP);
    PUTBACK;
    n_retval = call_pv(argv[0], G_SCALAR);
    SPAGAIN;
    if (n_retval != 1) {
        warn("tokenizer_Create returned %d arguments", n_retval);
    }
    retval = POPs;
    t->coderef   = newSVsv(retval);
    *ppTokenizer = &t->base;
    PUTBACK;
    FREETMPS;
    LEAVE;
    return SQLITE_OK;
}
static int perl_tokenizer_Create ( int argc , const char * const * argv , sqlite3_tokenizer * * ppTokenizer ) { dTHX ; dSP ; int n_retval ; SV * retval ; perl_tokenizer * t ; if ( ! argc ) { return SQLITE_ERROR ; } t = ( perl_tokenizer * ) sqlite3_malloc ( sizeof ( * t ) ) ; if ( t == NULL ) return SQLITE_NOMEM ; memset ( t , 0 , sizeof ( * t ) ) ; ENTER ; SAVETMPS ; PUSHMARK ( SP ) ; PUTBACK ; n_retval = call_pv ( argv [ 0 ] , G_SCALAR ) ; SPAGAIN ; if ( n_retval != 1 ) { warn ( " " , n_retval ) ; } retval = POPs ; t -> coderef = newSVsv ( retval ) ; * ppTokenizer = & t -> base ; PUTBACK ; FREETMPS ; LEAVE ; return SQLITE_OK ; }
Create a new tokenizer instance.
Create a new tokenizer instance .
/* call the qualified::function::name */ /* store a copy of the returned coderef into the tokenizer structure */