views:

43

answers:

1

Im asking because Im trying to debug a SQL query problem and adb only seems to show part of the SQL string and chops off the end.

Im getting an "unrecognized token" error when running a query:

W/System.err(18917): android.database.sqlite.SQLiteException: unrecognized token: "931C6752DF97CFDACD130A06CAE0E7DA6320DE2945FFFA0A65629BC687256DE3": , while compiling: SELECT COUNT(*) FROM products WHERE (id IN (9781101134801,9781429535823,9780806532318,9781440609404,9781440644474,9781101184554,2940000052358,9780071633574,9781429516105,9781411433250,9781586488581,9780786537624,9781101188705,9781440697661,9780199717569,9781429580397,9781429979436,9781101187739,9781429959810,9781420119053,9781429954419,9781101218457,9781569757468,9780802196262,9781101213339,9781411428942,9781411428232,2940011807343,9780307272119,2940000248775,2940000273708,2940000278932,2940000274514,2940000400104,2940000336878,2940000281062,2940000400081,2940000281017,9780316005050,2940000336113,2940000367278,9781426847585,2940000244647,9780137058549,2940000248768,9780077422318,9781426833533,2940000244609,2940000274552,2940000244692,2940000336908,2940000400142,2940000277621,2940000400111,2940000392300,2940000228241,9780345464927,2940000336144,2940000807224,2940000277249,9780345515667,2940000336076,2940000336137,9780316086134,2940000273463,9780061429347,2940000392355,9781416549833,9780061998065,9780321700704,2940000400159,9781426806421,9781426840562,2940000273470,9781416587187,9781428507326,2940000313640,2940000277669,2940000336915,2940000338131,2940000244654,9780791487655,2940000277676,2940000392331,2940000273449,2940000313633,9781411431645,9780316040341,2940000248782,9780077395469,2940000248850,2940000336083,2940000367261,2940000273494,2940000228623,2940000228302,9780061959936,2940000367247,2940000244623,2940000274538,2940000280942,2940000336861,2940000367216,2940000277645,2940000228388,2940000338124,9780321703477,2940000248812,9780061962066,2940000338100,2940000277225,2940000392324,2940000278925,2940000248348,2940000277713,2940000273487,2940000336120,2940000367223,9780877797753,2940000274569,2940000336922,2940000336106,2940000313671,9780307264725,9780385533133,2940000248393,2940003039615,2940000336090,9780061916458,2940000338087,2940000244678,2940000277638,2940000281079,2940000400128,2940000338049,2940000367186,2940000313695,9780321702067,2940000248867,2940000277652,2940000400135,2940000338094,2940000248805,2940000277201,2940000248836,2940000982556,2940000228340,2940000367209,9780307593672,2940000336052,2940000278918,2940000277706,2940000336069,2940000248355,2940000277232,2940000280966,2940000338117,2940000248379,2940000277218,2940000313657,2940000341599,2940000248829,9780062002945,2940000313664,2940000274521,2940000367230,9780786955916,2940000277690,2940000248362,2940000362396,2940000244685,9780307272300,2940000273500,2940000313688,2940000281147,9781101443552,2940000248843,2940000273456,2940000228043,2940000274545,2940000392317,9780743258241,2940000982303,9781439168035,9780132103206,9781596916715,2940000313718,2940000392348,2940000244661,2940000400098,2940000400166,9780307271341,2940000313701,2940000367193,2940000277683,9781605043739,9780440334408,2940000338070,2940000244630,2940000338063,9780307719607,2940000336939,9780345464453,2940000336885,2940000367254,2940000336892,2940000338056,2940000244616,2940000392294,2940000313626,2940000093559,931C6752DF97CFDACD130A06CAE0E7DA6320DE2945FFFA0A65629BC687256DE3,88F21F69943935F0C31A803A6C3A639F242CDF18DC0570113888FE00569BAE45,9781411433786)) AND (id IN (2940000697375,9781423140344,9781101134801,9781433671074,9781101152140,9781429535823,9780806532318,9781429516174,9781440609404,9781440644474,9781101184554,2940000052358,9780071633574,9780761148340,9781429516105,2940000147467,9781411428485,9781411433250,9781586488581,9781414346304,9781101136775,9780786537624,9781101188705,9781440697661,9781429543637,9781414346311,9781101190111,9781565125858,9780199717569,9781596917248,9781429580397,9780786025145,9780786564743,9781429979436,9781101187739,2940000754603,9781420119053,9781429954419,9781101213339,9781440668890,9780307272119,2940000248775,2940000273708,2940000278932,2940000274514,2940000400104,2940000336878,2940000281062,2940000244562,2940000400081,2940000281017,9780316005050,2940000336113,29400
W/System.err(18917):  at android.database.sqlite.SQLiteProgram.native_compile(Native Method)
W/System.err(18917):  at android.database.sqlite.SQLiteProgram.compile(SQLiteProgram.java:117)
W/System.err(18917):  at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:66)
W/System.err(18917):  at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:49)
W/System.err(18917):  at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:59)
W/System.err(18917):  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1286)
W/System.err(18917):  at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1259)

As you can see the query above appears truncated.

+2  A: 

I dug into the Android open source code and confirmed that it does have a max message size just under 4k.

So it does look like that log entry is getting cut off.

From the current native C++ source (platform/system/core/include/cutils/logger.h) :

struct logger_entry {
    uint16_t    len;    /* length of the payload */
    uint16_t    __pad;  /* no matter what, we get 2 bytes of padding */
    int32_t     pid;    /* generating process's pid */
    int32_t     tid;    /* generating process's tid */
    int32_t     sec;    /* seconds since Epoch */
    int32_t     nsec;   /* nanoseconds */
    char        msg[0]; /* the entry's payload */
};
#define LOGGER_ENTRY_MAX_LEN        (4*1024)
#define LOGGER_ENTRY_MAX_PAYLOAD    \
    (LOGGER_ENTRY_MAX_LEN - sizeof(struct logger_entry))
cistearns
Thanks for the insight.
Eno