5

On Windows10/64, I installed CCL Lisp 1.11, downloaded the sqlite3.dll, then installed quicklisp and cl-sql. I get an error in the context of (german) special characters. This is what I tried in the Emacs Slime Repl:

(clsql:connect '("C:/users/user/test.sqlite")
               :database-type :sqlite3
               :encoding 'utf-8)
(clsql:execute-command "create table name (name)")
(clsql:execute-command "insert into name values ('Übermaß')")
(format t "~A" (clsql:query "select * from name") )

Executing the last line invokes the debugger:

Cannot allocate a STRING with NIL elements.
Objects of type STRING can can have at most 
16777215 elements in this implementation.
   [Condition of type CCL::VECTOR-SIZE-LIMITATION] ...
Backtrace
  0: (%STR-FROM-PTR #<A Foreign Pointer #x2D0F8C8> NIL NIL)
  1: ((:INTERNAL CLSQL-SQLITE3::EXTRACT-ROW-DATA (CLSQL-SYS:DATABASE-QUERY (T CLSQL-SQLITE3:SQLITE3-DATABASE T T))))
  2: (#<STANDARD-METHOD CLSQL-SYS:DATABASE-QUERY (T CLSQL-SQLITE3:SQLITE3-DATABASE T T)> "select * from name" #<SQLITE3-DATABASE C:/users/user/test.sqlite OPEN #xCDC1B7E> :AUTO T)
  3: (CCL::%%STANDARD-COMBINED-METHOD-DCODE ((#<STANDARD-METHOD CLSQL-SYS:DATABASE-QUERY :BEFORE (T CLSQL-SYS:DATABASE T T)>) NIL ..) 16705134)
  ... 

My Emacs .init.el is configured to use UTF-8:

(set-language-environment "utf-8")
(setq inferior-lisp-program "C:/users/user/bin/ccl-1.11/wx86cl.exe -K utf-8")
(setq slime-net-coding-system 'utf-8-unix)
(prefer-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)

If I try to create the .sqlite DB File without the UTF-8 Encoding, inserting and selecting data works, but the special characters are not displayed correctly.

Rainer Joswig
  • 136,269
  • 10
  • 221
  • 346
skglas
  • 51
  • 1
  • [CLSQL](http://www.cliki.net/CLSQL) doesn't list CCL as a supported implementation. Have you tried using other libraries for the task? – jkiiski Feb 22 '16 at 05:54
  • Thanks for your reply. I wasn´t aware of that. I have trouble compiling clsql-sqlite3 with SBCL 1.3.2 as it does not seem to find the sqlite3.dll despite the correct path: `CL-USER> clsql:*foreign-library-search-paths* (#P"C:/Windows" #P"C:/Windows/") CL-USER> (probe-file "c:/windows/sqlite3.dll") #P"c:/Windows/sqlite3.dll" CL-USER> (asdf:oos 'asdf:load-op :clsql-sqlite3 :force :all) --> Couldn't load foreign libraries "libsqlite3", "sqlite3". (searched CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS*: (#P"C:/Windows/" "C:/Windows/ "C:/Windows")) [Condition of type SIMPLE-ERROR] – skglas Feb 22 '16 at 09:18
  • Maybe a case problem? – Svante Feb 22 '16 at 10:28
  • Thanks for your hint. Unfortunately, changing the case in the path name does not make a difference; the file name 'sqlite3.dll' itself is in lowercase, which seems to match the file name in the error message (without extension). Even removing the .dll extension from the file name does not help. – skglas Feb 22 '16 at 11:33
  • 1
    @skglas It may be an issue with the external format, ccl requires a keyword `:utf8` to designate the external format, not a symbol. – PuercoPop Feb 22 '16 at 15:54
  • Thanks! I changed the connection spec to :encoding :utf-8, now I get: `Array index 5 out of bounds for "�erma" . [Condition of type SIMPLE-ERROR] Backtrace: 0: (CCL::UTF-8-MEMORY-DECODE # 7 0 "�erma") 1: (CCL::%GET-UTF-8-CSTRING #) 2: ((:INTERNAL CLSQL-SQLITE3::EXTRACT-ROW-DATA (CLSQL-SYS:DATABASE-QUERY (T CLSQL-SQLITE3:SQLITE3-DATABASE T T)))) ...` – skglas Feb 22 '16 at 16:13
  • have you tried if the same exception occurs if you exchange the umlaute? Not really an answer but it might very well be that the issue is not the characters. Additionally I would try changing the encoding used by the database: `PRAGMA encoding="UTF-8";` – Sim Mar 29 '18 at 14:59

0 Answers0