From e47b52e291ca0dd5026e974867c83ee46375ba54 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 16 Sep 2009 08:09:31 +0000 Subject: [PATCH] git-svn-id: http://www.xerial.org/svn/project/XerialJ/trunk/sqlite-jdbc@3592 ae02f08e-27ec-0310-ae8c-8ba02fe2eafd --- src/test/java/org/sqlite/SQLitePureJavaTest.java | 26 +++++++++--------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/test/java/org/sqlite/SQLitePureJavaTest.java b/src/test/java/org/sqlite/SQLitePureJavaTest.java index 4284443..c3a1c3f 100644 --- a/src/test/java/org/sqlite/SQLitePureJavaTest.java +++ b/src/test/java/org/sqlite/SQLitePureJavaTest.java @@ -27,8 +27,7 @@ public class SQLitePureJavaTest private Connection connection = null; @Before - public void setUp() throws Exception - { + public void setUp() throws Exception { System.setProperty("sqlite.purejava", "true"); connection = null; Class.forName("org.sqlite.JDBC"); @@ -37,21 +36,20 @@ public class SQLitePureJavaTest } @After - public void tearDown() throws Exception - { + public void tearDown() throws Exception { if (connection != null) connection.close(); + + System.setProperty("sqlite.purejava", "false"); } @Test - public void query() throws ClassNotFoundException - { + public void query() throws ClassNotFoundException { //_logger.debug(String.format("running in %s mode", SQLiteJDBCLoader.isNativeMode() ? "native" : "nested")); assertTrue(SQLiteJDBCLoader.isNativeMode() == false); - try - { + try { Statement statement = connection.createStatement(); statement.setQueryTimeout(30); // set timeout to 30 sec. @@ -60,15 +58,13 @@ public class SQLitePureJavaTest statement.executeUpdate("insert into person values(2, 'yui')"); ResultSet rs = statement.executeQuery("select * from person order by id"); - while (rs.next()) - { + while (rs.next()) { // read the result set int id = rs.getInt(1); String name = rs.getString(2); } } - catch (SQLException e) - { + catch (SQLException e) { // if e.getMessage() is "out of memory", it probably means no // database file is found fail(e.getMessage()); @@ -76,14 +72,12 @@ public class SQLitePureJavaTest } @Test - public void function() throws SQLException - { + public void function() throws SQLException { assertTrue(SQLiteJDBCLoader.isNativeMode() == false); Function.create(connection, "total", new Function() { @Override - protected void xFunc() throws SQLException - { + protected void xFunc() throws SQLException { int sum = 0; for (int i = 0; i < args(); i++) sum += value_int(i); -- 2.11.0