Greg Slepak  committed a4deacf

temporary fix for float issue in Sqlite3

  • Participants
  • Parent commits 31011d1

Comments (0)

Files changed (5)

-Version 0.7
+Version 0.61
   * all code uses new ++,--,extend,write,read functions (still compatible with older newlisps)
   * now $BINARY can handle large data (compensated for a newLISP bug in 'read-buffer').
   * fix to Jeff's JSON.lsp plugin (switched to " instead of ' for strings)
   * DF:activate-plugin can now be used to load all lisp files in a directory
   * added a dragonfly_utils.lsp file to the DF.DB folder, includes handy fn-query-with-db function.
+  * fixed handling of floats in Sqlite3 on some architectures (more improvements needed though, see TODO)
 Version 0.6

File example-site/dragonfly-framework/dragonfly.lsp

 ;; @module dragonfly.lsp
 ;; @description The heart of Dragonfly - A newLISP web framework for rapid web development.
-;; @version 0.70
+;; @version 0.61
 ;; @author Team Dragonfly 2009
 ;; @location
 ;; <br>This file is the main entry-point of the Dragonfly framework and
 ; DF is a convenient shorthand to the Dragonfly context
 (constant (global 'DF) Dragonfly)
 (constant (global 'DRAGONFLY_MAJOR) 0)
-(constant (global 'DRAGONFLY_MINOR) 60)
+(constant (global 'DRAGONFLY_MINOR) 61)
 (constant (global 'DRAGONFLY_VERSION) (format "Version %d.%d" DRAGONFLY_MAJOR DRAGONFLY_MINOR))
 ; make sure these two are defined

File example-site/dragonfly-framework/plugins-inactive/db/database_sqlite3.lsp

 ;; @module Sqlite3
 ;; @description SQLite3 subclass of DF.DB. Only lists Sqlite3 specific functions.
-;; @version 1.1.2
+;; @version 1.1.3
 ;; @author Greg Slepak 
 ;; @location
 ;; <h3>Features not found in newLISP's sqlite3.lsp:</h3>
 ;; <h3>Requirements</h3>
 ;; See module @link DF.DB for requirements.
 ;; <h3>Version history</h3>
+;; <b>1.1.3</b> &bull; fixed handling of floats, more improvements needed though
 ;; <b>1.1.2</b> &bull; fixed a bug in 'get-string-cast' and implemented 'DF.SQL:col-name'
 ;; <b>1.1.1</b> &bull; improved readability in error logging, fixed binding of integers on 32-bit newlisp builds<br/>
 ;; <b>1.1.0</b> &bull; support for 'DF.BLOB'<br/>
 (define (bind-int64)
 	(failable (sqlite3_bind_int64 stmt idx value))
 (define (bind-int32)
 	(failable (sqlite3_bind_int stmt idx value))
-(setf bind-int (if NEWLISP64 bind-int64 bind-int32))
+(define (bind-float32)
+	(failable (sqlite3_bind_double stmt idx value))
+(define (bind-float64)
+	(bind-param-at-index stmt (string value) idx)
+;; TODO: figure out how to do this properly, test on a bunch of different architectures
+;;       for bind-float it may actually be the opposite (string for 32, double for 64)
+(if NEWLISP64
+	(set 'bind-int bind-int64 'bind-float bind-float64)
+	(set 'bind-int bind-int32 'bind-float bind-float32)
 (define (bind-param-at-index stmt value idx)
 		((integer? value) (bind-int))
 		((string? value) (failable (sqlite3_bind_text stmt idx value (length value) -1)))
-		((float? value) (failable (sqlite3_bind_double stmt idx value)))
+		; ((float? value) (bind-float))
+		((float? value) (bind-param-at-index stmt (string value) idx))
 		((nil? value) (failable (sqlite3_bind_null stmt idx)))
 		; DF.BLOB is the vehicle for using 'sqlite3_bind_blob' instead of 'sqlite3_bind_text'
 		((context? value) (failable (sqlite3_bind_blob stmt idx value:blob (length value:blob) -1)))

File example-site/dragonfly-framework/plugins-inactive/dragonfly_api.lsp

 ;; @module Dragonfly
 ;; @author Marc Hildmann <marc.hildmann at>, Greg Slepak <greg at>
-;; @version 0.70
+;; @version 0.61
 ;; @location
 ;; @description A newLISP web framework for rapid web development

File example-site/dragonfly-framework/plugins-inactive/dragonfly_twitter.lsp

 ;; @module Dragonfly Twitter search plugin
 ;; @author Marc Hildmann <marc.hildmann at>
-;; @version 0.70
+;; @version 0.61
 ;; @location
 ;; @description A newLISP web framework for rapid web development