MCPcopy Create free account
hub / github.com/M66B/FairEmail / _hasJson

Method _hasJson

app/src/main/java/eu/faircode/email/DB.java:167–201  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

165 }
166
167 private static boolean _hasJson() {
168 try {
169 // https://www.sqlite.org/json1.html
170 // The JSON functions and operators are built into SQLite by default, as of SQLite version 3.38.0 (2022-02-22)
171 // SDK 14 / Android 14 has 3.39.2
172 // https://stackoverflow.com/questions/2421189/version-of-sqlite-used-in-android
173 String version = getSqliteVersion();
174 if (version == null)
175 return false;
176
177 String[] parts = version.split("\\.");
178 if (parts.length == 0)
179 return false;
180
181 int[] numbers = new int[parts.length];
182 for (int i = 0; i < parts.length; i++)
183 numbers[i] = Integer.parseInt(parts[i]);
184
185 if (numbers[0] < 3)
186 return false;
187 if (numbers[0] > 3)
188 return true;
189
190 if (parts.length == 1)
191 return false;
192
193 if (numbers[1] < 38)
194 return false;
195
196 return true;
197 } catch (Throwable ex) {
198 Log.e(ex);
199 return false;
200 }
201 }
202
203 @Override
204 public void init(@NonNull DatabaseConfiguration configuration) {

Callers 1

getInstanceMethod · 0.95

Calls 3

getSqliteVersionMethod · 0.95
eMethod · 0.95
parseIntMethod · 0.45

Tested by

no test coverage detected