Hello,
Not exactly the program language you asked for, but here it is how I
have it in C for gtk:
Call this function after opening the connection:
sqlite3_trace ( sqliteconnection, sqlite_trace, NULL );
static void sqlite_trace ( void *arg, const char *query )
{
FILE *file = fopen ( "/tmp/sqlitetrace.txt", "a" );
if ( file != 0 )
{
GString *stringquery = g_string_new ( query );
dmemory_gstring_free_on_destruction_with_temporary_object (
stringquery );
GString *stringleft = g_string_new ( "" );
dmemory_gstring_free_on_destruction_with_temporary_object (
stringleft );
GString *stringright = g_string_new ( "" );
dmemory_gstring_free_on_destruction_with_temporary_object (
stringright );
GString *stringconcatenated = g_string_new ( "" );
dmemory_gstring_free_on_destruction_with_temporary_object (
stringconcatenated );
if ( stringquery->len > 127 )
{
g_string_assign ( stringleft, stringquery->str );
g_string_truncate ( stringleft, 64 );
if ( stringquery->len > 63 )
{
g_string_assign ( stringright, stringquery->str );
g_string_erase ( stringright, 0, stringquery->len - 63 );
}
g_string_assign ( stringconcatenated, stringleft->str );
if ( stringright->len > 0 )
{
g_string_append ( stringconcatenated, " [...] " );
g_string_append ( stringconcatenated, stringright->str );
}
fprintf ( file, "%s\n", stringconcatenated->str );
}
else
{
fprintf ( file, "%s\n", stringquery->str );
}
fclose ( file );
}
}
Best Regards,
Patrik
On 02/11/2013 08:17 AM, Winston Brummer wrote:
> Hi
>
> I saw in the version history that SQLite makes use of trace listeners.
> Could anyone give me an example of how to attach a trace listener to an
> application that uses System.Data.SQLite? Specifically related to the
> compact frame work version for Windows Mobile and Pocket PC.
>
> Any help would be greatly appreciated.
> Winston
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users