• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SQLiteDataSource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ScoreDatabaseAccessor

import org.sqlite.SQLiteDataSource; //导入依赖的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


示例2: LibraryDatabase

import org.sqlite.SQLiteDataSource; //导入依赖的package包/类
/**
 * Loads the database used for storing locations of mp3 files contained in the library for later playback
 * If needed creates a new database based on the available tags of the mp3agic library
 *
 * @param databaseLocation Location of the sqlite database
 * @throws SQLException should theoretically not get thrown, if thrown something in generating the tables through SQL went wrong
 * @throws IOException  gets thrown in case the needed folder structure for the database can't be created
 */
public LibraryDatabase(File databaseLocation) throws SQLException, IOException {
    if(!databaseLocation.isAbsolute()) databaseLocation = databaseLocation.getAbsoluteFile();
    if (!databaseLocation.exists()) {
        if (!databaseLocation.getParentFile().mkdirs() && !databaseLocation.getParentFile().exists())
            throw new IOException("Unable to create database directory");

        Connection conn = DriverManager.getConnection("jdbc:sqlite:" + databaseLocation.getAbsolutePath());
        Statement stmt = conn.createStatement();

        stmt.executeUpdate("CREATE TABLE IF NOT EXISTS LibraryFolder (path TEXT PRIMARY KEY)");

        StringBuilder builderFileTable = new StringBuilder();
        builderFileTable.append("CREATE TABLE IF NOT EXISTS LibraryFile (file_id INTEGER PRIMARY KEY AUTOINCREMENT, path TEXT UNIQUE");
        for (ID3Helper.ID3Tag id3Tag : ID3Helper.ID3Tag.values()) {
            builderFileTable
                    .append(", ")
                    .append(id3Tag.toString().toLowerCase())
                    .append(" TEXT");
        }
        builderFileTable.append(")");
        stmt.executeUpdate(builderFileTable.toString());
        conn.close();
    }

    /**/

    SQLiteTemplates sqLiteTemplate = new SQLiteTemplates();
    Configuration config = new Configuration(sqLiteTemplate);

    SQLiteDataSource dataSource = new SQLiteDataSource();
    dataSource.setUrl("jdbc:sqlite:" + databaseLocation.getAbsolutePath());

    queryFactory = new SQLQueryFactory(config, dataSource);

    reloadFiles();
    reloadFolders();
}
 
开发者ID:MolaynoxX,项目名称:amperfi,代码行数:46,代码来源:LibraryDatabase.java


示例3: SongInformationAccessor

import org.sqlite.SQLiteDataSource; //导入依赖的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


示例4: SQLiteSongDatabaseAccessor

import org.sqlite.SQLiteDataSource; //导入依赖的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


示例5: ScoreLogDatabaseAccessor

import org.sqlite.SQLiteDataSource; //导入依赖的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


示例6: OffHeapPersistence

import org.sqlite.SQLiteDataSource; //导入依赖的package包/类
protected OffHeapPersistence(SimpleAttribute<O, A> primaryKeyAttribute, Properties overrideProperties) {
    Properties effectiveProperties = new Properties(DEFAULT_PROPERTIES);
    effectiveProperties.putAll(overrideProperties);
    SQLiteConfig sqLiteConfig = new SQLiteConfig(effectiveProperties);
    SQLiteDataSource sqLiteDataSource = new SQLiteDataSource(sqLiteConfig);
    String instanceName = "cqengine_" + INSTANCE_ID_GENERATOR.incrementAndGet();
    sqLiteDataSource.setUrl("jdbc:sqlite:file:" + instanceName + "?mode=memory&cache=shared");

    this.primaryKeyAttribute = primaryKeyAttribute;
    this.instanceName = instanceName;
    this.sqLiteDataSource = sqLiteDataSource;
    this.persistentConnection = getConnectionInternal(null, noQueryOptions());
}
 
开发者ID:npgall,项目名称:cqengine,代码行数:14,代码来源:OffHeapPersistence.java


示例7: DiskPersistence

import org.sqlite.SQLiteDataSource; //导入依赖的package包/类
protected DiskPersistence(SimpleAttribute<O, A> primaryKeyAttribute, File file, Properties overrideProperties) {
    Properties effectiveProperties = new Properties();
    effectiveProperties.putAll(DEFAULT_PROPERTIES);
    effectiveProperties.putAll(overrideProperties);
    SQLiteConfig sqLiteConfig = new SQLiteConfig(effectiveProperties);
    SQLiteDataSource sqLiteDataSource = new SQLiteDataSource(sqLiteConfig);
    sqLiteDataSource.setUrl("jdbc:sqlite:file:" + file);

    this.primaryKeyAttribute = primaryKeyAttribute;
    this.file = file.getAbsoluteFile();
    this.sqLiteDataSource = sqLiteDataSource;
}
 
开发者ID:npgall,项目名称:cqengine,代码行数:13,代码来源:DiskPersistence.java


示例8: testEqualsAndHashCode

import org.sqlite.SQLiteDataSource; //导入依赖的package包/类
@Test
public void testEqualsAndHashCode() {
    SQLiteDataSource ds1 = new SQLiteDataSource(new SQLiteConfig());
    ds1.setUrl("foo");
    SQLiteDataSource ds2 = new SQLiteDataSource(new SQLiteConfig());
    ds2.setUrl("bar");
    EqualsVerifier.forClass(OffHeapPersistence.class)
            .suppress(Warning.NULL_FIELDS, Warning.STRICT_INHERITANCE)
            .withPrefabValues(SQLiteDataSource.class, ds1, ds2)
            .verify();
}
 
开发者ID:npgall,项目名称:cqengine,代码行数:12,代码来源:OffHeapPersistenceTest.java


示例9: testEqualsAndHashCode

import org.sqlite.SQLiteDataSource; //导入依赖的package包/类
@Test
public void testEqualsAndHashCode() {
    SQLiteDataSource ds1 = new SQLiteDataSource(new SQLiteConfig());
    ds1.setUrl("foo");
    SQLiteDataSource ds2 = new SQLiteDataSource(new SQLiteConfig());
    ds2.setUrl("bar");
    EqualsVerifier.forClass(DiskPersistence.class)
            .suppress(Warning.NULL_FIELDS, Warning.STRICT_INHERITANCE)
            .withPrefabValues(SQLiteDataSource.class, ds1, ds2)
            .verify();
}
 
开发者ID:npgall,项目名称:cqengine,代码行数:12,代码来源:DiskPersistenceTest.java


示例10: before

import org.sqlite.SQLiteDataSource; //导入依赖的package包/类
@Override
public void before() {
    try {
        super.before();
        dbFile = newFile();
        url = "jdbc:sqlite:" + dbFile.getAbsolutePath();
        dataSource = new SQLiteDataSource(config);
        dataSource.setUrl(url);
    }
    catch (Throwable throwable) {
        throw new IllegalStateException(throwable);
    }
}
 
开发者ID:npgall,项目名称:cqengine,代码行数:14,代码来源:TemporaryDatabase.java


示例11: SQLiteDataSourceWrapper

import org.sqlite.SQLiteDataSource; //导入依赖的package包/类
SQLiteDataSourceWrapper(Properties props) {
	SQLiteConfig config = new SQLiteConfig(props);
	String dbName = props.getProperty(DataSourceFactory.JDBC_DATABASE_NAME);
	
	wrapped = new SQLiteDataSource(config);
	wrapped.setUrl(wrapped.getUrl() + dbName);
}
 
开发者ID:lathil,项目名称:Ptoceti,代码行数:8,代码来源:SQLiteDataSourceWrapper.java


示例12: newDataSource

import org.sqlite.SQLiteDataSource; //导入依赖的package包/类
@Override
public DataSource newDataSource() throws SQLException {
    return new SQLiteDataSource();
}
 
开发者ID:wisdom-framework,项目名称:wisdom-jdbc,代码行数:5,代码来源:SqliteService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XExpression类代码示例发布时间:2022-05-22
下一篇:
Java Blend类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap