This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

kawa 1.14: java.io.PrintWriter prints everything as "true"


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]