Permalink
Browse files

Fix for '>10 fields error'

  • Loading branch information...
1 parent 6de63e0 commit e0673a9e5d239c6fb117c4cdb1255bfee47bb792 @klimenko-serj committed Sep 13, 2012
Showing with 20 additions and 8 deletions.
  1. +7 −7 cl-fbclient-functions.lisp
  2. +13 −1 cl-fbclient.lisp
@@ -63,14 +63,14 @@
(setf (cffi:foreign-slot-value new-xsqlda 'xsqlda 'sqln) n)
new-xsqlda))
;-----------------------------------------------------------------------------------
+(defun need-remake-xsqlda (tmp-xsqlda)
+ (> (cffi:foreign-slot-value tmp-xsqlda 'xsqlda 'sqld)
+ (cffi:foreign-slot-value tmp-xsqlda 'xsqlda 'sqln)))
+;-----------------------------------------------------------------------------------
(defun remake-xsqlda (tmp-xsqlda)
- (cond ((> (cffi:foreign-slot-value tmp-xsqlda 'xsqlda 'sqld)
- (cffi:foreign-slot-value tmp-xsqlda 'xsqlda 'sqln))
- (let ((new-xsqlda (make-xsqlda
- (cffi:foreign-slot-value tmp-xsqlda 'xsqlda 'sqld))))
- (cffi-sys:foreign-free tmp-xsqlda)
- new-xsqlda))
- (T tmp-xsqlda)))
+ (unwind-protect
+ (make-xsqlda (cffi:foreign-slot-value tmp-xsqlda 'xsqlda 'sqld))
+ (cffi-sys:foreign-free tmp-xsqlda)))
;-----------------------------------------------------------------------------------
(defun get-var-type-by-fbtype-num (type-num)
(cond
View
@@ -187,7 +187,19 @@
:fb-error-text "Error in isc-dsql-describe"
:fbclient-msg (get-status-vector-msg status-vector*))
(cffi-sys:foreign-free status-vector*)))
- (setf (xsqlda-output* fb-stmt) (remake-xsqlda (xsqlda-output* fb-stmt)))
+ (when (need-remake-xsqlda (xsqlda-output* fb-stmt))
+ (setf (xsqlda-output* fb-stmt) (remake-xsqlda (xsqlda-output* fb-stmt)))
+ (isc-dsql-describe status-vector*
+ (statement-handle* fb-stmt)
+ 1
+ (xsqlda-output* fb-stmt))
+ (when (status-vector-error-p status-vector*)
+ (unwind-protect
+ (error 'fb-error
+ :fb-error-code 32
+ :fb-error-text "Error in isc-dsql-describe"
+ :fbclient-msg (get-status-vector-msg status-vector*))
+ (cffi-sys:foreign-free status-vector*))))
(alloc-vars-data (xsqlda-output* fb-stmt))
(cffi-sys:foreign-free status-vector*)))
;-----------------------------------------------------------------------------------

0 comments on commit e0673a9

Please sign in to comment.