Esempio n. 1
0
/* Used to register virtual table module. */
int fs_register( sqlite3* db, 
                 char **pzErrMsg, 
                 const sqlite3_api_routines* pApi )
{
    SQLITE_EXTENSION_INIT2(pApi);

    /* Initliaze the Apache Portable Runtime. */
    apr_initialize();

    /* Arrange to have it cleaned up at exit. */
    atexit(apr_terminate);

    return sqlite3_create_module(db, "filesystem", &fs_module, NULL);
}
Esempio n. 2
0
int testloadext_init(
  sqlite3 *db, 
  char **pzErrMsg, 
  const sqlite3_api_routines *pApi
){
  int nErr = 0;
  SQLITE_EXTENSION_INIT2(pApi);
  nErr |= sqlite3_create_function(db, "half", 1, SQLITE_ANY, 0, halfFunc, 0, 0);
  nErr |= sqlite3_create_function(db, "sqlite3_status", 1, SQLITE_ANY, 0,
                          statusFunc, 0, 0);
  nErr |= sqlite3_create_function(db, "sqlite3_status", 2, SQLITE_ANY, 0,
                          statusFunc, 0, 0);
  return nErr ? SQLITE_ERROR : SQLITE_OK;
}
Esempio n. 3
0
SQLITE_EXTENSION_INIT1

extern int sqlite3_extension_init(sqlite3                     *db,
                                  char                       **pzErrMsg,
                                  const sqlite3_api_routines  *pApi) {
  SQLITE_EXTENSION_INIT2(pApi)
  (void)setlocale(LC_ALL, "en_US.UTF-8");
  sqlite3_create_function(db, "tan", 1, SQLITE_UTF8,
                            0, ora_tan, 0, 0);
  // -1 means variable number of arguments
  sqlite3_create_function(db, "monthname", 1, SQLITE_UTF8,
                            0, my_monthname, 0, 0);
  return 0;
}
Esempio n. 4
0
/* 
** This routine is called when the extension is loaded.  The new
** CSV virtual table module is registered with the calling database
** connection.
*/
int sqlite3_csv_init(
  sqlite3 *db, 
  char **pzErrMsg, 
  const sqlite3_api_routines *pApi
){
  int rc;
  SQLITE_EXTENSION_INIT2(pApi);
  rc = sqlite3_create_module(db, "csv", &CsvModule, 0);
#ifdef SQLITE_TEST
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0);
  }
#endif
  return rc;
}
Esempio n. 5
0
/* SQLite invokes this routine once when it loads the extension.
** Create new functions, collating sequences, and virtual table
** modules here.  This is usually the only exported symbol in
** the shared library.
*/
int sqlite3_extension_init(
      sqlite3 *db,          /* The database connection */
      char **pzErrMsg,      /* Write error messages here */
      const sqlite3_api_routines *pApi  /* API methods */
      )
{
   const sqlite3_tokenizer_module *tokenizer;

   SQLITE_EXTENSION_INIT2(pApi)

   sqlite3Fts3UnicodeSnTokenizer(&tokenizer);

   registerTokenizer(db, TOKENIZER_NAME, tokenizer);

   return 0;
}
Esempio n. 6
0
int sqlite3_eval_init(
  sqlite3 *db, 
  char **pzErrMsg, 
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "eval", 1, SQLITE_UTF8, 0,
                               sqlEvalFunc, 0, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "eval", 2, SQLITE_UTF8, 0,
                                 sqlEvalFunc, 0, 0);
  }
  return rc;
}
Esempio n. 7
0
File: uid.c Progetto: rurbina/sqlite
/* TODO: Change the entry point name so that "extension" is replaced by
** text derived from the shared library filename as follows:  Copy every
** ASCII alphabetic character from the filename after the last "/" through
** the next following ".", converting each character to lowercase, and
** discarding the first three characters if they are "lib".
*/
int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi )
{
    int rc = SQLITE_OK;
    SQLITE_EXTENSION_INIT2(pApi);
    /* Insert here calls to
    **     sqlite3_create_function_v2(),
    **     sqlite3_create_collation_v2(),
    **     sqlite3_create_module_v2(), and/or
    **     sqlite3_vfs_register()
    ** to register the new features that your extension adds.
    */

    sqlite3_create_function_v2(db, "uid", 1, SQLITE_UTF8, NULL, sqlite_ext_uid, NULL, NULL, NULL );
    sqlite3_create_function_v2(db, "uid", 0, SQLITE_UTF8, NULL, sqlite_ext_uid, NULL, NULL, NULL );
    return rc;
}
Esempio n. 8
0
int sqlite3_glitex_init(
  sqlite3 *db, 
  char **pzErrMsg, 
  const sqlite3_api_routines *pApi
)
{
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  sqlite3_create_function_v2(db, "STR_JOIN", -1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 
  								NULL, str_join, NULL, NULL, NULL); 
  sqlite3_create_function_v2(db, "GLX_VERSION", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 
  								NULL, glitex_ver, NULL, NULL, NULL); 
  sqlite3_create_function_v2(db, "GLX_LICENSE", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 
  								NULL, glitex_lic, NULL, NULL, NULL); 

  return rc;
}
Esempio n. 9
0
int sqlite3_extension_init(
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  SQLITE_EXTENSION_INIT2(pApi);

  sqlite3_create_function(
      db,
      "hamming_distance",
      4,
      SQLITE_UTF8,
      NULL,
      hamming_distance,
      NULL,
      NULL
  );
  return SQLITE_OK;
}
Esempio n. 10
0
int
sqlite3_extension_init(sqlite3 *db, char **error, const sqlite3_api_routines *api)
{
    lua_State *L;

    SQLITE_EXTENSION_INIT2(api);

    L = luaL_newstate();
    luaL_openlibs(L);

    if(! L) {
        *error = sqlite3_mprintf("Unable to create Lua state");
        return SQLITE_ERROR;
    }

    sqlite3_create_function_v2(db, "lua", -1, SQLITE_UTF8, L, sqlite_lua,
        NULL, NULL, (void (*)(void*)) lua_close);

    return SQLITE_OK;
}
Esempio n. 11
0
int sqlite3_mmftsext_init(sqlite3 *db,
							char **pzErrMsg,
							const sqlite3_api_routines *pApi)
{
    int rc;
    const char *errmsg;
    SQLITE_EXTENSION_INIT2(pApi);

    // Load and initialize ICU library.
    if (init_icucompat() != 0) {
        *pzErrMsg = sqlite3_mprintf("failed to load ICU library.");
        return SQLITE_ERROR;
    }

    // Register tokenizer.
    rc = sqlite3_register_mm_tokenizer(db);
    if (rc != SQLITE_OK)
        goto bail;

    // Register text cipher.
    rc = sqlite3_register_mm_cipher(db, g_default_key);
    if (rc != SQLITE_OK)
        goto bail;

    // Register utility functions.
    rc = sqlite3_register_mm_utils(db);
    if (rc != SQLITE_OK)
        goto bail;

    *pzErrMsg = NULL;
    return SQLITE_OK;

bail:
    errmsg = sqlite3_errmsg(db);
    if (!errmsg)
        errmsg = "";
    *pzErrMsg = sqlite3_mprintf(
        "Failed to register SQLite functions: %s, ErrCode: %d", errmsg, rc);
    return rc;
}
Esempio n. 12
0
/* SQLite invokes this routine once when it loads the extension.
** Create new functions, collating sequences, and virtual table
** modules here.  This is usually the only exported symbol in
** the shared library.
*/
int sqlite3_extension_init(
  sqlite3 *db_connection,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  SQLITE_EXTENSION_INIT2(pApi)

   sqlite3_create_function(
      db_connection,
      "jarowinkler",
      2,
      SQLITE_UTF8,
      NULL,
      &jarowinkler_wrapper,
      NULL,
      NULL
      );
   
	 sqlite3_create_function(
      db_connection,
      "levenshtein",
      2,
      SQLITE_UTF8,
      NULL,
      &levenshtein_wrapper,
      NULL,
      NULL
      );
	 sqlite3_create_function(
      db_connection,
      "pho_h",
      1,
      SQLITE_UTF8,
      NULL,
      &pho_h_wrapper,
      NULL,
      NULL
      );
  return 0;
}
Esempio n. 13
0
// autoload checksum functions
int sqlite3_extension_init(
  sqlite3 * db,
  char ** pzErrMsg,
  const sqlite3_api_routines *pApi)
{
  SQLITE_EXTENSION_INIT2(pApi);

  sqlite3_create_function(db,
			  // name, #arg, txt, data,
			  "cksum2", 1, SQLITE_UTF8, NULL,
			  // func, step, final
			  sqlite_checksum_int2, NULL, NULL);

  sqlite3_create_function(db,
			  // name, #arg, txt, data,
			  "cksum4", 1, SQLITE_UTF8, NULL,
			  // func, step, final
			  sqlite_checksum_int4, NULL, NULL);

  sqlite3_create_function(db,
			  // name, #arg, txt, data,
			  "cksum8", 1, SQLITE_UTF8, NULL,
			  // func, step, final
			  sqlite_checksum_int8, NULL, NULL);

  sqlite3_create_function(db,
        // name, #args, txt, data,
        "xor", 1, SQLITE_UTF8, NULL,
        // func, step, final
        NULL, ixor_step, int_finalize);

  sqlite3_create_function(db,
        // name, #args, txt, data,
        "isum", 1, SQLITE_UTF8, NULL,
        // func, step, final
        NULL, isum_step, int_finalize);

 return 0;
}
int sqlite3_extension_init(
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  const char *e_msg;
  int e_offset;
  //these global variables are required within callnumber.c
  re_is_cn = pcre_compile(P_IS_CN, 0, &e_msg, &e_offset, NULL);
  if (re_is_cn == NULL){
    printf("Error compiling P_IS_CN at character: %d\n. Message: %s\n", e_offset, e_msg);
    exit(1);
  }
  pe_is_cn = pcre_study(re_is_cn, 0, &e_msg);

  SQLITE_EXTENSION_INIT2(pApi)

  sqlite3_create_collation(db, "LCCN", SQLITE_UTF8, NULL, compare_callnumber_strings_sqlite);
  sqlite3_create_function(db, "NORMALIZE_LCCN", 1, SQLITE_UTF8, NULL, normalize_callnumber_sqlite, NULL, NULL);

  return 0;
}
Esempio n. 15
0
File: shathree.c Progetto: cznic/cc
int sqlite3_shathree_init(
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "sha3", 1, SQLITE_UTF8, 0,
                               sha3Func, 0, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "sha3", 2, SQLITE_UTF8, 0,
                                 sha3Func, 0, 0);
  }
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "sha3_query", 1, SQLITE_UTF8, 0,
                                 sha3QueryFunc, 0, 0);
  }
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "sha3_query", 2, SQLITE_UTF8, 0,
                                 sha3QueryFunc, 0, 0);
  }
  return rc;
}
Esempio n. 16
0
int sqlite3_extension_init(sqlite3 *db, char** UNUSED(err), const sqlite3_api_routines *api)
{
	SQLITE_EXTENSION_INIT2(api)
	sqlite3_create_function(db, "HUNUPPER", 1, SQLITE_UTF8, NULL, hunupper, NULL, NULL);
	return 0;
}
Esempio n. 17
0
int sqlite3_extension_init( sqlite3 *db, char **error, const sqlite3_api_routines *api )
{
    SQLITE_EXTENSION_INIT2(api);
    return sqlite3_create_module( db, "access_log", &access_log_mod, NULL );
}
int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi) {
  SQLITE_EXTENSION_INIT2(pApi)
  sqlite3_create_function(db, "half", 1, SQLITE_ANY, 0, halfFunc, 0, 0);
  return 0;
}
Esempio n. 19
0
int weblog_init( sqlite3 *db, char **error, const sqlite3_api_routines *api )
{
    SQLITE_EXTENSION_INIT2(api);
    return sqlite3_create_module( db, "weblog", &weblog_mod, NULL );
}