From a9f57540c378329f627b5b3bd2a2991689638331 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Mon, 19 Apr 2004 09:08:19 +0000 Subject: [PATCH] r9090: properly check for errors --- db-odbc/odbc-api.lisp | 33 +++++++++++++++++---------------- db-odbc/odbc-dbi.lisp | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/db-odbc/odbc-api.lisp b/db-odbc/odbc-api.lisp index c032fd3..0f27b57 100644 --- a/db-odbc/odbc-api.lisp +++ b/db-odbc/odbc-api.lisp @@ -947,26 +947,27 @@ as possible second argument) to the desired representation of date/time/timestam (unwind-protect (with-foreign-objects ((dsn-len :short) (desc-len :short)) - (with-error-handling (:henv henv) - (let ((res - (SQLDataSources henv $SQL_FETCH_FIRST dsn - (1+ $SQL_MAX_DSN_LENGTH) - dsn-len desc 256 desc-len))) - (when (or (eql res $SQL_SUCCESS) - (eql res $SQL_SUCCESS_WITH_INFO)) - (push (convert-from-foreign-string dsn) results)) - - (do ((res (SQLDataSources henv $SQL_FETCH_NEXT dsn + (let ((res (with-error-handling (:henv henv) + (SQLDataSources henv $SQL_FETCH_FIRST dsn + (1+ $SQL_MAX_DSN_LENGTH) + dsn-len desc 256 desc-len)))) + (when (or (eql res $SQL_SUCCESS) + (eql res $SQL_SUCCESS_WITH_INFO)) + (push (convert-from-foreign-string dsn) results)) + + (do ((res (with-error-handling (:henv henv) + (SQLDataSources henv $SQL_FETCH_NEXT dsn (1+ $SQL_MAX_DSN_LENGTH) - dsn-len desc 256 desc-len) + dsn-len desc 256 desc-len)) + (with-error-handling (:henv henv) (SQLDataSources henv $SQL_FETCH_NEXT dsn (1+ $SQL_MAX_DSN_LENGTH) - dsn-len desc 256 desc-len))) - ((not (or (eql res $SQL_SUCCESS) - (eql res $SQL_SUCCESS_WITH_INFO)))) - (push (convert-from-foreign-string dsn) results))))) + dsn-len desc 256 desc-len)))) + ((not (or (eql res $SQL_SUCCESS) + (eql res $SQL_SUCCESS_WITH_INFO)))) + (push (convert-from-foreign-string dsn) results)))) (progn (free-foreign-object dsn) (free-foreign-object desc))) (nreverse results))) - + diff --git a/db-odbc/odbc-dbi.lisp b/db-odbc/odbc-dbi.lisp index 8aa0b07..ff96c21 100644 --- a/db-odbc/odbc-dbi.lisp +++ b/db-odbc/odbc-dbi.lisp @@ -435,7 +435,7 @@ This makes the functions db-execute-command and db-query thread safe." (dotimes (col-nr count) (let ((data-ptr (aref column-data-ptrs col-nr)) (out-len-ptr (aref column-out-len-ptrs col-nr))) - ;; free-statment unbind frees theses + ;; free-statment :unbind frees these #+ignore (when data-ptr (uffi:free-foreign-object data-ptr)) #+ignore (when out-len-ptr (uffi:free-foreign-object out-len-ptr))))) (cond ((null hstmt) -- 2.34.1