Ticket #70846: patch-sqlext.diff

File patch-sqlext.diff, 1.2 KB (added by RJVB (René Bertin), 3 weeks ago)
  • src/cregistry/sqlext.c

    diff --git a/src/cregistry/sqlext.c b/src/cregistry/sqlext.c
    index 4c24ea62a..39c359aaf 100644
    a b  
    44
    55#include "vercomp.h"
    66
     7#include <stdio.h>
    78#include <string.h>
    89#include <sqlite3ext.h>
    910SQLITE_EXTENSION_INIT1
    SQLITE_EXTENSION_INIT1 
    1920int sqlite3_extension_init(
    2021    sqlite3 *db,          /* The database connection */
    2122    char **pzErrMsg UNUSED,      /* Write error messages here */
    22 #if HAVE_SQLITE3EXT_H
     23#ifdef sqlite3_create_collation
    2324    const sqlite3_api_routines *pApi  /* API methods */
    2425#else
     26#warning "macports.sqlext won't work"
    2527    const void *pApi
    2628#endif
    2729) {
    28 #if HAVE_SQLITE3EXT_H
     30    int rc = SQLITE_OK;
     31#ifdef sqlite3_create_collation
    2932    SQLITE_EXTENSION_INIT2(pApi)
    3033
    31     sqlite3_create_collation(db, "VERSION", SQLITE_UTF8, NULL, sql_version);
     34    fprintf(stderr, "creating collation sequence VERSION to sql_version() for database \"%s\"\n",
     35        sqlite3_db_filename(db, 0));
     36    rc = sqlite3_create_collation(db, "VERSION", SQLITE_UTF8, NULL, sql_version);
     37    if (rc != SQLITE_OK) {
     38            fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
     39    }
    3240#endif
    33     return 0;
     41    return rc;
    3442}