当前位置: 首页>>代码示例>>Java>>正文


Java SynchronousMode类代码示例

本文整理汇总了Java中org.sqlite.SQLiteConfig.SynchronousMode的典型用法代码示例。如果您正苦于以下问题:Java SynchronousMode类的具体用法?Java SynchronousMode怎么用?Java SynchronousMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SynchronousMode类属于org.sqlite.SQLiteConfig包,在下文中一共展示了SynchronousMode类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import org.sqlite.SQLiteConfig.SynchronousMode; //导入依赖的package包/类
@Override
public void start() throws SQLException, ClassNotFoundException {
	File file = new File(metaData.getDataPath()+File.separator+metaData.getDatabaseName());
	if(!file.exists()){
		throw new SQLException("File not found");
	}
	
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSynchronous(SynchronousMode.OFF);

	String url = Utils.replaceParams(dbConfig.getDbURL(), metaData);

	url = url.replace("__FILE_SEPARATOR__", File.separator);
	String driver = dbConfig.getDriver();
	Class.forName(driver);
	Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData);
	SQLiteConfig config = new SQLiteConfig(prop);
	config.setSynchronous(SynchronousMode.OFF);
	conn = DriverManager.getConnection(url, config.toProperties());
	// conn.setAutoCommit(false);
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:22,代码来源:TMDatabaseImpl.java

示例2: connect

import org.sqlite.SQLiteConfig.SynchronousMode; //导入依赖的package包/类
/**
 * Create a connection to the SQLite db
 * 
 * @param url an url formating string to the sqlte db
 * @param info aditional properties for the connection
 * @return Connection the jdbc connection
 */
public Connection connect(final String url, final Properties info) throws SQLException
{
	String sqliteUrl = adaptUrl(url);
		
	SQLiteConfig config = new SQLiteConfig(info);

	config.setSharedCache(true);
	config.setSynchronous(SynchronousMode.NORMAL);
	
	
	if(( config.getOpenModeFlags() & SQLiteOpenMode.READWRITE.flag) > 0) {
		config.setTransactionMode(TransactionMode.IMMEDIATE);
	} else if(( config.getOpenModeFlags() & SQLiteOpenMode.READONLY.flag) > 0) {
		config.setTransactionMode(TransactionMode.DEFFERED);
	}
	
	Connection connection = sqliteJDBC.connect(sqliteUrl, config.toProperties());

	return new SQLiteConnectionWrapper(connection);
}
 
开发者ID:lathil,项目名称:Ptoceti,代码行数:28,代码来源:SQLiteJDBC.java

示例3: ScoreDatabaseAccessor

import org.sqlite.SQLiteConfig.SynchronousMode; //导入依赖的package包/类
public ScoreDatabaseAccessor(String path) throws ClassNotFoundException {
	Class.forName("org.sqlite.JDBC");
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSharedCache(true);
	conf.setSynchronous(SynchronousMode.OFF);
	// conf.setJournalMode(JournalMode.MEMORY);
	SQLiteDataSource ds = new SQLiteDataSource(conf);
	ds.setUrl("jdbc:sqlite:" + path);
	qr = new QueryRunner(ds);
}
 
开发者ID:exch-bms2,项目名称:beatoraja,代码行数:11,代码来源:ScoreDatabaseAccessor.java

示例4: SongInformationAccessor

import org.sqlite.SQLiteConfig.SynchronousMode; //导入依赖的package包/类
public SongInformationAccessor(String filepath) throws ClassNotFoundException {
	Class.forName("org.sqlite.JDBC");
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSharedCache(true);
	conf.setSynchronous(SynchronousMode.OFF);
	// conf.setJournalMode(JournalMode.MEMORY);
	ds = new SQLiteDataSource(conf);
	ds.setUrl("jdbc:sqlite:" + filepath);
	qr = new QueryRunner(ds);
	createTable();
}
 
开发者ID:exch-bms2,项目名称:beatoraja,代码行数:12,代码来源:SongInformationAccessor.java

示例5: SQLiteSongDatabaseAccessor

import org.sqlite.SQLiteConfig.SynchronousMode; //导入依赖的package包/类
public SQLiteSongDatabaseAccessor(String filepath, String[] bmsroot) throws ClassNotFoundException {
	Class.forName("org.sqlite.JDBC");
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSharedCache(true);
	conf.setSynchronous(SynchronousMode.OFF);
	// conf.setJournalMode(JournalMode.MEMORY);
	ds = new SQLiteDataSource(conf);
	ds.setUrl("jdbc:sqlite:" + filepath);
	qr = new QueryRunner(ds);
	root = Paths.get(".");
	this.bmsroot = bmsroot;
	createTable();		
}
 
开发者ID:exch-bms2,项目名称:beatoraja,代码行数:14,代码来源:SQLiteSongDatabaseAccessor.java

示例6: ScoreLogDatabaseAccessor

import org.sqlite.SQLiteConfig.SynchronousMode; //导入依赖的package包/类
public ScoreLogDatabaseAccessor(String path) throws ClassNotFoundException {
	Class.forName("org.sqlite.JDBC");
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSharedCache(true);
	conf.setSynchronous(SynchronousMode.OFF);
	// conf.setJournalMode(JournalMode.MEMORY);
	ds = new SQLiteDataSource(conf);
	ds.setUrl("jdbc:sqlite:" + path);
	qr = new QueryRunner(ds);
	createTable();		
}
 
开发者ID:exch-bms2,项目名称:beatoraja,代码行数:12,代码来源:ScoreLogDatabaseAccessor.java

示例7: start

import org.sqlite.SQLiteConfig.SynchronousMode; //导入依赖的package包/类
@Override
public void start() throws SQLException, ClassNotFoundException {
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSynchronous(SynchronousMode.OFF);

	String url = Utils.replaceParams(dbConfig.getDbURL(), metaData);
	url = url.replace("__FILE_SEPARATOR__", File.separator);
	String driver = dbConfig.getDriver();
	Class.forName(driver);
	Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData);
	SQLiteConfig config = new SQLiteConfig(prop);
	config.setSynchronous(SynchronousMode.OFF);
	conn = DriverManager.getConnection(url, config.toProperties());
	// conn.setAutoCommit(false);
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:16,代码来源:TMDatabaseImpl.java

示例8: setSynchronous

import org.sqlite.SQLiteConfig.SynchronousMode; //导入依赖的package包/类
/**
 * Sets the setting of the "synchronous" flag.
 * @param mode One of OFF, NORMAL or FULL;
 * @see <a href="http://www.sqlite.org/pragma.html#pragma_synchronous">
 * http://www.sqlite.org/pragma.html#pragma_synchronous</a>
 */
public void setSynchronous(String mode) {
    config.setSynchronous(SynchronousMode.valueOf(mode));
}
 
开发者ID:stome,项目名称:stomev1,代码行数:10,代码来源:SQLiteDataSource.java


注:本文中的org.sqlite.SQLiteConfig.SynchronousMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。