[android-developers] Cursor.getString() truncating Strings issue update

2011-01-01 Thread Damien Cooke
Hi All,
I have an app that stores it's local data in a database,  The database has a 
TEXT field called description that on some rows is truncated on retrieval. I 
have checked the database by running it app in the emulator and grabbing the 
database and checking the contents.  So I know the data is there.  I retrieve 
it using:


public Cursor getAdditiveByRowID(long rowId) throws SQLException 
{
Cursor mCursor =
db.query(true, Additives.DATABASE_TABLE, new String[] {
Additives.KEY_ROWID, 
Additives.KEY_IDENTIFIER,
Additives.KEY_NAME,
Additives.KEY_TYPE,
Additives.KEY_DESCRIPTION,
Additives.KEY_ACKNOWLEDGEMENT,
Additives.KEY_WARNING
}, 
Additives.KEY_ROWID + = + rowId, 
null,
null, 
null, 
null, 
null);
if (mCursor != null) {
mCursor.moveToFirst();
}

return mCursor;
}



When I use it the code looks like this:

if (cursor.moveToPosition(position))
{   

Log.i(TAG,contents from cursor = 
+cursor.getString(Additives.DESCRIPTION_COLUMN));

..

record.setDescription(cursor.getString(Additives.DESCRIPTION_COLUMN));
..
}

I checked the output and it appears to be truncating the output at various 
stages (one it is 1980 chars before truncating and another it is 257 chars) 
with some rows only.  I checked for bad chars but as I thought, it was fine 
(the same database is used in my iPhone app with no problems) So it must be 
something I am doing.  But I can not see where as it is wrong as soon as it 
comes from the database.  Any assistance or advice to debug this would be more 
than helpful.

I have also checked the length (Thanks Frank) incase logcat is truncating the 
strings and found this is not the issue.  It reports the length that is 
printed.  I am stumped.  I assume that others have extracted large strings from 
sqlite under android as I have some rows which are larger than the ones being 
truncated that return all the data as they should.

Regards
Damien

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Cursor.getString() truncating Strings issue

2010-12-27 Thread Damien Cooke
Hi All,
I have an app that stores it's local data in a database,  The database has a 
TEXT field called description that on some rows is truncated on retrieval. I 
have checked the database by running it app in the emulator and grabbing the 
database and checking the contents.  So I know the data is there.  I retrieve 
it using:


public Cursor getAdditiveByRowID(long rowId) throws SQLException 
{
Cursor mCursor =
db.query(true, Additives.DATABASE_TABLE, new String[] {
Additives.KEY_ROWID, 
Additives.KEY_IDENTIFIER,
Additives.KEY_NAME,
Additives.KEY_TYPE,
Additives.KEY_DESCRIPTION,
Additives.KEY_ACKNOWLEDGEMENT,
Additives.KEY_WARNING
}, 
Additives.KEY_ROWID + = + rowId, 
null,
null, 
null, 
null, 
null);
if (mCursor != null) {
mCursor.moveToFirst();
}

return mCursor;
}



When I use it the code looks like this:

if (cursor.moveToPosition(position))
{   

Log.i(TAG,contents from cursor = 
+cursor.getString(Additives.DESCRIPTION_COLUMN));

..

record.setDescription(cursor.getString(Additives.DESCRIPTION_COLUMN));
..
}

I checked the output and it appears to be truncating the output at various 
stages (one it is 1980 chars before truncating and another it is 257 chars) 
with some rows only.  I checked for bad chars but as I thought it was fine (the 
same database is used in my iPhone app with no problems) So it must be 
something I am doing.  But I can not see where as it is wrong as soon as it 
comes from the database.  Any assistance or advice to debug this would be more 
than helpful.

Regards
Damien




-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Cursor.getString() truncating Strings issue

2010-12-27 Thread Frank Weiss
logcat may be truncating, have you also tried

 Log.i(TAG,contents from cursor =
+cursor.getString(Additives.DESCRIPTION_COLUMN).length());

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en