Is there any way to order dataset with locale alphabetical order without case sensitivity? I have found "COLLATE LOCALIZED", "COLLATE NOCASE", but "COLLATE LOCALIZED NOCASE" shows error (also in the reverse order).
Thanks for any response!
答案 0 :(得分:0)
我没有找到任何简单的方法。我创建了其他排序表列,其中包含规范化数据(标记为here)。为规范化表列创建常量名称前缀:
distfunc <- function(data, ID1, ID2, n, m) {
X1 <- ID1
X2 <- ID2
X3 <- unlist(mapply(':', n, m))
data <- rbind(data,data.frame(X1, X2, X3))
return(data)
}
创建表(对于文本列创建一个带前缀的列):
public static final String ASCII_PREFIX = "ascii_";
更改了表数据填充(添加特殊列的标准化数据):
String sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (";
for( columnModel column: table.columns ) {
if( column.position > 0 ){ sql += ", "; }
sql += column.dbName + " " + column.dbType;
}
for( columnModel column: table.columns ) {
if( column.dbType.equals("TEXT") ) {
sql += ", " + ASCII_PREFIX + column.dbName + " " + column.dbType;
}
}
sql += ")";
db.execSQL(sql);
然后我为文本列排序:
//...cycle for data filling...
ContentValues values = new ContentValues();
for( columnModel column: table.columns ) {
values.put(column.dbName, valueStr);
if( column.dbType.equals("TEXT") ){
values.put(ASCII_PREFIX + column.dbName, normalize(valueStr));
}
}
db.insert(tableName, null, values);
答案 1 :(得分:0)
这对我有用:
field COLLATE LOCALIZED, field COLLATE NOCASE