Hi All,

I am working on an Android project that uses Xamarin.Android and the sqlite
binary distributed with the Android OS (various versions, depending on the
Android OS version). 

Within the application we have an object caching scheme that relies on the
callback provided to the sqlite3_update_hook() function to invalidate cached
objects whenever they are changed in the db. For the most part everything
works fine, however, in some cases I've observed the callback function being
called with the table name parameter as null. For example, I've seen the
callback called with parameters such as:
  operation: SQLITE_INSERT
  db name: "main"
  table name: null
  row id:  

I acknowledge that this is most likely an issue with the marshalling from
native to C# however due to the difficulty of debugging native code on an
android device from within a C# application, I've made little progress
diagnosing the cause of the problem. Basically I'm getting desperate, and
was wondering if anyone could provide some insight into possible reasons why
the provided table name would be null or invalid.

For more background on the problem, this is what know:
(Observed in sqlite version 3.7.4 mostly, although also in 3.7.11)
(Running on an ARM device)

With a C# delegate signature like this:
void UpdateHookCB(IntPtr context, int change_type, string db_name, string
table_name, long row_id)
'table_name' is sometimes null.

With a signature like this:
void UpdateHookCB(IntPtr context, int change_type, IntPtr db_name, IntPtr
table_name, long row_id)
'table_name' is not IntPtr.Zero, but appears to be a pointer to
non-string-like data. I determined this using the Marshal.PtrToStructure
method to read a small number of bytes from the table_name pointer. The data
looked like low value 32 bit ints, but that is just a guess.

Currently I work around this problem by flushing my entire object cache
whenever a callback containing an invalid table name happens, but this is
killing the performance of my application.

Any help/insight would be greatly appreciated,
Thanks,
Paul



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/Invalid-table-name-provided-in-sqlite3-update-hook-callback-tp70348.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to