OSDN Git Service

changed to sqlite-3.6.14.1
authorleo <leo@ae02f08e-27ec-0310-ae8c-8ba02fe2eafd>
Tue, 19 May 2009 01:42:08 +0000 (01:42 +0000)
committerleo <leo@ae02f08e-27ec-0310-ae8c-8ba02fe2eafd>
Tue, 19 May 2009 01:42:08 +0000 (01:42 +0000)
 * sqlite-3.6.14 contains a bug in group_cancat

git-svn-id: http://www.xerial.org/svn/project/XerialJ/trunk/sqlite-jdbc@3298 ae02f08e-27ec-0310-ae8c-8ba02fe2eafd

VERSION
pom.xml
src/main/resources/native/Windows/x86/sqlitejdbc.dll
src/test/java/org/sqlite/QueryTest.java

diff --git a/VERSION b/VERSION
index 6640cc3..eeb2498 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-sqlite_version = 3.6.14
+sqlite_version = 3.6.14.1
diff --git a/pom.xml b/pom.xml
index 9ee38e2..748a4b8 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
   <modelVersion>4.0.0</modelVersion>\r
   <groupId>org.xerial</groupId>\r
   <artifactId>sqlite-jdbc</artifactId>\r
-  <version>3.6.14</version>\r
+  <version>3.6.14.1</version>\r
   <name>SQLite JDBC</name>\r
   <description>SQLite JDBC library</description>\r
 \r
index b719fb1..be5c521 100644 (file)
Binary files a/src/main/resources/native/Windows/x86/sqlitejdbc.dll and b/src/main/resources/native/Windows/x86/sqlitejdbc.dll differ
index d0c5dbe..087df3c 100644 (file)
@@ -112,4 +112,92 @@ public class QueryTest
 
     }
 
+    @Test
+    public void concatTest()
+    {
+
+        Connection connection = null;
+        try
+        {
+            // create a database connection
+            connection = DriverManager.getConnection("jdbc:sqlite::memory:");
+            Statement statement = connection.createStatement();
+            statement.setQueryTimeout(30); // set timeout to 30 sec.
+
+            statement.executeUpdate("drop table if exists person");
+            statement.executeUpdate("create table person (id integer, name string, shortname string)");
+            statement.executeUpdate("insert into person values(1, 'leo','L')");
+            statement.executeUpdate("insert into person values(2, 'yui','Y')");
+            statement.executeUpdate("insert into person values(3, 'abc', null)");
+
+            statement.executeUpdate("drop table if exists message");
+            statement.executeUpdate("create table message (id integer, subject string)");
+            statement.executeUpdate("insert into message values(1, 'Hello')");
+            statement.executeUpdate("insert into message values(2, 'World')");
+
+            statement.executeUpdate("drop table if exists mxp");
+            statement.executeUpdate("create table mxp (pid integer, mid integer, type string)");
+            statement.executeUpdate("insert into mxp values(1,1, 'F')");
+            statement.executeUpdate("insert into mxp values(2,1,'T')");
+            statement.executeUpdate("insert into mxp values(1,2, 'F')");
+            statement.executeUpdate("insert into mxp values(2,2,'T')");
+            statement.executeUpdate("insert into mxp values(3,2,'T')");
+
+            ResultSet rs = statement
+                    .executeQuery("select group_concat(ifnull(shortname, name)) from mxp, person where mxp.mid=2 and mxp.pid=person.id and mxp.type='T'");
+            while (rs.next())
+            {
+                // read the result set
+                assertEquals("Y,abc", rs.getString(1));
+            }
+            rs = statement
+                    .executeQuery("select group_concat(ifnull(shortname, name)) from mxp, person where mxp.mid=1 and mxp.pid=person.id and mxp.type='T'");
+            while (rs.next())
+            {
+                // read the result set
+                assertEquals("Y", rs.getString(1));
+            }
+
+            PreparedStatement ps = connection
+                    .prepareStatement("select group_concat(ifnull(shortname, name)) from mxp, person where mxp.mid=? and mxp.pid=person.id and mxp.type='T'");
+            ps.clearParameters();
+            ps.setInt(1, new Integer(2));
+            rs = ps.executeQuery();
+            while (rs.next())
+            {
+                // read the result set
+                assertEquals("Y,abc", rs.getString(1));
+            }
+            ps.clearParameters();
+            ps.setInt(1, new Integer(2));
+            rs = ps.executeQuery();
+            while (rs.next())
+            {
+                // read the result set
+                assertEquals("Y,abc", rs.getString(1));
+            }
+
+        }
+        catch (SQLException e)
+        {
+            // if the error message is "out of memory",
+            // it probably means no database file is found
+            System.err.println(e.getMessage());
+        }
+        finally
+        {
+            try
+            {
+                if (connection != null)
+                    connection.close();
+            }
+            catch (SQLException e)
+            {
+                // connection close failed.
+                System.err.println(e);
+            }
+        }
+
+    }
+
 }