Hi,

I do this:

const char *table_structure = "CREATE TABLE network (vertex_id INTEGER);";
        if (sqlite3_declare_vtab(db, table_structure) == SQLITE_OK) {
            nr = (NiuRouting*) sqlite3_malloc(sizeof (NiuRouting));

            if (nr == NULL) {
                //*pzErr = sqlite3_mprintf("[NiuRouting module] CREATE
VIRTUAL: No memory \n");
                return SQLITE_NOMEM;
            }

            *ppVTab = (sqlite3_vtab*) nr;
            ((sqlite3_vtab*) nr)->zErrMsg = NULL;

        } else {
            //*pzErr = sqlite3_mprintf("[NiuRouting module] CREATE VIRTUAL:
invalid SQL statement \n");
            return SQLITE_ERROR;
        }

and continue.

i do somethig more comment all the code inside the functions and get the
same error. when try to load extension i just see the first debug message i
can see any more i think, that the program do no enter to any method.

2012/2/3 Stephan Beal <sgb...@googlemail.com>

> 2012/2/3 Jorge Eliécer Osorio Caro <jorgeliecer.oso...@gmail.com>
>
> > Yes, that's my code:
> >
> > http://paste.ideaslabs.com/show/OPNHBY7xPG
> >
> > this the backtrace:
> >
> > #0  0x00000001001701d3 in initialize_niurouting ()
> >
>
> Can you try the following (but i'm just guessing here);
>
> std::cerr << "virtual_table_name="<<virtual_table_name
>  << ", network_structure_table="
>  <<network_structure_table<< '\n';
>
> after those vars are initialized, and change:
>
> std::string table_structure(...)
>
> to
> const static std::string table_structure(...)
>
> sqlite3_declare_vtab()[1] does not document the lifetime requirements of
> the string passed to it, and it's "conceivable" that the lifetime of the
> table_structure string is the problem.
>
> :-?
>
> [1] = http://www.sqlite.org/c3ref/declare_vtab.html
>
> --
> ----- stephan beal
> http://wanderinghorse.net/home/stephan/
> http://gplus.to/sgbeal
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to