Thanks!

I’m trying to transform the extension-functions.c in a persistent extension.

The original entry function is that:


int sqlite3_extension_init(
    sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi){
  SQLITE_EXTENSION_INIT2(pApi);
  RegisterExtensionFunctions(db);
  return 0;
}

After reading this append you sent I’m trying something like this:

int sqlite3_extension_init(
    sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  rc = RegisterExtensionFunctions(db, pzErrMsg, pApi);
  if (rc == SQLITE_OK) {
    rc = sqlite3_auto_extension(RegisterExtensionFunctions);
  }
  
  if (rc == SQLITE_OK) rc = SQLITE_OK_LOAD_PERMANENTLY;

  return rc;
}

And I’ve changed the signature of the RegisterExtensionFunctions to receive the 
pzErrMsg and pApi.

It’s not working yet, but I’m trying here. Am I on the right way?

> Em 12 de fev de 2019, à(s) 10:28, Richard Hipp <[email protected]> escreveu:
> 
> On 2/11/19, Ricardo Torquato <[email protected]> wrote:
>> Hey guys!
>> 
>> According to "Persistent Loadable Extensions” topic on
>> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.sqlite.org%2Floadext.html&amp;data=02%7C01%7C%7Cdbb778fd875048b029e308d690e5a6b9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636855713347310297&amp;sdata=u5oqlokW%2FAnemdWqoO23z3aKCRq9bx0oQ8hfekDUvos%3D&amp;reserved=0
>>  if the initialization procedure returns
>> SQLITE_OK_LOAD_PERMANENTLY (256) the extension should persist on the
>> database file instead of just belong to the current connection.
>> 
>> So I’ve downloaded the extension-functions.c and before compile that I’ve
>> changed the the return of sqlite3_extension_init from 0 to 256. But still,
>> my extension just exists on the current connection.
>> 
>> Did I misunderstand the concept? Am I doing something wrong?
> 
> New text has been added to 
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.sqlite.org%2Floadext.html%23persist&amp;data=02%7C01%7C%7Cdbb778fd875048b029e308d690e5a6b9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636855713347310297&amp;sdata=lwQuWj2qS%2FU8nY9eswtHETiz2FojeeNp3zB7ke14RiY%3D&amp;reserved=0
> to hopefully clarify the situation.
> -- 
> D. Richard Hipp
> [email protected]

_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to