mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Better database error handling.
This commit is contained in:
@@ -77,4 +77,20 @@ public final class CursorUtil {
|
||||
return Optional.fromNullable(requireBlob(cursor, column));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads each column as a string, and concatenates them together into a single string separated by |
|
||||
*/
|
||||
public static String readRowAsString(@NonNull Cursor cursor) {
|
||||
StringBuilder row = new StringBuilder();
|
||||
|
||||
for (int i = 0, len = cursor.getColumnCount(); i < len; i++) {
|
||||
row.append(cursor.getString(i));
|
||||
if (i < len - 1) {
|
||||
row.append(" | ");
|
||||
}
|
||||
}
|
||||
|
||||
return row.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user