数据库升级总结
时间:2021-07-01 10:21:17
帮助过:2人阅读
static List<String>
GetColumns(SQLiteDatabase db, String tableName) {
List<String> ar =
null;
Cursor c =
null;
try {
c = db.rawQuery("select * from " + tableName + " limit 1",
null);
if (c !=
null) {
ar =
new ArrayList<String>
(Arrays.asList(c.getColumnNames()));
}
} catch (Exception e) {
Log.v(tableName, e.getMessage(), e);
e.printStackTrace();
} finally {
if (c !=
null)
c.close();
}
return ar;
}
public static String join(List<String>
list, String delim) {
StringBuilder buf =
new StringBuilder();
int num =
list.size();
for (
int i = 0; i < num; i++
) {
if (i != 0
)
buf.append(delim);
buf.append((String) list.get(i));
}
return buf.toString();
}
示例
http://grepcode.com/file_/repository.grepcode.com/java/ext/com.google.android/android-apps/4.0.1_r1/com/android/providers/calendar/CalendarDatabaseHelper.java/?v=source
数据库升级总结
标签: