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


Java SQLiteConnection.dispose方法代码示例

本文整理汇总了Java中com.almworks.sqlite4java.SQLiteConnection.dispose方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteConnection.dispose方法的具体用法?Java SQLiteConnection.dispose怎么用?Java SQLiteConnection.dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.almworks.sqlite4java.SQLiteConnection的用法示例。


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

示例1: CardsManager

import com.almworks.sqlite4java.SQLiteConnection; //导入方法依赖的package包/类
private CardsManager() throws SQLiteException {
	SQLiteConnection db = new SQLiteConnection(new File(YGOCoreMain.getConfigurator().getDataBasePath()));
	db.open(true);
	SQLiteStatement st = db.prepare("SELECT id, ot, alias, type, level, race, attribute, atk, def FROM datas");
	try {
		while(st.step()) {
			int id = st.columnInt(0);
			Card c = new Card(id, st.columnInt(1));
			c.alias = st.columnInt(2);
			c.setcode = st.columnInt(3);
			int levelinfo = st.columnInt(4);
			c.level = levelinfo & 0xff;
			c.lscale = (levelinfo >> 24) & 0xff;
			c.rscale = (levelinfo >> 16) & 0xff;
			c.race = st.columnInt(6);
			c.attr = st.columnInt(7);
			c.attack = st.columnInt(8);
			c.defense = st.columnInt(9);
			mCards.put(id, c);
		}
	} finally {
		st.dispose();
	}
	db.dispose();
	
}
 
开发者ID:garymabin,项目名称:JYGOServer,代码行数:27,代码来源:CardsManager.java

示例2: canOpen

import com.almworks.sqlite4java.SQLiteConnection; //导入方法依赖的package包/类
protected static boolean canOpen(Configuration conf,
        String input,
        ProviderProperties providerProperties) throws IOException
{
  MbVectorTilesSettings dbSettings = parseResourceName(input, conf, providerProperties);
  SQLiteConnection conn = null;
  try {
    conn = getDbConnection(dbSettings, conf);
    return true;
  }
  catch(IOException e) {
    log.info("Unable to open MB vector tiles database: " + dbSettings.getFilename(), e);
  }
  finally {
    if (conn != null) {
      conn.dispose();
    }
  }
  return false;
}
 
开发者ID:ngageoint,项目名称:mrgeo,代码行数:21,代码来源:MbVectorTilesDataProvider.java

示例3: close

import com.almworks.sqlite4java.SQLiteConnection; //导入方法依赖的package包/类
@Override
public void close() {
    // it's not possible to call dispose from other threads
    // so the best we can do is call dispose on the connection
    // for the same thread as us
    SQLiteConnection conn = localConnection;
    if (conn != null && !conn.isDisposed()) {
        conn.dispose();
    }
}
 
开发者ID:cloudant,项目名称:sync-android,代码行数:11,代码来源:SQLiteWrapper.java

示例4: finalize

import com.almworks.sqlite4java.SQLiteConnection; //导入方法依赖的package包/类
@Override
protected void finalize() throws Throwable {
	SQLiteConnection connection = this.get();
	if (connection != null) {
		log.debug("Disposing SQLite connection: " + connection.toString());
		connection.dispose();
	}
}
 
开发者ID:jagornet,项目名称:dhcp,代码行数:9,代码来源:SqliteLeaseManager.java

示例5: getRecordCount

import com.almworks.sqlite4java.SQLiteConnection; //导入方法依赖的package包/类
protected long getRecordCount(Configuration conf) throws IOException
{
  String countQuery = "SELECT COUNT(*) FROM tiles WHERE zoom_level=?";
  // Run the count query and grab the result.
  SQLiteConnection conn = null;
  try {
    conn = MbVectorTilesDataProvider.getDbConnection(dbSettings, conf);
    SQLiteStatement stmt = null;
    try {
      stmt = conn.prepare(countQuery, false);
      stmt.bind(1, zoomLevel);
      if (stmt.step()) {
        return stmt.columnLong(0);
      }
      else {
        throw new IOException("Unable to count tiles for zoom " + zoomLevel + " in " + dbSettings.getFilename());
      }
    }
    finally {
      if (stmt != null) {
        stmt.dispose();
      }
    }
  }
  catch (SQLiteException e)
  {
    String msg = "Unable to get the count of records using query: " + countQuery;
    log.error(msg, e);
    throw new IOException(msg, e);
  }
  finally {
    if (conn != null) {
      conn.dispose();
    }
  }
}
 
开发者ID:ngageoint,项目名称:mrgeo,代码行数:37,代码来源:MbVectorTilesInputFormat.java

示例6: testEmptyResultSave

import com.almworks.sqlite4java.SQLiteConnection; //导入方法依赖的package包/类
@Test
public void testEmptyResultSave() throws SQLiteException
{
	SQLiteDataStore ds = new SQLiteDataStore(tempFile);
	ds.setupDataStore();
	ds.storeConfigurationRun("My First Identifier");

	IndependentVariablesOfFFSB expBenchVars = SBHModelFactory.eINSTANCE.createIndependentVariablesOfFFSB();
	expBenchVars.setReadPercentage(100);
	expBenchVars.setReadBlockSize(32);
	expBenchVars.setWriteBlockSize(64);
	expBenchVars.setFilesetSize(100);

	IndependentVariablesOfSut expSutVars = SBHModelFactory.eINSTANCE.createIndependentVariablesOfSut();
	expSutVars.setFileSystem(FileSystem.EXT4);
	expSutVars.setScheduler(Scheduler.NOOP);

	String hostId = String.format("hostId_%d", (int) (Math.random() * 1000));

	DependentVariables depVars = SBHModelFactory.eINSTANCE.createDependentVariables();
	depVars.setBenchmarkPrefix("ffsb");
	List<DependentVariables> resultList = Lists.newArrayList();
	resultList.add(depVars);

	ds.storeExperimentResults(0, hostId, "FFSBBenchmark", 1, "testID", expSutVars, expBenchVars, resultList);

	ds.finishConfigurationRun();
	ds.closeDataStore();

	// Check database contains row
	SQLiteConnection db = new SQLiteConnection(new File(tempFile));
	db.open(false);

	// Run-Table
	SQLiteStatement stmt = db.prepare("SELECT count(runId) FROM runs WHERE hostId=?;");
	stmt.bind(1, hostId);
	stmt.step();
	Assert.assertEquals(1, stmt.columnInt(0));
	stmt.dispose();

	// IndependentVars
	SQLiteStatement stmt2 = db.prepare("SELECT count(runId) FROM ffsbIndependentVars;");
	stmt2.step();
	Assert.assertEquals(1, stmt2.columnInt(0));
	stmt2.dispose();

	db.dispose();
}
 
开发者ID:StoragePerformanceAnalyzer,项目名称:SPA,代码行数:49,代码来源:SQLiteTest.java

示例7: getSplits

import com.almworks.sqlite4java.SQLiteConnection; //导入方法依赖的package包/类
@Override
public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException
{
  zoomLevel = dbSettings.getZoom();
  if (zoomLevel < 0) {
    // Get the max zoom from the tile data
    SQLiteConnection conn = null;
    try {
      conn = MbVectorTilesDataProvider.getDbConnection(dbSettings,
              context.getConfiguration());
      String query = "SELECT MAX(zoom_level) FROM tiles";
      SQLiteStatement stmt = null;
      try {
        stmt = conn.prepare(query, false);
        if (stmt.step()) {
          zoomLevel = stmt.columnInt(0);
        }
        else {
          throw new IOException("Unable to get the max zoom level of " + dbSettings.getFilename());
        }
      }
      finally {
        if (stmt != null) {
          stmt.dispose();
        }
      }
    }
    catch(SQLiteException e) {
      throw new IOException("Unable to query " + dbSettings.getFilename() + " for the max zoom level", e);
    }
    finally {
      if (conn != null) {
        conn.dispose();
      }
    }
  }
  long recordCount = getRecordCount(context.getConfiguration());
  long recordsPerPartition = dbSettings.getTilesPerPartition();
  long numPartitions = recordCount / recordsPerPartition;
  if (numPartitions * recordsPerPartition < recordCount) {
    numPartitions += 1;
  }
  List<InputSplit> splits = new ArrayList<InputSplit>();
  for (int i=0; i < numPartitions; i++) {
    MbVectorTilesInputSplit split = new MbVectorTilesInputSplit(i * recordsPerPartition, recordsPerPartition, zoomLevel);
    splits.add(split);
  }
  return splits;
}
 
开发者ID:ngageoint,项目名称:mrgeo,代码行数:50,代码来源:MbVectorTilesInputFormat.java


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