Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions src/main/java/com/ubhave/datastore/db/UnencryptedDataTables.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,35 @@ public Set<String> getTableNames()

private UnencryptedDataTable getTable(final String tableName)
{
UnencryptedDataTable table = dataTableMap.get(tableName);
if (table == null)
synchronized (lock)
{
if (DataHandlerConfig.shouldLog())
if (!dataTableMap.containsKey(tableName))
{
Log.d(DatabaseStorage.TAG, "Adding: "+tableName+" to table map.");
if (DataHandlerConfig.shouldLog())
{
Log.d(DatabaseStorage.TAG, "Adding: "+tableName+" to table map.");
}
SQLiteDatabase database = getWritableDatabase();
database.beginTransaction();
try
{
UnencryptedDataTable table = new UnencryptedDataTable(tableName);
table.createTable(database);
dataTableMap.put(tableName, table);
database.setTransactionSuccessful();
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
database.endTransaction();
database.close();
}
}
table = new UnencryptedDataTable(tableName);
dataTableMap.put(tableName, table);
return dataTableMap.get(tableName);
}
return table;
}

@Override
Expand Down