From 8b73d93d1a4e5854567bbad1a28ef199f4d259d7 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Sun, 24 Aug 2014 00:51:53 +0300 Subject: [PATCH] Fixed database update to new version --- TMessagesProj/build.gradle | 2 +- .../org/telegram/SQLite/SQLiteDatabase.java | 31 +------------------ 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index c1357dbb2..e3e72fe76 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -80,7 +80,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 19 - versionCode 309 + versionCode 310 versionName "1.8.0" } } diff --git a/TMessagesProj/src/main/java/org/telegram/SQLite/SQLiteDatabase.java b/TMessagesProj/src/main/java/org/telegram/SQLite/SQLiteDatabase.java index 9d1da19e0..451673154 100755 --- a/TMessagesProj/src/main/java/org/telegram/SQLite/SQLiteDatabase.java +++ b/TMessagesProj/src/main/java/org/telegram/SQLite/SQLiteDatabase.java @@ -11,13 +11,9 @@ package org.telegram.SQLite; import org.telegram.messenger.FileLog; import org.telegram.ui.ApplicationLoader; -import java.util.HashMap; -import java.util.Map; - public class SQLiteDatabase { private final int sqliteHandle; - private final Map preparedMap = new HashMap(); private boolean isOpen = false; private boolean inTransaction = false; @@ -36,23 +32,13 @@ public class SQLiteDatabase { return executeInt(s, tableName) != null; } - public void execute(String sql, Object... args) throws SQLiteException { - checkOpened(); - SQLiteCursor cursor = query(sql, args); - try { - cursor.next(); - } finally { - cursor.dispose(); - } - } - public SQLitePreparedStatement executeFast(String sql) throws SQLiteException { return new SQLitePreparedStatement(this, sql, true); } public Integer executeInt(String sql, Object... args) throws SQLiteException { checkOpened(); - SQLiteCursor cursor = query(sql, args); + SQLiteCursor cursor = queryFinalized(sql, args); try { if (!cursor.next()) { return null; @@ -63,18 +49,6 @@ public class SQLiteDatabase { } } - public SQLiteCursor query(String sql, Object... args) throws SQLiteException { - checkOpened(); - SQLitePreparedStatement stmt = preparedMap.get(sql); - - if (stmt == null) { - stmt = new SQLitePreparedStatement(this, sql, false); - preparedMap.put(sql, stmt); - } - - return stmt.query(args); - } - public SQLiteCursor queryFinalized(String sql, Object... args) throws SQLiteException { checkOpened(); return new SQLitePreparedStatement(this, sql, true).query(args); @@ -83,9 +57,6 @@ public class SQLiteDatabase { public void close() { if (isOpen) { try { - for (SQLitePreparedStatement stmt : preparedMap.values()) { - stmt.finalizeQuery(); - } commitTransaction(); closedb(sqliteHandle); } catch (SQLiteException e) {