Skip to content

Commit 8b73d93

Browse files
author
DrKLO
committed
Fixed database update to new version
1 parent 21273f8 commit 8b73d93

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

TMessagesProj/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ android {
8080
defaultConfig {
8181
minSdkVersion 8
8282
targetSdkVersion 19
83-
versionCode 309
83+
versionCode 310
8484
versionName "1.8.0"
8585
}
8686
}

TMessagesProj/src/main/java/org/telegram/SQLite/SQLiteDatabase.java

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@
1111
import org.telegram.messenger.FileLog;
1212
import org.telegram.ui.ApplicationLoader;
1313

14-
import java.util.HashMap;
15-
import java.util.Map;
16-
1714
public class SQLiteDatabase {
1815
private final int sqliteHandle;
1916

20-
private final Map<String, SQLitePreparedStatement> preparedMap = new HashMap<String, SQLitePreparedStatement>();
2117
private boolean isOpen = false;
2218
private boolean inTransaction = false;
2319

@@ -36,23 +32,13 @@ public boolean tableExists(String tableName) throws SQLiteException {
3632
return executeInt(s, tableName) != null;
3733
}
3834

39-
public void execute(String sql, Object... args) throws SQLiteException {
40-
checkOpened();
41-
SQLiteCursor cursor = query(sql, args);
42-
try {
43-
cursor.next();
44-
} finally {
45-
cursor.dispose();
46-
}
47-
}
48-
4935
public SQLitePreparedStatement executeFast(String sql) throws SQLiteException {
5036
return new SQLitePreparedStatement(this, sql, true);
5137
}
5238

5339
public Integer executeInt(String sql, Object... args) throws SQLiteException {
5440
checkOpened();
55-
SQLiteCursor cursor = query(sql, args);
41+
SQLiteCursor cursor = queryFinalized(sql, args);
5642
try {
5743
if (!cursor.next()) {
5844
return null;
@@ -63,18 +49,6 @@ public Integer executeInt(String sql, Object... args) throws SQLiteException {
6349
}
6450
}
6551

66-
public SQLiteCursor query(String sql, Object... args) throws SQLiteException {
67-
checkOpened();
68-
SQLitePreparedStatement stmt = preparedMap.get(sql);
69-
70-
if (stmt == null) {
71-
stmt = new SQLitePreparedStatement(this, sql, false);
72-
preparedMap.put(sql, stmt);
73-
}
74-
75-
return stmt.query(args);
76-
}
77-
7852
public SQLiteCursor queryFinalized(String sql, Object... args) throws SQLiteException {
7953
checkOpened();
8054
return new SQLitePreparedStatement(this, sql, true).query(args);
@@ -83,9 +57,6 @@ public SQLiteCursor queryFinalized(String sql, Object... args) throws SQLiteExce
8357
public void close() {
8458
if (isOpen) {
8559
try {
86-
for (SQLitePreparedStatement stmt : preparedMap.values()) {
87-
stmt.finalizeQuery();
88-
}
8960
commitTransaction();
9061
closedb(sqliteHandle);
9162
} catch (SQLiteException e) {

0 commit comments

Comments
 (0)