diff options
author | uabdullah <uabdullah@google.com> | 2017-10-26 17:22:43 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-10-27 08:47:53 -0700 |
commit | 192fc8ea066576914ca9fd3035021b0c622ee1f3 (patch) | |
tree | fa4763bee65a8786e22e36d6cecd5fefcad05c97 | |
parent | 168d09c3ad4fdc93ab018f68b7f583be7acd2851 (diff) |
Use string concatenation for CREATE_TABLE_SQL instead of StringBuilder()
The current implementation is easy to read but causes klippy warnings.
Also removed the AnnotatedCallLogDatabaseHelperTest.voicemailColumnsExist and combined it with the onCreate Test
Test: Unit Test
PiperOrigin-RevId: 173614534
Change-Id: If00f7e91f48e582aa481268d88a4871cc2364684
-rw-r--r-- | java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java index a6a646655..9fd5bd970 100644 --- a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java +++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java @@ -32,36 +32,34 @@ class AnnotatedCallLogDatabaseHelper extends SQLiteOpenHelper { this.maxRows = maxRows; } - // TODO(uabdullah): Use concatenation to avoid klippy warnings private static final String CREATE_TABLE_SQL = - new StringBuilder() - .append("create table if not exists " + AnnotatedCallLog.TABLE + " (") - // Common columns. - .append(AnnotatedCallLog._ID + " integer primary key, ") - .append(AnnotatedCallLog.TIMESTAMP + " integer, ") - .append(AnnotatedCallLog.NAME + " string, ") - .append(AnnotatedCallLog.NUMBER + " blob, ") - .append(AnnotatedCallLog.FORMATTED_NUMBER + " string, ") - .append(AnnotatedCallLog.PHOTO_URI + " string, ") - .append(AnnotatedCallLog.PHOTO_ID + " integer, ") - .append(AnnotatedCallLog.LOOKUP_URI + " string, ") - .append(AnnotatedCallLog.DURATION + " integer, ") - .append(AnnotatedCallLog.NUMBER_TYPE_LABEL + " string, ") - .append(AnnotatedCallLog.IS_READ + " integer, ") - .append(AnnotatedCallLog.NEW + " integer, ") - .append(AnnotatedCallLog.GEOCODED_LOCATION + " string, ") - .append(AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME + " string, ") - .append(AnnotatedCallLog.PHONE_ACCOUNT_ID + " string, ") - .append(AnnotatedCallLog.PHONE_ACCOUNT_LABEL + " string, ") - .append(AnnotatedCallLog.PHONE_ACCOUNT_COLOR + " integer, ") - .append(AnnotatedCallLog.FEATURES + " integer, ") - .append(AnnotatedCallLog.IS_BUSINESS + " integer, ") - .append(AnnotatedCallLog.IS_VOICEMAIL + " integer, ") - .append(AnnotatedCallLog.TRANSCRIPTION + " integer, ") - .append(AnnotatedCallLog.VOICEMAIL_URI + " string, ") - .append(AnnotatedCallLog.CALL_TYPE + " integer") - .append(");") - .toString(); + "create table if not exists " + + AnnotatedCallLog.TABLE + + " (" + + (AnnotatedCallLog._ID + " integer primary key, ") + + (AnnotatedCallLog.TIMESTAMP + " integer, ") + + (AnnotatedCallLog.NAME + " string, ") + + (AnnotatedCallLog.NUMBER + " blob, ") + + (AnnotatedCallLog.FORMATTED_NUMBER + " string, ") + + (AnnotatedCallLog.PHOTO_URI + " string, ") + + (AnnotatedCallLog.PHOTO_ID + " integer, ") + + (AnnotatedCallLog.LOOKUP_URI + " string, ") + + (AnnotatedCallLog.DURATION + " integer, ") + + (AnnotatedCallLog.NUMBER_TYPE_LABEL + " string, ") + + (AnnotatedCallLog.IS_READ + " integer, ") + + (AnnotatedCallLog.NEW + " integer, ") + + (AnnotatedCallLog.GEOCODED_LOCATION + " string, ") + + (AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME + " string, ") + + (AnnotatedCallLog.PHONE_ACCOUNT_ID + " string, ") + + (AnnotatedCallLog.PHONE_ACCOUNT_LABEL + " string, ") + + (AnnotatedCallLog.PHONE_ACCOUNT_COLOR + " integer, ") + + (AnnotatedCallLog.FEATURES + " integer, ") + + (AnnotatedCallLog.IS_BUSINESS + " integer, ") + + (AnnotatedCallLog.IS_VOICEMAIL + " integer, ") + + (AnnotatedCallLog.TRANSCRIPTION + " integer, ") + + (AnnotatedCallLog.VOICEMAIL_URI + " string, ") + + (AnnotatedCallLog.CALL_TYPE + " integer") + + ");"; /** Deletes all but the first maxRows rows (by timestamp) to keep the table a manageable size. */ // TODO(zachh): Prevent voicemails from being garbage collected. |