Fixed issue 352. Multiple streets with same names in different

districts.
This commit is contained in:
Pavol Zibrita 2011-08-29 03:45:32 +02:00
parent 9675297248
commit bf89b2ae20
2 changed files with 9 additions and 11 deletions

Binary file not shown.

View file

@ -9,10 +9,6 @@ import java.sql.Statement;
import net.osmand.Algoritms;
import org.apache.commons.logging.Log;
import org.sqlite.SQLiteConfig;
import org.sqlite.SQLiteConfig.JournalMode;
import org.sqlite.SQLiteConfig.LockingMode;
import org.sqlite.SQLiteConfig.SynchronousMode;
import org.sqlite.SQLiteJDBCLoader;
import com.anvisics.jleveldb.LevelDBAccess;
@ -96,14 +92,16 @@ public enum DBDialect {
log.error("Illegal configuration", e);
throw new IllegalStateException(e);
}
SQLiteConfig config = new SQLiteConfig();
config.setCacheSize(10000); //size for number in file pages in memory, (disk cache)
config.setJournalMode(JournalMode.OFF); //no journal - on crash the db is not usabale
config.setSynchronous(SynchronousMode.OFF); // faster without synchronization
config.setLockingMode(LockingMode.EXCLUSIVE); // we are the only one using the file => no need to get/realease locks always => faster
config.setSharedCache(true); // => needed for readUncommited
config.setReadUncommited(true); // => faster queries (read also what is not commited yet, but is inserted)
Connection connection = DriverManager.getConnection("jdbc:sqlite:" + fileName);
Statement statement = connection.createStatement();
statement.executeUpdate("PRAGMA synchronous = 0");
//no journaling, saves some I/O access, but database can go corrupt
statement.executeQuery("PRAGMA journal_mode = OFF");
//we are exclusive, some speed increase ( no need to get and release logs
statement.executeQuery("PRAGMA locking_mode = EXCLUSIVE");
//increased cache_size, by default it is 2000 and we have quite huge files...
statement.executeUpdate("PRAGMA cache_size = 10000");
statement.close();
System.out.println(String.format("SQLITE running in %s mode", SQLiteJDBCLoader.isNativeMode() ? "native" : "pure-java"));
return connection;
} else if (DBDialect.DERBY == this) {