mirror of
https://github.com/mastodon/mastodon-android.git
synced 2024-12-22 06:38:16 +01:00
fix sql strings are indexed at 1
This commit is contained in:
parent
f91b887586
commit
af8c071b4a
@ -384,7 +384,7 @@ public class AccountSessionManager{
|
||||
private void readInstanceInfo(SQLiteDatabase db, Set<String> domains){
|
||||
for(String domain : domains){
|
||||
final int maxEmojiLength=500000;
|
||||
try(Cursor cursor=db.rawQuery("SELECT domain, instance_obj, substring(emojis,0,?) AS emojis, length(emojis) AS emoji_length, last_updated, version FROM instances WHERE `domain` = ?",
|
||||
try(Cursor cursor=db.rawQuery("SELECT domain, instance_obj, substr(emojis,1,?) AS emojis, length(emojis) AS emoji_length, last_updated, version FROM instances WHERE `domain` = ?",
|
||||
new String[]{String.valueOf(maxEmojiLength) , domain})) {
|
||||
ContentValues values=new ContentValues();
|
||||
while(cursor.moveToNext()){
|
||||
@ -401,7 +401,7 @@ public class AccountSessionManager{
|
||||
int emojiStringLength=values.getAsInteger("emoji_length");
|
||||
if(emojiStringLength>maxEmojiLength){
|
||||
final int pagesize=1000000;
|
||||
for(int start=maxEmojiLength; start<emojiStringLength; start+=pagesize){
|
||||
for(int start=maxEmojiLength + 1; start<=emojiStringLength; start+=pagesize){
|
||||
try(Cursor emojiCursor=db.rawQuery("SELECT substr(emojis,?, ?) FROM instances WHERE `domain` = ?", new String[]{String.valueOf(start), String.valueOf(pagesize), domain})){
|
||||
emojiCursor.moveToNext();
|
||||
emojiSB.append(emojiCursor.getString(0));
|
||||
|
Loading…
Reference in New Issue
Block a user