Set default encoding for sqlite3 databases to utf-8 if unspecified
[clsql.git] / db-sqlite3 / sqlite3-sql.lisp
index d4b41e4d8d6ea7344eb74be43c150c470ffc2d93..4f953d013212fc5d63d9dd02026745c7bc8ecb8d 100644 (file)
                                              (sqlite3:sqlite3-column-blob stmt i)
                                              (car types)
                                              :length (sqlite3:sqlite3-column-bytes stmt i)
-                                             :encoding (encoding database))
+                                             :encoding (or (encoding database)
+                                                           :utf-8))
                                             (clsql-uffi:convert-raw-field
                                              (sqlite3:sqlite3-column-text stmt i)
                                              (car types)
-                                             :encoding (encoding database))))))
+                                             :encoding (or (encoding database)
+                                                           :utf-8))))))
                    (when field-names
                      (setf col-names (loop for n from 0 below n-col
                                            collect (sqlite3:sqlite3-column-name stmt n))))
                                     (database sqlite3-database)
                                     &key (owner nil))
   (declare (ignore owner))
-
+  
   (loop for field-info in (sqlite3-table-info table database)
-      when (string= attribute (second field-info))
+      when (string= (clsql-sys::unescaped-database-identifier attribute)
+                    (second field-info))
       return
         (let* ((raw-type (third field-info))
                (start-length (position #\( raw-type))