From f048e36838162e52d26aec26b0cf6900862bfa2f Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Mon, 22 Dec 2014 19:25:24 +0100 Subject: [PATCH] Attempt to set a proper FreeTDS buffer size. Let's see what happens in the tests with that before cleaning up the API a little here, and maybe getting rid of the hardcoded "25000" rows. --- src/monkey/mssql.lisp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/monkey/mssql.lisp b/src/monkey/mssql.lisp index 638b2d4..6f1d22f 100644 --- a/src/monkey/mssql.lisp +++ b/src/monkey/mssql.lisp @@ -99,11 +99,20 @@ (otherwise (error "not supported type ~A" (foreign-enum-keyword '%syb-value-type type)))))) +(defconstant +dbbuffer+ 14) + +(define-sybdb-function ("dbsetopt" %dbsetopt) %RETCODE + (dbproc %DBPROCESS) + (option :int) + (char-param :pointer) + (int-param :int)) (defun map-query-results (query &key row-fn (connection *database*)) "Map the query results through the map-fn function." (let ((%dbproc (slot-value connection 'dbproc)) (cffi:*default-foreign-encoding* (slot-value connection 'external-format))) + (with-foreign-string (%nrows "25000") + (%dbsetopt %dbproc +dbbuffer+ %nrows 0)) (with-foreign-string (%query query) (%dbcmd %dbproc %query)) (%dbsqlexec %dbproc)