public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* kawa 1.14: java.io.PrintWriter prints everything as "true"
@ 2013-10-08  4:19 Ito Kazumitsu
  2013-10-08  7:05 ` Per Bothner
  0 siblings, 1 reply; 5+ messages in thread
From: Ito Kazumitsu @ 2013-10-08  4:19 UTC (permalink / raw)
  To: kawa

I have found another case where kawa 1.14 behaves differently from kawa 1.13.
The script used for this test is attached below.

=================================================================
$ java -cp /mnt/ph/javalib/kawa-1.13.jar:/mnt/ph/javalib/sqlite-jdbc.jar kawa.repl --no-warn-unknown-member test.scm
1
End of List
$ java -cp /mnt/ph/javalib/kawa-1.13.jar:/mnt/ph/javalib/sqlite-jdbc.jar kawa.repl --no-warn-unknown-member --script test.scm
1
End of List
$ java -cp /mnt/ph/javalib/kawa-1.14.jar:/mnt/ph/javalib/sqlite-jdbc.jar kawa.repl --no-warn-unknown-member test.scm
1
End of List
$ java -cp /mnt/ph/javalib/kawa-1.14.jar:/mnt/ph/javalib/sqlite-jdbc.jar kawa.repl --no-warn-unknown-member --script test.scm
truetrue
true
=================================================================

As seen from the last case, using kawa 1.14 with the command line option
"--script", java.io.PrintWriter prints everything as "true".

The test script depends on SQLite JDBC Driver:
     https://bitbucket.org/xerial/sqlite-jdbc

I could not make a simpler test script without using SQLite JDBC Driver.
But since it works fine with kawa 1.13, I am afraid there is something
wrong whith kawa 1.14.

Here is the test script:

(define driverName "org.sqlite.JDBC")
(define connectionURL "jdbc:sqlite:test.db")
(define userID "sa")
(define passwd "")
(define outenc "UTF-8")
(define wtr
   (java.io.PrintWriter
       (java.io.OutputStreamWriter (java.lang.System:.out) outenc)))

(java.lang.Class:forName driverName)
(define c ::java.sql.Connection
   (java.sql.DriverManager:getConnection connectionURL userID passwd))

(define (show-rs rs colmax)
    (let loop ((i 1))
       (cond
          ((> i colmax)
             (wtr:println))
          (#t
             (let ((o (java.sql.ResultSet:getObject rs i)))
                (cond
                   ((equal? o #!null)
                       (wtr:print "NULL"))
                   (#t
                       (wtr:print (o:toString))))
                (wtr:print "\t")
                (loop (+ i 1)))))))

(define (exec-sql s)
    (let ((st ::java.sql.Statement (c:createStatement)))
      (try-catch
        (begin
         (cond
             ((st:execute s)
                (let* ((rs ::java.sql.ResultSet (st:getResultSet))
                       (meta ::java.sql.ResultSetMetaData (rs:getMetaData))
                       (colmax (meta:getColumnCount)))
                  (let rsloop ()
                    (cond
                      ((rs:next)
                         (show-rs rs colmax)
                         (rsloop))))
                  (wtr:println "End of List")))
             (#t
                (let ((uc (st:getUpdateCount)))
                   (wtr:print "Update Count =")
                   (wtr:println uc))))
         (st:close))
      (e <java.lang.Exception>
             (begin
                (wtr:println e)))))
    (wtr:flush))

(exec-sql "SELECT 1")

(c:close)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-13  7:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-08  4:19 kawa 1.14: java.io.PrintWriter prints everything as "true" Ito Kazumitsu
2013-10-08  7:05 ` Per Bothner
2013-10-09  1:51   ` Ito Kazumitsu
2013-10-09  5:56     ` Per Bothner
2013-10-13  7:03       ` Per Bothner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).