From freddy77 at gmail.com Fri Jul 3 13:09:58 2020 From: freddy77 at gmail.com (Frediano Ziglio) Date: Fri, 3 Jul 2020 18:09:58 +0100 Subject: [freetds] FreeTDS 1.2 released! Message-ID: Hi, a new version has been released. Just a minor change since release candidate 3. Summary of Changes in release 1.2 --------------------------------- User visible (not in a particular order): - Sybase server: - All strings are now converted as MSSQL; - Support kerberos login; - DB-Library: add DBSETNETWORKAUTH, DBSETMUTUALAUTH, DBSETDELEGATION and DBSETSERVERPRINCIPAL; - CT-Library: add CS_SEC_NETWORKAUTH, CS_SEC_NETWORKAUTH, CS_SEC_NETWORKAUTH and CS_SEC_NETWORKAUTH; - Bulk copies: - DB-Library: fix trim of unicode fields; - (*) Apply character conversion for Sybase, like MSSQL; - (*) Ignore computed columns; - (*) Properly support multibyte strings in column names; - (*) DB-Library: stop correctly on BCPMAXERRS setting; - (*) DB-Library: do not try to convert skipped rows reading file allowing for instance to load CVS files; - (*) CT-Library: added CS_DATABASE property to allows to connect correctly to Azure servers; - (*) Improve support for MS XML columns for both DB-Library and CT-Library; - (*) Fix some issues with MSSQL server redirection (used for instance in Azure); - (*) Change SQL_DESC_OCTET_LENGTH value for wise character columns; - Better support for SQL_VARIANT: - Better column checks; - (*) CT-Library: now supported, columns are returned as CS_CHAR_TYPE; - Some updates to server part: - Set correctly initial state; - IPv6 support; - Fix TDS 7.2 logins; - Support extended character using domain logins under Unix; - Improve MARS: - Less memory copies; - (*) Remove possible deadlock; - Handle wrapping sequence/window numbers; - Make sure we sent the wanted packet; - (*) Support UTF-16 surrogate pairs in odbc_wide2utf and odbc_set_string_flag fixing some character encoding support; - (*) Fix multiple queries, used by ODBC to optimize data load; - (*) Improve emulated parameter queries, fixing minor issues and reducing memory usage; - Support DBVERSION_UNKNOWN in dbsetlversion (will use automatic detection); - CT-Library: define CS_MIN_SYBTYPE and CS_MAX_SYBTYPE; - (*) CT-Library: fix cs_will_convert accepting library constants, not libTDS. (*) Feature backported in stable 1.1 branch. Implementation: - User guide converted to XML; - Always use little endian on network level, simpler and faster; - Converted some files to markdown; - Optimize bytes endianess conversion; - Made character lookup faster making character conversion quicker; - Optimize data padding in CT-Library; - Fix some build dependencies causing some files to not be properly recompiled during development; - Add "freeze" support allowing to pause sending in order to simplify lengths computations sending data. Kind Regards, Frediano From bseely at stsci.edu Mon Jul 6 09:43:50 2020 From: bseely at stsci.edu (Bruce Seely) Date: Mon, 6 Jul 2020 13:43:50 +0000 Subject: [freetds] Unexplained error returned Message-ID: <3A60656F-774A-44AA-908D-C990EDD95A0E@stsci.edu> [ I apologize if you have seen this already. I sent it last week, but I haven?t seen it on the list] We are using freeTDS with the ODBC package that is provided by our Lisp vendor. Beginning with freeTDS version 1.1.1, we started seeing an error for queries that worked in earlier releases: Error: While getting numeric column info, Allegro ODBC detected an error: error code returned The ODBC code has a function SQLCOLATTRIBUTES that calls freeTDS code. The same call that worked in pre 1.1.1 releases, fails now. Also, when the freeTDS call fails, no reason is provided. Below are traces of the test run in versions 1.00.99 and 1.1.1. We are complaining to the Lisp folks, and they don?t know what to do, since there is no explanation for the error. What changed in version 1.1 that would cause this? Thank you very much for your help. Bruce Seely Space Telescope Science Institute ;;;;;;; This is what is being done by the test function ;;;;;;;;;;;;;;;; (setq db (connect :data-source-name "R2D2" :user "bseely" :password ?..." )) (sql "use pps_lrp_alpha" :db db) (sql "select * from ppsdb_version" :db db)) ;;;;;;; run in version 1.00.99 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CL-USER(2): (test "ppsdb_version") >>doing (DBI::WITH-NATIVE-STRING-ODBC (DBI::SQL-STATEMENT DBI::SQL-STATEMENT DBI::DB) (DBI::SQLEXECDIRECT DBI::HSTMT DBI::SQL-STATEMENT DBI::SQL_NTS))%<< and it returns 1 ; Autoloading for FOREIGN-FUNCTIONS:CHAR*-TO-STRING: ; Fast loading from bundle code/ffcompat.fasl. >>doing (DBI::SQLNUMRESULTCOLS DBI::HSTMT DBI::COUNT-VAR)%<< and it returns 0 >>doing (DBI::SQLMORERESULTS DBI::HSTMT)%<< and it returns 100 >>doing (DBI::WITH-NATIVE-STRING-ODBC (DBI::SQL-STATEMENT DBI::SQL-STATEMENT DBI::DB) (DBI::SQLEXECDIRECT DBI::HSTMT DBI::SQL-STATEMENT DBI::SQL_NTS))%<< and it returns 0 >>doing (DBI::SQLNUMRESULTCOLS DBI::HSTMT DBI::COUNT-VAR)%<< and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 1 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 2 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 3 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 4 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (DBI::BLOCK-CHECK #:G1415 (DBI::SQLFETCH #:G1412))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK #:G1415 (DBI::SQLFETCH #:G1412))%<< and it returns 100 >>doing (DBI::WITH-NATIVE-STRING-ODBC (DBI::SQL-STATEMENT DBI::SQL-STATEMENT DBI::DB) (DBI::SQLEXECDIRECT DBI::HSTMT DBI::SQL-STATEMENT DBI::SQL_NTS))%<< and it returns 0 >>doing (DBI::SQLNUMRESULTCOLS DBI::HSTMT DBI::COUNT-VAR)%<< and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 1 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 2 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 3 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 4 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (DBI::BLOCK-CHECK #:G1415 (DBI::SQLFETCH #:G1412))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK #:G1415 (DBI::SQLFETCH #:G1412))%<< and it returns 100 (("1" "PPSDB86" "2020-02-11 18:26:38 -05:00" "")) ("id" "ppsdb_version" "build_time" "comment") CL-USER(3): ;;;;;;; run in version 1.1.1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CL-USER(2): (test "ppsdb_version") >>doing (DBI::WITH-NATIVE-STRING-ODBC (DBI::SQL-STATEMENT DBI::SQL-STATEMENT DBI::DB) (DBI::SQLEXECDIRECT DBI::HSTMT DBI::SQL-STATEMENT DBI::SQL_NTS))%<< and it returns 1 ; Autoloading for FOREIGN-FUNCTIONS:CHAR*-TO-STRING: ; Fast loading from bundle code/ffcompat.fasl. >>doing (DBI::SQLNUMRESULTCOLS DBI::HSTMT DBI::COUNT-VAR)%<< and it returns 0 >>doing (DBI::SQLMORERESULTS DBI::HSTMT)%<< and it returns 100 >>doing (DBI::WITH-NATIVE-STRING-ODBC (DBI::SQL-STATEMENT DBI::SQL-STATEMENT DBI::DB) (DBI::SQLEXECDIRECT DBI::HSTMT DBI::SQL-STATEMENT DBI::SQL_NTS))%<< and it returns 0 >>doing (DBI::SQLNUMRESULTCOLS DBI::HSTMT DBI::COUNT-VAR)%<< and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 1 1011 # 256 # 0) 0[2]: returned -1 << and it returns -1 Error: While getting numeric column info, Allegro ODBC detected an error: error code returned [condition type: ODBC-ERROR] Restart actions (select using :continue): 0: Return to Top Level (an "abort" restart). 1: Abort entirely from this (lisp) process. [1] CL-USER(3): From bseely at stsci.edu Thu Jul 2 08:51:46 2020 From: bseely at stsci.edu (Bruce Seely) Date: Thu, 2 Jul 2020 12:51:46 +0000 Subject: [freetds] Need help understanding an error Message-ID: We are using freeTDS with the ODBC package that is provided by our Lisp vendor. Beginning with freeTDS version 1.1.1, we started seeing an error for queries that worked in earlier releases: Error: While getting numeric column info, Allegro ODBC detected an error: error code returned The ODBC code has a function SQLCOLATTRIBUTES that calls freeTDS code. The same call that worked in pre 1.1.1 releases, fails now. Also, when the freeTDS call fails, no reason is provided. Below are traces of the test run in versions 1.00.99 and 1.1.1. We are complaining to the Lisp folks, and they don?t know what to do, since there is no explanation for the error. What changed in version 1.1 that would cause this? Thank you very much for your help. Bruce Seely Space Telescope Science Institute ;;;;;;; This is what is being done by the test function ;;;;;;;;;;;;;;;; (setq db (connect :data-source-name "R2D2" :user "bseely" :password ?..." )) (sql "use pps_lrp_alpha" :db db) (sql "select * from ppsdb_version" :db db)) ;;;;;;; run in version 1.00.99 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CL-USER(2): (test "ppsdb_version") >>doing (DBI::WITH-NATIVE-STRING-ODBC (DBI::SQL-STATEMENT DBI::SQL-STATEMENT DBI::DB) (DBI::SQLEXECDIRECT DBI::HSTMT DBI::SQL-STATEMENT DBI::SQL_NTS))%<< and it returns 1 ; Autoloading for FOREIGN-FUNCTIONS:CHAR*-TO-STRING: ; Fast loading from bundle code/ffcompat.fasl. >>doing (DBI::SQLNUMRESULTCOLS DBI::HSTMT DBI::COUNT-VAR)%<< and it returns 0 >>doing (DBI::SQLMORERESULTS DBI::HSTMT)%<< and it returns 100 >>doing (DBI::WITH-NATIVE-STRING-ODBC (DBI::SQL-STATEMENT DBI::SQL-STATEMENT DBI::DB) (DBI::SQLEXECDIRECT DBI::HSTMT DBI::SQL-STATEMENT DBI::SQL_NTS))%<< and it returns 0 >>doing (DBI::SQLNUMRESULTCOLS DBI::HSTMT DBI::COUNT-VAR)%<< and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 1 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 2 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 3 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 4 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (DBI::BLOCK-CHECK #:G1415 (DBI::SQLFETCH #:G1412))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK #:G1415 (DBI::SQLFETCH #:G1412))%<< and it returns 100 >>doing (DBI::WITH-NATIVE-STRING-ODBC (DBI::SQL-STATEMENT DBI::SQL-STATEMENT DBI::DB) (DBI::SQLEXECDIRECT DBI::HSTMT DBI::SQL-STATEMENT DBI::SQL_NTS))%<< and it returns 0 >>doing (DBI::SQLNUMRESULTCOLS DBI::HSTMT DBI::COUNT-VAR)%<< and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 1 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 2 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 3 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 4 1011 # 256 # 0) 0[2]: returned 0 << and it returns 0 >>doing (DBI::BLOCK-CHECK #:G1415 (DBI::SQLFETCH #:G1412))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK DBI::DB (DBI::SQLGETDATA DBI::HSTMT DBI::INDEX DBI::TYPECODE DBI::RES DBI::WIDTH DBI::LENRES))%<< and it returns 0 >>doing (DBI::BLOCK-CHECK #:G1415 (DBI::SQLFETCH #:G1412))%<< and it returns 100 (("1" "PPSDB86" "2020-02-11 18:26:38 -05:00" "")) ("id" "ppsdb_version" "build_time" "comment") CL-USER(3): ;;;;;;; run in version 1.1.1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CL-USER(2): (test "ppsdb_version") >>doing (DBI::WITH-NATIVE-STRING-ODBC (DBI::SQL-STATEMENT DBI::SQL-STATEMENT DBI::DB) (DBI::SQLEXECDIRECT DBI::HSTMT DBI::SQL-STATEMENT DBI::SQL_NTS))%<< and it returns 1 ; Autoloading for FOREIGN-FUNCTIONS:CHAR*-TO-STRING: ; Fast loading from bundle code/ffcompat.fasl. >>doing (DBI::SQLNUMRESULTCOLS DBI::HSTMT DBI::COUNT-VAR)%<< and it returns 0 >>doing (DBI::SQLMORERESULTS DBI::HSTMT)%<< and it returns 100 >>doing (DBI::WITH-NATIVE-STRING-ODBC (DBI::SQL-STATEMENT DBI::SQL-STATEMENT DBI::DB) (DBI::SQLEXECDIRECT DBI::HSTMT DBI::SQL-STATEMENT DBI::SQL_NTS))%<< and it returns 0 >>doing (DBI::SQLNUMRESULTCOLS DBI::HSTMT DBI::COUNT-VAR)%<< and it returns 0 >>doing (IF* (EQL DBI::*ODBC-VERSION* 2) THEN (DBI::SQLCOLATTRIBUTES DBI::HSTMT DBI::COLUMN (IF* (EQL DBI::ATTRIBUTE DBI::SQL_DESC_NAME) THEN DBI::SQL_COLUMN_NAME ELSE DBI::ATTRIBUTE) DBI::RETVAL 256 DBI::CHAR-CNT 0) ELSE (DBI::SQLCOLATTRIBUTE DBI::HSTMT DBI::COLUMN DBI::ATTRIBUTE DBI::RETVAL 256 DBI::CHAR-CNT 0))% 0[2]: (DBI::SQLCOLATTRIBUTE # 1 1011 # 256 # 0) 0[2]: returned -1 << and it returns -1 Error: While getting numeric column info, Allegro ODBC detected an error: error code returned [condition type: ODBC-ERROR] Restart actions (select using :continue): 0: Return to Top Level (an "abort" restart). 1: Abort entirely from this (lisp) process. [1] CL-USER(3): From bseely at stsci.edu Mon Jul 27 13:55:54 2020 From: bseely at stsci.edu (Bruce Seely) Date: Mon, 27 Jul 2020 17:55:54 +0000 Subject: [freetds] Obtaining diagnostic messages Message-ID: <90F83426-FE3E-4DEB-999B-204F5FC9A195@stsci.edu> How can I get the error reason when an error code is returned by a call to SQLColAttribute? SQLColAttribute is called with these arguments: SQLHSTMT StatementHandle, odbc_hstmt SQLUSMALLINT ColumnNumber, 1 SQLUSMALLINT FieldIdentifier, 1011 SQLPOINTER CharacterAttributePtr, STACK-ALLOCATED (SHORT-SIMPLE-ARRAY FOREIGN (65)) SQLSMALLINT BufferLength, 255 (also tried 65) SQLSMALLINT * StringLengthPtr, STACK-ALLOCATED (SHORT-SIMPLE-ARRAY FOREIGN (2)) SQLLEN * NumericAttributePtr); 0 The returned value is -1. When pending messages are retrieved using SQLGetDiagRec, no messages are found. What can I do to determine why the call is failing? Thank you, Bruce From ikorot01 at gmail.com Mon Jul 27 17:46:59 2020 From: ikorot01 at gmail.com (Igor Korot) Date: Mon, 27 Jul 2020 16:46:59 -0500 Subject: [freetds] Obtaining diagnostic messages In-Reply-To: <90F83426-FE3E-4DEB-999B-204F5FC9A195@stsci.edu> References: <90F83426-FE3E-4DEB-999B-204F5FC9A195@stsci.edu> Message-ID: Hi, On Mon, Jul 27, 2020 at 1:16 PM Bruce Seely wrote: > > How can I get the error reason when an error code is returned by a call to SQLColAttribute? > > SQLColAttribute is called with these arguments: > SQLHSTMT StatementHandle, odbc_hstmt > SQLUSMALLINT ColumnNumber, 1 > SQLUSMALLINT FieldIdentifier, 1011 > SQLPOINTER CharacterAttributePtr, STACK-ALLOCATED (SHORT-SIMPLE-ARRAY FOREIGN (65)) > SQLSMALLINT BufferLength, 255 (also tried 65) > SQLSMALLINT * StringLengthPtr, STACK-ALLOCATED (SHORT-SIMPLE-ARRAY FOREIGN (2)) > SQLLEN * NumericAttributePtr); 0 > > The returned value is -1. > > When pending messages are retrieved using SQLGetDiagRec, no messages are found. > What can I do to determine why the call is failing? Can you show the code of how do you call SQLGetDiagRec() and what is happening? Thank you. > > Thank you, > Bruce > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > https://lists.ibiblio.org/mailman/listinfo/freetds From bseely at stsci.edu Tue Jul 28 14:07:30 2020 From: bseely at stsci.edu (Bruce Seely) Date: Tue, 28 Jul 2020 18:07:30 +0000 Subject: [freetds] FreeTDS Digest, Vol 197, Issue 4 In-Reply-To: References: Message-ID: <9145C13C-2FA0-455E-99E3-96BD87D6D239@stsci.edu> The problem is that, from an sql call, we get the contents of the columns, but while SQLColAttribute is collecting the column names, it fails. When it fails, SQLGetDiagRec produces no reason for the failure, so we don?t know what is wrong with the SQLColAttribute invocation. Below is - the definition of SQLGetDiagRec - the code that calls SQLGetDiagRec to collect messages - an example of SQLGetDiagRec working correctly sql = "use pps_lrp_alpha? - an example where SQLColAttribute gets an error, and no reason is returned sql = "select * from ppsdb_version? Sorry to dump so much stuff, but I wanted to try to proactively answer an many questions as possible. The code is in Lisp (sorry), so SQLGetDiagRec is called through a foreign function interface. This is the declaration of SQLGetDiagRec as a foreign function: (def-foreign-call-sc (SQLGetDiagRec "SQLGetDiagRec") ((type :short) (handle odbc-handle) (recnum :short) (state (* :char)) (error-code (* odbc-int-box)) (error-message (* :char)) (size-error-message :int) (used-error-message (* odbc-int-box))) :arg-checking nil ; due to contraversial design in ff, must turn off arg ck :returning :short) odbc-int-box is defined as: (def-foreign-type (odbc-int-box (:accessor odbc-int-box)) (:struct (data :int))) The code calling SQLGetDiagRec: (defun get-pending-messages-v3 (henv hdbc hstmt) ;; return all pending diagnostic messages (with-stack-fobjects ((sqlstate '(:array :char 10)) (error-code 'odbc-int-box) (err-buffer '(:array :char #.SQL_MAX_MESSAGE_LENGTH)) (text-size 'odbc-int-box)) (let ((recnum 0) (res nil)) (loop (let ((retval (SQLGetDiagRec (if* hstmt then SQL_HANDLE_STMT elseif hdbc then SQL_HANDLE_DBC else SQL_HANDLE_ENV) (or hstmt hdbc henv) (incf recnum) sqlstate error-code err-buffer #.SQL_MAX_MESSAGE_LENGTH text-size))) (case retval (#.SQL_SUCCESS (push (list (native-to-string (fslot-address-typed 'foreign-string :foreign sqlstate 0)) (fslot-value-typed 'odbc-int-box :foreign error-code :data) (native-to-string (fslot-address-typed 'foreign-string :foreign err-buffer 0))) res)) (#.SQL_NO_DATA (return) ; no more data, leave loop ) (t (warn "Unexpected return code ~s from GetDiagRec" retval) (return))))) (nreverse res)))) retval is the value returned by the SQLGetDiagRec call retval is tested against #.SQL_SUCCESS (which is 0), #.SQL_NO_DATA (which is 100) and t which is the default. if retval is #.SQL_SUCCESS, the returned string is added to the res variable which is returned when there are no more messages _______________________________________________ Here?s an example of SQLGetDiagRec working correctly? I used a wrapper to print the types of the arguments used in the SQLGetDiagRec call sql is "use pps_lrp_alpha? ... 9[14]: (RR-SQL # "use pps_lrp_alpha" :DB #) >>doing (WITH-NATIVE-STRING-ODBC (SQL-STATEMENT SQL-STATEMENT DB) (SQLEXECDIRECT HSTMT SQL-STATEMENT SQL_NTS)) 10[14]: (GET-PENDING-MESSAGES-V3 NIL NIL #) type: FIXNUM handle: ODBC-HSTMT recnum: FIXNUM state: (SHORT-SIMPLE-ARRAY FOREIGN (4)) error-code: (SHORT-SIMPLE-ARRAY FOREIGN (2)) error-message: (SHORT-SIMPLE-ARRAY FOREIGN (129)) size-error-message: FIXNUM used-error-message: (SHORT-SIMPLE-ARRAY FOREIGN (2)) 11[14]: (SQLGETDIAGREC 3 # 1 # # # 512 #) 11[14]: returned 0 -> retval: 0 -> res: (("01000" 5701 "[FreeTDS][SQL Server]Changed database context to 'pps_lrp_alpha'.")) type: FIXNUM handle: ODBC-HSTMT recnum: FIXNUM state: (SHORT-SIMPLE-ARRAY FOREIGN (4)) error-code: (SHORT-SIMPLE-ARRAY FOREIGN (2)) error-message: (SHORT-SIMPLE-ARRAY FOREIGN (129)) size-error-message: FIXNUM used-error-message: (SHORT-SIMPLE-ARRAY FOREIGN (2)) 11[14]: (SQLGETDIAGREC 3 # 2 # # # 512 #) 11[14]: returned 100 -> retval: 100 10[14]: returned (("01000" 5701 "[FreeTDS][SQL Server]Changed database context to 'pps_lrp_alpha'.")) !!! sql-statement: "use pps_lrp_alpha" !!! hstmt: # !!! errmsg: (("01000" 5701 "[FreeTDS][SQL Server]Changed database context to 'pps_lrp_alpha'.")) !!! result: 1 9[14]: returned NIL You can see that retval is first 0 (success), and res is (("01000" 5701 "[FreeTDS][SQL Server]Changed database context to 'pps_lrp_alpha'.")) then retval is 100 (no data) and the message is returned _____________________________________________________________________________________ Here?s an example where SQLColAttribute gets an error, and no reason is returned? 9[14]: (RR-SQL # "select * from ppsdb_version" :DB #) >>doing (WITH-NATIVE-STRING-ODBC (SQL-STATEMENT SQL-STATEMENT DB) (SQLEXECDIRECT HSTMT SQL-STATEMENT SQL_NTS)) << and it returns 0 9[14]: returned NIL +++++ in loop-over-results macro, called by with-row-results macro+++++ >>doing (SQLNUMRESULTCOLS HSTMT COUNT-VAR) 9[14]: (SQLNUMRESULTCOLS # #) 9[14]: returned 0 << and it returns 0 9[14]: (GET-STRING-RESULT-COLUMN-ATTRIBUTE # 1 1011) !! (get-string-result-column-attribute hstmt column attribute) !! arguments of SQLCOLATTRIBUTE !! hstmt: #: ODBC-HSTMT !! column-number: 1: FIXNUM !! attribute-code: 1011: FIXNUM !! return-value: #: (SHORT-SIMPLE-ARRAY FOREIGN (65)) !! buffer-length: 64: FIXNUM !! string-length: #: (SHORT-SIMPLE-ARRAY FOREIGN (2)) !! num-value: 0: FIXNUM 10[14]: (SQLCOLATTRIBUTE # 1 1011 # 64 # 0) 10[14]: returned -1 10[14]: (GET-PENDING-MESSAGES-V3 NIL NIL #) type: FIXNUM handle: ODBC-HSTMT recnum: FIXNUM state: (SHORT-SIMPLE-ARRAY FOREIGN (4)) error-code: (SHORT-SIMPLE-ARRAY FOREIGN (2)) error-message: (SHORT-SIMPLE-ARRAY FOREIGN (129)) size-error-message: FIXNUM used-error-message: (SHORT-SIMPLE-ARRAY FOREIGN (2)) 11[14]: (SQLGETDIAGREC 3 # 1 # # # 512 #) 11[14]: returned 100 -> retval: 100 10[14]: returned NIL the SQLCOLATTRIBUTE call returned -1 then GET-PENDING-MESSAGES-V3 calls SQLGETDIAGREC to get any messages SQLGETDIAGREC returns 100, indicating that it has no data On Jul 28, 2020, at 12:00 PM, freetds-request at lists.ibiblio.org wrote: External Email - Use Caution Send FreeTDS mailing list submissions to freetds at lists.ibiblio.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.ibiblio.org/mailman/listinfo/freetds or, via email, send a message with subject or body 'help' to freetds-request at lists.ibiblio.org You can reach the person managing the list at freetds-owner at lists.ibiblio.org When replying, please edit your Subject line so it is more specific than "Re: Contents of FreeTDS digest..." Today's Topics: 1. Obtaining diagnostic messages (Bruce Seely) 2. Re: Obtaining diagnostic messages (Igor Korot) From: Bruce Seely > Subject: [freetds] Obtaining diagnostic messages Date: July 27, 2020 at 1:55:54 PM EDT To: "freetds at lists.ibiblio.org" > How can I get the error reason when an error code is returned by a call to SQLColAttribute? SQLColAttribute is called with these arguments: SQLHSTMT StatementHandle, odbc_hstmt SQLUSMALLINT ColumnNumber, 1 SQLUSMALLINT FieldIdentifier, 1011 SQLPOINTER CharacterAttributePtr, STACK-ALLOCATED (SHORT-SIMPLE-ARRAY FOREIGN (65)) SQLSMALLINT BufferLength, 255 (also tried 65) SQLSMALLINT * StringLengthPtr, STACK-ALLOCATED (SHORT-SIMPLE-ARRAY FOREIGN (2)) SQLLEN * NumericAttributePtr); 0 The returned value is -1. When pending messages are retrieved using SQLGetDiagRec, no messages are found. What can I do to determine why the call is failing? Thank you, Bruce From: Igor Korot > Subject: Re: [freetds] Obtaining diagnostic messages Date: July 27, 2020 at 5:46:59 PM EDT To: FreeTDS Development Group > Hi, On Mon, Jul 27, 2020 at 1:16 PM Bruce Seely > wrote: How can I get the error reason when an error code is returned by a call to SQLColAttribute? SQLColAttribute is called with these arguments: SQLHSTMT StatementHandle, odbc_hstmt SQLUSMALLINT ColumnNumber, 1 SQLUSMALLINT FieldIdentifier, 1011 SQLPOINTER CharacterAttributePtr, STACK-ALLOCATED (SHORT-SIMPLE-ARRAY FOREIGN (65)) SQLSMALLINT BufferLength, 255 (also tried 65) SQLSMALLINT * StringLengthPtr, STACK-ALLOCATED (SHORT-SIMPLE-ARRAY FOREIGN (2)) SQLLEN * NumericAttributePtr); 0 The returned value is -1. When pending messages are retrieved using SQLGetDiagRec, no messages are found. What can I do to determine why the call is failing? Can you show the code of how do you call SQLGetDiagRec() and what is happening? Thank you. Thank you, Bruce _______________________________________________ FreeTDS mailing list FreeTDS at lists.ibiblio.org https://lists.ibiblio.org/mailman/listinfo/freetds _______________________________________________ FreeTDS mailing list FreeTDS at lists.ibiblio.org https://lists.ibiblio.org/mailman/listinfo/freetds From toddthomp at hotmail.com Tue Jul 28 19:29:54 2020 From: toddthomp at hotmail.com (todd thompson) Date: Tue, 28 Jul 2020 23:29:54 +0000 Subject: [freetds] Installing freetds-1.1.20 on HPUX 11.31 In-Reply-To: References: , Message-ID: Hi Frediano, Thanks for your last response. I wanted to let you know what finally allowed us to get a successful make was typing the following settings before executing the make command: env CC=cc CFLAGS="+DD32 -mt -AC99 +O2 -I/usr/local/include" LDFLAGS="-L/usr/local/lib/hpux32" ./configure --prefix=/opt/crvsdi/freetds --with-tdsver=auto --with-libiconv-prefix=/usr/local/lib/hpux32 Thanks, Todd ________________________________ From: FreeTDS on behalf of Frediano Ziglio Sent: Thursday, May 7, 2020 8:49 AM To: FreeTDS Development Group Subject: Re: [freetds] Installing freetds-1.1.20 on HPUX 11.31 Hi, se below. Frediano Il giorno mer 6 mag 2020 alle ore 19:49 todd thompson ha scritto: > > Hi All, > > We used this configure statement: ./configure --prefix=/opt/ictest/freetds --with-tdsver=auto > And we received the following error during the make: > > > ---------------------------------------------------------------------------- > > opt/ictest/freetds/freetds-1.1.20 > > s11u013c:freetds/freetds-1.1.20 $ make > > No suffix list. > > Making all in include > > No suffix list. > > make all-recursive > > No suffix list. > > Making all in freetds > > No suffix list. > > echo '#define FREETDS_SYSCONFDIR "/opt/ictest/freetds/etc"' >sysconfdir.h > > No suffix list. > > Making all in src > > No suffix list. > > Making all in utils > > Making all in . > > CC md4.lo > > In file included from md4.c:42: > > ../../include/tds_sysdep_public.h:62: error: conflicting types for 'intptr_t' > > /usr/include/sys/_inttypes.h:114: error: previous declaration of 'intptr_t' was here > > ../../include/tds_sysdep_public.h:63: error: conflicting types for 'uintptr_t' > > /usr/include/sys/_inttypes.h:115: error: previous declaration of 'uintptr_t' was here > searching for this issue, try to change in include/tds_sysdep_public.h from #elif defined(__sun) && defined(__SVR4) to #elif (defined(__sun) && defined(__SVR4)) || defined (__HP_cc) > *** Error exit code 1 > > > > Stop. > > *** Error exit code 1 > > > > Stop. > > *** Error exit code 1 > > > > Stop. > > *** Error exit code 1 > > > > Stop. > > ------------------------------------------------------------------------------ > > I found this explanation on Google: > > > The package you are trying to build (like almost every package you'll > find) is written in ANSI C. The bundled HP compiler handles only K&R C; > you need to either purchase the ANSI C compiler for your HP machine, or > build gcc and its dependencies first. > It could happen. Honestly I found strange that cpp (the preprocessor, at least the classic executable name for it in Unix) does not have an option for this. But try with the above patch and let me know. > If this is accurate, we more than likely won't be able to purchase the ANSI C compiler. Do you know how to "build gcc and it's dependencies"? > I did once, it takes some times but worked. But it was many years ago, I would just search "how to compile gcc under hp-ux". I remember there was also an open source repository of compiled programs for hp-ux. >From a quick search I found http://hpux.connect.org.uk/hppd/hpux/Gnu/gcc-4.2.3/ https://community.hpe.com/t5/languages-and-scripting/how-to-download-gcc/td-p/6899991 > Todd > > ________________________________ > From: FreeTDS on behalf of Frediano Ziglio > Sent: Monday, April 27, 2020 10:11 AM > To: FreeTDS Development Group > Subject: Re: [freetds] Installing freetds-1.1.20 on HPUX 11.31 > > Il giorno dom 26 apr 2020 alle ore 20:24 todd thompson > ha scritto: > > > > Hi All, > > > > The articles I've found in google searches keep pointing to this site (http://www.freetds.org/userguide/) but haven't been able to find something specific for HPUX 11.31 or just HPUX. I've installed freetds on RHEL 6.10 but I've read a couple articles saying the configure statement (i.e. ./configure --prefix=/opt/cloudhost/apache/www/cgi-bin/webutils/freetds with-tdsver=auto) is different so I'm mainly looking for the configure statement because I think the make and make install commands are the same. > > > > Thanks ahead of time. > > > > Todd > > Hi, > there's nothing special to be done for HP-UX, you should be able to > use the standard configure/make. > Somebody reported an issue with the standard preprocessor which is not > C compatible (neither C89 nor C99), if this is the case use another > preprocessor/compiler (like gcc). > For any issue you can report here. > In the past I had access to HP-UX machine but not anymore (it was > about 8 years ago). > > Regards, > Frediano > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > https://lists.ibiblio.org/mailman/listinfo/freetds > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > https://lists.ibiblio.org/mailman/listinfo/freetds _______________________________________________ FreeTDS mailing list FreeTDS at lists.ibiblio.org https://lists.ibiblio.org/mailman/listinfo/freetds From bseely at stsci.edu Thu Jul 30 11:27:04 2020 From: bseely at stsci.edu (Bruce Seely) Date: Thu, 30 Jul 2020 15:27:04 +0000 Subject: [freetds] Arguments to SQLColAttribute Message-ID: <770BB57E-2B98-4010-9BB7-0AB4377B3096@stsci.edu> In sql.log, the trace for SQLColAttribute looks like this: [000000.200163] alisp 1120FD5C0 ENTER SQLColAttribute SQLHSTMT 0x7f92b46023f0 SQLUSMALLINT 1 SQLUSMALLINT 1011 (SQL_DESC_NAME) SQLPOINTER 0x7ffeea1dafc0 SQLINTEGER * 256 SQLSMALLINT * 0x7ffeea1db1d0 SQLLEN * 0x0 [000000.201194] alisp 1120FD5C0 EXIT SQLColAttribute with return code -1 (SQL_ERROR) SQLHSTMT 0x7f92b46023f0 SQLUSMALLINT 1 SQLUSMALLINT 1011 (SQL_DESC_NAME) SQLPOINTER 0x7ffeea1dafc0 SQLINTEGER * 256 SQLSMALLINT * 0x7ffeea1db1d0 SQLLEN * 0x0 The SQLColAttribute definition in odbc/odbc.c is this: static SQLRETURN _SQLColAttribute(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT FAR * pcbDesc, SQLLEN FAR * pfDesc _WIDE); The SQLColAttribute spec at https://www.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/odbc/src/tpc/db2z_fncolattribute.html shows it as a SQLSMALLINT The BufferLength (5th) argument is a SQLSMALLINT in the C code, but it shows as a SQLINTEGER* in the sql.log trace. Is this an indication that I am passing a bad 5th argument to SQLColAttribute? Thanks, Bruce From freddy77 at gmail.com Thu Jul 30 13:34:07 2020 From: freddy77 at gmail.com (Frediano Ziglio) Date: Thu, 30 Jul 2020 18:34:07 +0100 Subject: [freetds] Arguments to SQLColAttribute In-Reply-To: <770BB57E-2B98-4010-9BB7-0AB4377B3096@stsci.edu> References: <770BB57E-2B98-4010-9BB7-0AB4377B3096@stsci.edu> Message-ID: Il giorno gio 30 lug 2020 alle ore 16:29 Bruce Seely ha scritto: > > In sql.log, the trace for SQLColAttribute looks like this: > > [000000.200163] > alisp 1120FD5C0 ENTER SQLColAttribute > SQLHSTMT 0x7f92b46023f0 > SQLUSMALLINT 1 > SQLUSMALLINT 1011 (SQL_DESC_NAME) > SQLPOINTER 0x7ffeea1dafc0 > SQLINTEGER * 256 > SQLSMALLINT * 0x7ffeea1db1d0 > SQLLEN * 0x0 > > [000000.201194] > alisp 1120FD5C0 EXIT SQLColAttribute with return code -1 > (SQL_ERROR) > SQLHSTMT 0x7f92b46023f0 > SQLUSMALLINT 1 > SQLUSMALLINT 1011 (SQL_DESC_NAME) > SQLPOINTER 0x7ffeea1dafc0 > SQLINTEGER * 256 > SQLSMALLINT * 0x7ffeea1db1d0 > SQLLEN * 0x0 > > > The SQLColAttribute definition in odbc/odbc.c is this: > static SQLRETURN _SQLColAttribute(SQLHSTMT hstmt, SQLUSMALLINT icol, > SQLUSMALLINT fDescType, SQLPOINTER rgbDesc, > SQLSMALLINT cbDescMax, > SQLSMALLINT FAR * pcbDesc, SQLLEN FAR * pfDesc _WIDE); > > The SQLColAttribute spec at > https://www.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/odbc/src/tpc/db2z_fncolattribute.html > shows it as a SQLSMALLINT > > > The BufferLength (5th) argument is a SQLSMALLINT in the C code, but it > shows as a SQLINTEGER* in the sql.log trace. > > Is this an indication that I am passing a bad 5th argument to > SQLColAttribute? > > Hi, I would have suggested a SQL trace too. The declarations in FreeTDS are: #if (ODBCVER >= 0x0300) SQLRETURN ODBC_PUBLIC ODBC_API SQLColAttribute(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT FAR * pcbDesc, #ifdef TDS_SQLCOLATTRIBUTE_SQLLEN SQLLEN FAR * pfDesc #else SQLPOINTER pfDesc #endif ) { return _SQLColAttribute(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc _wide0); } #ifdef ENABLE_ODBC_WIDE SQLRETURN ODBC_PUBLIC ODBC_API SQLColAttributeW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT FAR * pcbDesc, #ifdef TDS_SQLCOLATTRIBUTE_SQLLEN SQLLEN FAR * pfDesc #else SQLPOINTER pfDesc #endif ) { tdsdump_log(TDS_DBG_FUNC, "SQLColAttributeW(%p, %u, %u, %p, %d, %p, %p)\n", hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); return _SQLColAttribute(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc, 1); } #endif #endif the same as the page you pointed out (and compatible also with Microsoft documentation). I have no idea why the log shows a pointer and to be honest I would expect more a crash than the function just returning error if the DM would interpret the parameter in such a way. It's also weird that the value is written in decimal and not in hexadecimal like all other pointers. Which kind of DM is it? Thanks, > Bruce > Frediano From bseely at stsci.edu Fri Jul 31 08:35:10 2020 From: bseely at stsci.edu (Bruce Seely) Date: Fri, 31 Jul 2020 12:35:10 +0000 Subject: [freetds] FreeTDS Digest, Vol 197, Issue 4 Message-ID: After sending log files, I realized that when the ODBC driver terminated, FreeTDS had not finished wriing the log file. Below are the log files with the error in the driver commented-out. _____________________________________________________________________ sql.log: ** iODBC Trace file ** Trace started on Fri Jul 31 08:27:44 2020 ** Driver Manager: 03.52.0607.1008 [000000.000141] alisp 11A32C5C0 ENTER SQLAllocHandle SQLSMALLINT 1 (SQL_HANDLE_ENV) SQLHANDLE 0x0 (SQL_NULL_HANDLE) SQLHANDLE * 0x7ffee0bbf180 [000000.000159] alisp 11A32C5C0 EXIT SQLAllocHandle with return code 0 (SQL_SUCCESS) SQLSMALLINT 1 (SQL_HANDLE_ENV) SQLHANDLE 0x0 (SQL_NULL_HANDLE) SQLHANDLE * 0x7ffee0bbf180 (0x7fad37000490) [000000.000959] alisp 11A32C5C0 ENTER SQLSetEnvAttr SQLHENV 0x7fad37000490 SQLINTEGER 200 (SQL_ATTR_ODBC_VERSION) SQLPOINTER 0x2 SQLINTEGER * 0 [000000.001008] alisp 11A32C5C0 EXIT SQLSetEnvAttr with return code 0 (SQL_SUCCESS) SQLHENV 0x7fad37000490 SQLINTEGER 200 (SQL_ATTR_ODBC_VERSION) SQLPOINTER 0x2 SQLINTEGER * 0 [000000.001525] alisp 11A32C5C0 ENTER SQLAllocHandle SQLSMALLINT 2 (SQL_HANDLE_DBC) SQLHANDLE 0x7fad37000490 SQLHANDLE * 0x7ffee0bbf290 [000000.001549] alisp 11A32C5C0 EXIT SQLAllocHandle with return code 0 (SQL_SUCCESS) SQLSMALLINT 2 (SQL_HANDLE_DBC) SQLHANDLE 0x7fad37000490 SQLHANDLE * 0x7ffee0bbf290 (0x7fad37000820) [000000.001688] alisp 11A32C5C0 ENTER SQLDriverConnect SQLHDBC 0x7fad37000820 SQLPOINTER 0x0 SQLCHAR * 0x7ffee0bc0180 | DSN=R2D2;UID=bseely;PWD=************ | SQLSMALLINT -3 (SQL_NTS) SQLCHAR * 0x7ffee0bbf950 SQLSMALLINT 1024 SQLSMALLINT * 0x7ffee0bc0160 SQLUSMALLINT 0 (SQL_DRIVER_NOPROMPT) [000000.153406] alisp 11A32C5C0 EXIT SQLDriverConnect with return code 0 (SQL_SUCCESS) SQLHDBC 0x7fad37000820 SQLPOINTER 0x0 SQLCHAR * 0x7ffee0bc0180 SQLSMALLINT -3 (SQL_NTS) SQLCHAR * 0x7ffee0bbf950 | DSN=R2D2;UID=bseely;PWD=************ | SQLSMALLINT 1024 SQLSMALLINT * 0x7ffee0bc0160 (36) SQLUSMALLINT 0 (SQL_DRIVER_NOPROMPT) [000000.153852] alisp 11A32C5C0 ENTER SQLAllocHandle SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHANDLE 0x7fad37000820 SQLHANDLE * 0x7ffee0bbf270 [000000.153907] alisp 11A32C5C0 EXIT SQLAllocHandle with return code 0 (SQL_SUCCESS) SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHANDLE 0x7fad37000820 SQLHANDLE * 0x7ffee0bbf270 (0x7fad35415820) [000000.155280] alisp 11A32C5C0 ENTER SQLExecDirect SQLHSTMT 0x7fad35415820 SQLCHAR * 0x7ffee0bbfe40 | use pps_lrp_alpha | SQLINTEGER -3 (SQL_NTS) [000000.169904] alisp 11A32C5C0 EXIT SQLExecDirect with return code 1 (SQL_SUCCESS_WITH_INFO) SQLHSTMT 0x7fad35415820 SQLCHAR * 0x7ffee0bbfe40 SQLINTEGER -3 (SQL_NTS) [000000.170035] alisp 11A32C5C0 ENTER SQLGetDiagRec SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbf230 SQLINTEGER * 0x7ffee0bbf260 SQLCHAR * 0x7ffee0bbf280 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf690 [000000.170088] alisp 11A32C5C0 EXIT SQLGetDiagRec with return code 0 (SQL_SUCCESS) SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbf230 | 01000 | SQLINTEGER * 0x7ffee0bbf260 (5701) SQLCHAR * 0x7ffee0bbf280 | [FreeTDS][SQL Server]Changed database co | | ntext to 'pps_lrp_alpha'. | SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf690 (65) [000000.174750] alisp 11A32C5C0 ENTER SQLGetDiagRec SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 2 SQLCHAR * 0x7ffee0bbf230 SQLINTEGER * 0x7ffee0bbf260 SQLCHAR * 0x7ffee0bbf280 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf690 [000000.174807] alisp 11A32C5C0 EXIT SQLGetDiagRec with return code 100 (SQL_NO_DATA_FOUND) SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 2 SQLCHAR * 0x7ffee0bbf230 SQLINTEGER * 0x7ffee0bbf260 SQLCHAR * 0x7ffee0bbf280 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf690 (65) [000000.175115] alisp 11A32C5C0 ENTER SQLNumResultCols SQLHSTMT 0x7fad35415820 SQLSMALLINT * 0x7ffee0bc0730 [000000.175140] alisp 11A32C5C0 EXIT SQLNumResultCols with return code 0 (SQL_SUCCESS) SQLHSTMT 0x7fad35415820 SQLSMALLINT * 0x7ffee0bc0730 (0) [000000.175222] alisp 11A32C5C0 ENTER SQLMoreResults SQLHSTMT 0x7fad35415820 [000000.175248] alisp 11A32C5C0 EXIT SQLMoreResults with return code 100 (SQL_NO_DATA_FOUND) SQLHSTMT 0x7fad35415820 [000000.175335] alisp 11A32C5C0 ENTER SQLGetDiagRec SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbfb40 SQLINTEGER * 0x7ffee0bbfb70 SQLCHAR * 0x7ffee0bbfb90 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbffa0 [000000.175371] alisp 11A32C5C0 EXIT SQLGetDiagRec with return code 100 (SQL_NO_DATA_FOUND) SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbfb40 SQLINTEGER * 0x7ffee0bbfb70 SQLCHAR * 0x7ffee0bbfb90 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbffa0 (4041) [000000.175657] alisp 11A32C5C0 ENTER SQLExecDirect SQLHSTMT 0x7fad35415820 SQLCHAR * 0x7ffee0bbfec0 | select * from ppsdb_version | SQLINTEGER -3 (SQL_NTS) [000000.189580] alisp 11A32C5C0 EXIT SQLExecDirect with return code 0 (SQL_SUCCESS) SQLHSTMT 0x7fad35415820 SQLCHAR * 0x7ffee0bbfec0 SQLINTEGER -3 (SQL_NTS) [000000.189904] alisp 11A32C5C0 ENTER SQLNumResultCols SQLHSTMT 0x7fad35415820 SQLSMALLINT * 0x7ffee0bc07b0 [000000.189958] alisp 11A32C5C0 EXIT SQLNumResultCols with return code 0 (SQL_SUCCESS) SQLHSTMT 0x7fad35415820 SQLSMALLINT * 0x7ffee0bc07b0 (4) [000000.190767] alisp 11A32C5C0 ENTER SQLColAttribute SQLHSTMT 0x7fad35415820 SQLUSMALLINT 1 SQLUSMALLINT 1011 (SQL_DESC_NAME) SQLPOINTER 0x7ffee0bbffb0 SQLINTEGER * 256 SQLSMALLINT * 0x7ffee0bc01c0 SQLLEN * 0x0 [000000.191430] alisp 11A32C5C0 EXIT SQLColAttribute with return code -1 (SQL_ERROR) SQLHSTMT 0x7fad35415820 SQLUSMALLINT 1 SQLUSMALLINT 1011 (SQL_DESC_NAME) SQLPOINTER 0x7ffee0bbffb0 SQLINTEGER * 256 SQLSMALLINT * 0x7ffee0bc01c0 SQLLEN * 0x0 [000000.191683] alisp 11A32C5C0 ENTER SQLGetDiagRec SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbf3b0 SQLINTEGER * 0x7ffee0bbf3e0 SQLCHAR * 0x7ffee0bbf400 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf810 [000000.191750] alisp 11A32C5C0 EXIT SQLGetDiagRec with return code 100 (SQL_NO_DATA_FOUND) SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbf3b0 SQLINTEGER * 0x7ffee0bbf3e0 SQLCHAR * 0x7ffee0bbf400 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf810 (4041) [000000.192396] alisp 11A32C5C0 ENTER SQLColAttribute SQLHSTMT 0x7fad35415820 SQLUSMALLINT 2 SQLUSMALLINT 1011 (SQL_DESC_NAME) SQLPOINTER 0x7ffee0bbffb0 SQLINTEGER * 256 SQLSMALLINT * 0x7ffee0bc01c0 SQLLEN * 0x0 [000000.192430] alisp 11A32C5C0 EXIT SQLColAttribute with return code -1 (SQL_ERROR) SQLHSTMT 0x7fad35415820 SQLUSMALLINT 2 SQLUSMALLINT 1011 (SQL_DESC_NAME) SQLPOINTER 0x7ffee0bbffb0 SQLINTEGER * 256 SQLSMALLINT * 0x7ffee0bc01c0 SQLLEN * 0x0 [000000.192647] alisp 11A32C5C0 ENTER SQLGetDiagRec SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbf3b0 SQLINTEGER * 0x7ffee0bbf3e0 SQLCHAR * 0x7ffee0bbf400 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf810 [000000.192720] alisp 11A32C5C0 EXIT SQLGetDiagRec with return code 100 (SQL_NO_DATA_FOUND) SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbf3b0 SQLINTEGER * 0x7ffee0bbf3e0 SQLCHAR * 0x7ffee0bbf400 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf810 (4041) [000000.193344] alisp 11A32C5C0 ENTER SQLColAttribute SQLHSTMT 0x7fad35415820 SQLUSMALLINT 3 SQLUSMALLINT 1011 (SQL_DESC_NAME) SQLPOINTER 0x7ffee0bbffb0 SQLINTEGER * 256 SQLSMALLINT * 0x7ffee0bc01c0 SQLLEN * 0x0 [000000.193390] alisp 11A32C5C0 EXIT SQLColAttribute with return code -1 (SQL_ERROR) SQLHSTMT 0x7fad35415820 SQLUSMALLINT 3 SQLUSMALLINT 1011 (SQL_DESC_NAME) SQLPOINTER 0x7ffee0bbffb0 SQLINTEGER * 256 SQLSMALLINT * 0x7ffee0bc01c0 SQLLEN * 0x0 [000000.193596] alisp 11A32C5C0 ENTER SQLGetDiagRec SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbf3b0 SQLINTEGER * 0x7ffee0bbf3e0 SQLCHAR * 0x7ffee0bbf400 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf810 [000000.193658] alisp 11A32C5C0 EXIT SQLGetDiagRec with return code 100 (SQL_NO_DATA_FOUND) SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbf3b0 SQLINTEGER * 0x7ffee0bbf3e0 SQLCHAR * 0x7ffee0bbf400 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf810 (4041) [000000.194073] alisp 11A32C5C0 ENTER SQLColAttribute SQLHSTMT 0x7fad35415820 SQLUSMALLINT 4 SQLUSMALLINT 1011 (SQL_DESC_NAME) SQLPOINTER 0x7ffee0bbffb0 SQLINTEGER * 256 SQLSMALLINT * 0x7ffee0bc01c0 SQLLEN * 0x0 [000000.194105] alisp 11A32C5C0 EXIT SQLColAttribute with return code -1 (SQL_ERROR) SQLHSTMT 0x7fad35415820 SQLUSMALLINT 4 SQLUSMALLINT 1011 (SQL_DESC_NAME) SQLPOINTER 0x7ffee0bbffb0 SQLINTEGER * 256 SQLSMALLINT * 0x7ffee0bc01c0 SQLLEN * 0x0 [000000.194242] alisp 11A32C5C0 ENTER SQLGetDiagRec SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbf3b0 SQLINTEGER * 0x7ffee0bbf3e0 SQLCHAR * 0x7ffee0bbf400 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf810 [000000.194279] alisp 11A32C5C0 EXIT SQLGetDiagRec with return code 100 (SQL_NO_DATA_FOUND) SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbf3b0 SQLINTEGER * 0x7ffee0bbf3e0 SQLCHAR * 0x7ffee0bbf400 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bbf810 (4041) [000000.194450] alisp 11A32C5C0 ENTER SQLFetch SQLHSTMT 0x7fad35415820 [000000.194531] alisp 11A32C5C0 EXIT SQLFetch with return code 0 (SQL_SUCCESS) SQLHSTMT 0x7fad35415820 [000000.194620] alisp 11A32C5C0 ENTER SQLGetData SQLHSTMT 0x7fad35415820 SQLUSMALLINT 1 SQLSMALLINT 1 (SQL_C_CHAR) SQLPOINTER 0x8000008e030 SQLLEN 1024 SQLLEN * 0x80000010db0 [000000.194670] alisp 11A32C5C0 EXIT SQLGetData with return code 0 (SQL_SUCCESS) SQLHSTMT 0x7fad35415820 SQLUSMALLINT 1 SQLSMALLINT 1 (SQL_C_CHAR) SQLPOINTER 0x8000008e030 | 1 | SQLLEN 1024 SQLLEN * 0x80000010db0 (1) [000000.194771] alisp 11A32C5C0 ENTER SQLGetData SQLHSTMT 0x7fad35415820 SQLUSMALLINT 2 SQLSMALLINT 1 (SQL_C_CHAR) SQLPOINTER 0x8000008f030 SQLLEN 1024 SQLLEN * 0x80000010a30 [000000.194806] alisp 11A32C5C0 EXIT SQLGetData with return code 0 (SQL_SUCCESS) SQLHSTMT 0x7fad35415820 SQLUSMALLINT 2 SQLSMALLINT 1 (SQL_C_CHAR) SQLPOINTER 0x8000008f030 | PPSDB86 | SQLLEN 1024 SQLLEN * 0x80000010a30 (7) [000000.194890] alisp 11A32C5C0 ENTER SQLGetData SQLHSTMT 0x7fad35415820 SQLUSMALLINT 3 SQLSMALLINT 1 (SQL_C_CHAR) SQLPOINTER 0x80000090030 SQLLEN 1024 SQLLEN * 0x80000010b30 [000000.194927] alisp 11A32C5C0 EXIT SQLGetData with return code 0 (SQL_SUCCESS) SQLHSTMT 0x7fad35415820 SQLUSMALLINT 3 SQLSMALLINT 1 (SQL_C_CHAR) SQLPOINTER 0x80000090030 | 2020-02-11 18:26:38 -05:00 | SQLLEN 1024 SQLLEN * 0x80000010b30 (26) [000000.195013] alisp 11A32C5C0 ENTER SQLGetData SQLHSTMT 0x7fad35415820 SQLUSMALLINT 4 SQLSMALLINT 1 (SQL_C_CHAR) SQLPOINTER 0x80000091030 SQLLEN 1024 SQLLEN * 0x80000010e30 [000000.195047] alisp 11A32C5C0 EXIT SQLGetData with return code 0 (SQL_SUCCESS) SQLHSTMT 0x7fad35415820 SQLUSMALLINT 4 SQLSMALLINT 1 (SQL_C_CHAR) SQLPOINTER 0x80000091030 SQLLEN 1024 SQLLEN * 0x80000010e30 (0) [000000.195109] alisp 11A32C5C0 ENTER SQLFetch SQLHSTMT 0x7fad35415820 [000000.195167] alisp 11A32C5C0 EXIT SQLFetch with return code 100 (SQL_NO_DATA_FOUND) SQLHSTMT 0x7fad35415820 [000000.195257] alisp 11A32C5C0 ENTER SQLGetDiagRec SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbfcb0 SQLINTEGER * 0x7ffee0bbfce0 SQLCHAR * 0x7ffee0bbfd00 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bc0110 [000000.195294] alisp 11A32C5C0 EXIT SQLGetDiagRec with return code 100 (SQL_NO_DATA_FOUND) SQLSMALLINT 3 (SQL_HANDLE_STMT) SQLHSTMT 0x7fad35415820 SQLSMALLINT 1 SQLCHAR * 0x7ffee0bbfcb0 SQLINTEGER * 0x7ffee0bbfce0 SQLCHAR * 0x7ffee0bbfd00 SQLSMALLINT 512 SQLSMALLINT * 0x7ffee0bc0110 (4041) [000000.195365] alisp 11A32C5C0 ENTER SQLFreeStmt SQLHSTMT 0x7fad35415820 SQLUSMALLINT 2 (SQL_UNBIND) [000000.195393] alisp 11A32C5C0 EXIT SQLFreeStmt with return code 0 (SQL_SUCCESS) SQLHSTMT 0x7fad35415820 SQLUSMALLINT 2 (SQL_UNBIND) [000000.195407] alisp 11A32C5C0 ENTER SQLFreeStmt SQLHSTMT 0x7fad35415820 SQLUSMALLINT 0 (SQL_CLOSE) [000000.195427] alisp 11A32C5C0 EXIT SQLFreeStmt with return code 0 (SQL_SUCCESS) SQLHSTMT 0x7fad35415820 SQLUSMALLINT 0 (SQL_CLOSE) _____________________________________________________________________ freetds.log: log.c:168:Starting log file for FreeTDS 1.2rc3 on 2020-07-31 08:27:44 with debug flags 0x4fff. iconv.c:365:tds_iconv_open(0x7fad35600e80, UTF-8) iconv.c:196:local name for ISO-8859-1 is ISO-8859-1 iconv.c:196:local name for UTF-8 is UTF-8 iconv.c:196:local name for UCS-2LE is UCS-2LE iconv.c:196:local name for UCS-2BE is UCS-2BE iconv.c:387:setting up conversions for client charset "UTF-8" iconv.c:389:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion iconv.c:428:tds_iconv_open: done net.c:391:Connecting with protocol version 7.2 net.c:318:Connecting to 10.128.21.119 port 1433 net.c:340:tds_setup_socket: connect(2) returned "Operation now in progress" net.c:528:tds_open_socket() succeeded packet.c:852:Sending packet 0000 12 01 00 3a 00 00 00 00-00 00 1a 00 06 01 00 20 |...:.... ....... | 0010 00 01 02 00 21 00 0c 03-00 2d 00 04 04 00 31 00 |....!... .-....1.| 0020 01 ff 09 00 00 00 00 00-00 4d 53 53 51 4c 53 65 |.?...... .MSSQLSe| 0030 72 76 65 72 00 a8 69 00-00 00 |rver.?i. ..| packet.c:410:Received packet 0000 04 01 00 2b 00 00 01 00-00 00 1a 00 06 01 00 20 |...+.... ....... | 0010 00 01 02 00 21 00 01 03-00 22 00 00 04 00 22 00 |....!... ."....".| 0020 01 ff 0d 00 15 de 00 00-00 00 00 |.?...?.. ...| login.c:1281:detected crypt flag 0 tls.c:1013:setting default openssl cipher to:HIGH:!SSLv2:!aNULL:-DH tls.c:147:in tds_push_func_login tls.c:117:in tds_pull_func_login packet.c:852:Sending packet 0000 12 01 01 4b 00 00 00 00-16 03 01 01 3e 01 00 01 |...K.... ....>...| 0010 3a 03 03 e1 65 50 35 07-5c 1f 10 f7 15 2e 3c c7 |:..?eP5. \..?..? .... ?..C..??| 0040 2c b0 88 3c 72 0d 97 fe-d6 4b 34 24 bc 1e 1b 28 |,?.conn->collation was 0000 00 00 00 00 00 - |.....| iconv.c:825:setting server single-byte charset to "CP1252" token.c:2236:tds->conn->collation now 0000 09 04 d0 00 34 - |..?.4| token.c:421:looking for login token, got e3(ENVCHANGE) token.c:130:tds_process_default_tokens() marker is e3(ENVCHANGE) token.c:421:looking for login token, got ab(INFO) token.c:130:tds_process_default_tokens() marker is ab(INFO) mem.c:656:tds_free_all_results() token.c:2398:tds_process_info() reading message 5703 from server token.c:2493:tds_process_info() calling client msg handler odbc.c:2369:msgno 5703 20003 token.c:2510:tds_process_info() returning TDS_SUCCESS token.c:421:looking for login token, got ad(LOGINACK) token.c:347:server reports TDS version 72.9.0.2 token.c:349:Product name for 0x72090002 is 2005 token.c:383:Product version 8D0015DE token.c:421:looking for login token, got e3(ENVCHANGE) token.c:130:tds_process_default_tokens() marker is e3(ENVCHANGE) token.c:2285:changing block size from 4096 to 4096 token.c:421:looking for login token, got fd(DONE) token.c:130:tds_process_default_tokens() marker is fd(DONE) token.c:2096:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2115: rows_affected = 0 token.c:2118:tds_process_end() state set to TDS_IDLE token.c:444:tds_process_login_tokens() returning TDS_SUCCESS mem.c:656:tds_free_all_results() util.c:179:Changed query state from IDLE to WRITING packet.c:852:Sending packet 0000 01 01 00 48 00 00 00 00-16 00 00 00 12 00 00 00 |...H.... ........| 0010 02 00 00 00 00 00 00 00-00 00 01 00 00 00 73 00 |........ ......s.| 0020 65 00 74 00 20 00 74 00-65 00 78 00 74 00 73 00 |e.t. .t. e.x.t.s.| 0030 69 00 7a 00 65 00 20 00-32 00 30 00 30 00 30 00 |i.z.e. . 2.0.0.0.| 0040 30 00 30 00 30 00 20 00- |0.0.0. .| util.c:179:Changed query state from WRITING to PENDING token.c:554:tds_process_tokens(0x7fad356011d0, 0x7ffee0bb7ea0, 0x7ffee0bb7ea4, 0x100) util.c:179:Changed query state from PENDING to READING packet.c:410:Received packet 0000 04 01 00 15 00 4f 01 00-fd 00 00 be 00 00 00 00 |.....O.. ?..?....| 0010 00 00 00 00 00 - |.....| token.c:569:processing result tokens. marker is fd(DONE) token.c:2096:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2115: rows_affected = 0 token.c:2118:tds_process_end() state set to TDS_IDLE util.c:179:Changed query state from READING to IDLE util.c:83:logic error: cannot change query state from IDLE to PENDING util.c:179:Changed query state from IDLE to IDLE token.c:554:tds_process_tokens(0x7fad356011d0, 0x7ffee0bb7ea0, 0x7ffee0bb7ea4, 0x100) token.c:557:tds_process_tokens() state is COMPLETED odbc.c:5941:SQLGetInfoW(0x7fad36005200, 23, 0x7fad370008f8, 2, 0x0) odbc.c:5173:_SQLGetInfo(0x7fad36005200, 23, 0x7fad370008f8, 2, 0x0) odbc.c:5941:SQLGetInfoW(0x7fad36005200, 24, 0x7fad370008fa, 2, 0x0) odbc.c:5173:_SQLGetInfo(0x7fad36005200, 24, 0x7fad370008fa, 2, 0x0) odbc.c:1812:SQLAllocStmt(0x7fad36005200, 0x7fad35415848) odbc.c:1706:_SQLAllocStmt(0x7fad36005200, 0x7fad35415848) odbc.c:4508:SQLGetStmtAttr(0x7fad35416630, 10010, 0x7fad35415ae8, 0, 0x0) odbc.c:4508:SQLGetStmtAttr(0x7fad35416630, 10011, 0x7fad35416168, 0, 0x0) odbc.c:4508:SQLGetStmtAttr(0x7fad35416630, 10012, 0x7fad35416928, 0, 0x0) odbc.c:4508:SQLGetStmtAttr(0x7fad35416630, 10013, 0x7fad35416968, 0, 0x0) odbc_export.h:801:SQLExecDirectW(0x7fad35416630, use pps_lrp_alpha, -3) prepare_query.c:208:parsing 0 parameters odbc.c:3275:_SQLExecute(0x7fad35416630) odbc.c:3292:_SQLExecute() starting with state 0 mem.c:656:tds_free_all_results() util.c:179:Changed query state from IDLE to WRITING packet.c:852:Sending packet 0000 01 01 00 40 00 00 01 00-16 00 00 00 12 00 00 00 |... at .... ........| 0010 02 00 00 00 00 00 00 00-00 00 01 00 00 00 75 00 |........ ......u.| 0020 73 00 65 00 20 00 70 00-70 00 73 00 5f 00 6c 00 |s.e. .p. p.s._.l.| 0030 72 00 70 00 5f 00 61 00-6c 00 70 00 68 00 61 00 |r.p._.a. l.p.h.a.| util.c:179:Changed query state from WRITING to PENDING token.c:554:tds_process_tokens(0x7fad356011d0, 0x7ffee0bbf704, 0x7ffee0bbf700, 0x6914) util.c:179:Changed query state from PENDING to READING packet.c:410:Received packet 0000 04 01 00 cf 00 4f 01 00-e3 29 00 01 0d 70 00 70 |...?.O.. ?)...p.p| 0010 00 73 00 5f 00 6c 00 72-00 70 00 5f 00 61 00 6c |.s._.l.r .p._.a.l| 0020 00 70 00 68 00 61 00 06-6d 00 61 00 73 00 74 00 |.p.h.a.. m.a.s.t.| 0030 65 00 72 00 ab 80 00 45-16 00 00 01 00 2c 00 43 |e.r.?..E .....,.C| 0040 00 68 00 61 00 6e 00 67-00 65 00 64 00 20 00 64 |.h.a.n.g .e.d. .d| 0050 00 61 00 74 00 61 00 62-00 61 00 73 00 65 00 20 |.a.t.a.b .a.s.e. | 0060 00 63 00 6f 00 6e 00 74-00 65 00 78 00 74 00 20 |.c.o.n.t .e.x.t. | 0070 00 74 00 6f 00 20 00 27-00 70 00 70 00 73 00 5f |.t.o. .' .p.p.s._| 0080 00 6c 00 72 00 70 00 5f-00 61 00 6c 00 70 00 68 |.l.r.p._ .a.l.p.h| 0090 00 61 00 27 00 2e 00 0d-44 00 57 00 50 00 50 00 |.a.'.... D.W.P.P.| 00a0 53 00 52 00 32 00 44 00-32 00 44 00 42 00 56 00 |S.R.2.D. 2.D.B.V.| 00b0 31 00 00 01 00 00 00 e3-08 00 07 05 09 04 c0 00 |1......? ......?.| 00c0 33 00 fd 00 00 e2 00 00-00 00 00 00 00 00 00 |3.?..?.. .......| token.c:569:processing result tokens. marker is e3(ENVCHANGE) token.c:130:tds_process_default_tokens() marker is e3(ENVCHANGE) token.c:569:processing result tokens. marker is ab(INFO) token.c:130:tds_process_default_tokens() marker is ab(INFO) mem.c:656:tds_free_all_results() token.c:2398:tds_process_info() reading message 5701 from server token.c:2493:tds_process_info() calling client msg handler odbc.c:2369:msgno 5701 20003 token.c:2510:tds_process_info() returning TDS_SUCCESS token.c:569:processing result tokens. marker is e3(ENVCHANGE) token.c:130:tds_process_default_tokens() marker is e3(ENVCHANGE) token.c:2226:tds_process_env_chg(): 5 bytes of collation data received token.c:2227:tds->conn->collation was 0000 09 04 d0 00 34 - |..?.4| iconv.c:825:setting server single-byte charset to "CP1252" token.c:2236:tds->conn->collation now 0000 09 04 c0 00 33 - |..?.3| token.c:569:processing result tokens. marker is fd(DONE) token.c:2096:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2115: rows_affected = 0 token.c:2118:tds_process_end() state set to TDS_IDLE util.c:179:Changed query state from READING to IDLE util.c:83:logic error: cannot change query state from IDLE to PENDING util.c:179:Changed query state from IDLE to IDLE odbc.c:3616:odbc_process_tokens: tds_process_tokens returned 0 odbc.c:3617: result_type=4052, TDS_DONE_COUNT=0, TDS_DONE_ERROR=0 odbc.c:3662:odbc_process_tokens: processed TDS_DONE_RESULT token.c:554:tds_process_tokens(0x7fad356011d0, 0x7ffee0bbf704, 0x7ffee0bbf700, 0x6914) token.c:557:tds_process_tokens() state is COMPLETED odbc.c:3616:odbc_process_tokens: tds_process_tokens returned 1 odbc.c:3617: result_type=4052, TDS_DONE_COUNT=0, TDS_DONE_ERROR=0 odbc.c:3438:_SQLExecute: odbc_process_tokens returned result_type 4046 error_export.h:83:SQLErrorW(0x0, 0x0, 0x7fad35416630, 0x7ffee0bbe740, 0x7ffee0bbf260, 0x7fad38001000, 512, 0x7ffee0bbf690) error.c:559:SQLGetDiagRec: "[FreeTDS][SQL Server]Changed database context to 'pps_lrp_alpha'." odbc.c:4530:SQLNumResultCols(0x7fad35416630, 0x7ffee0bbfc0e) odbc.c:893:SQLMoreResults(0x7fad35416630) odbc.c:4530:SQLNumResultCols(0x7fad35416630, 0x7ffee0bc029e) error_export.h:83:SQLErrorW(0x0, 0x0, 0x7fad35416630, 0x7ffee0bbf050, 0x7ffee0bbfb70, 0x7fad3600b600, 512, 0x7ffee0bbffa0) odbc_export.h:801:SQLExecDirectW(0x7fad35416630, select * from ppsdb_version, -3) prepare_query.c:208:parsing 0 parameters odbc.c:3275:_SQLExecute(0x7fad35416630) odbc.c:3292:_SQLExecute() starting with state 0 mem.c:656:tds_free_all_results() util.c:179:Changed query state from IDLE to WRITING packet.c:852:Sending packet 0000 01 01 00 54 00 00 01 00-16 00 00 00 12 00 00 00 |...T.... ........| 0010 02 00 00 00 00 00 00 00-00 00 01 00 00 00 73 00 |........ ......s.| 0020 65 00 6c 00 65 00 63 00-74 00 20 00 2a 00 20 00 |e.l.e.c. t. .*. .| 0030 66 00 72 00 6f 00 6d 00-20 00 70 00 70 00 73 00 |f.r.o.m. .p.p.s.| 0040 64 00 62 00 5f 00 76 00-65 00 72 00 73 00 69 00 |d.b._.v. e.r.s.i.| 0050 6f 00 6e 00 - |o.n.| util.c:179:Changed query state from WRITING to PENDING token.c:554:tds_process_tokens(0x7fad356011d0, 0x7ffee0bbf784, 0x7ffee0bbf780, 0x6914) util.c:179:Changed query state from PENDING to READING packet.c:410:Received packet 0000 04 01 00 d0 00 4f 01 00-81 04 00 00 00 00 00 08 |...?.O.. ........| 0010 00 30 02 69 00 64 00 00-00 00 00 0a 00 a7 0a 00 |.0.i.d.. .....?..| 0020 09 04 c0 00 33 0d 70 00-70 00 73 00 64 00 62 00 |..?.3.p. p.s.d.b.| 0030 5f 00 76 00 65 00 72 00-73 00 69 00 6f 00 6e 00 |_.v.e.r. s.i.o.n.| 0040 00 00 00 00 08 00 e7 34-00 09 04 c0 00 33 0a 62 |......?4 ...?.3.b| 0050 00 75 00 69 00 6c 00 64-00 5f 00 74 00 69 00 6d |.u.i.l.d ._.t.i.m| 0060 00 65 00 00 00 00 00 0a-00 a7 40 1f 09 04 c0 00 |.e...... .?@...?.| 0070 33 07 63 00 6f 00 6d 00-6d 00 65 00 6e 00 74 00 |3.c.o.m. m.e.n.t.| 0080 d1 01 07 00 50 50 53 44-42 38 36 34 00 32 00 30 |?...PPSD B864.2.0| 0090 00 32 00 30 00 2d 00 30-00 32 00 2d 00 31 00 31 |.2.0.-.0 .2.-.1.1| 00a0 00 20 00 31 00 38 00 3a-00 32 00 36 00 3a 00 33 |. .1.8.: .2.6.:.3| 00b0 00 38 00 20 00 2d 00 30-00 35 00 3a 00 30 00 30 |.8. .-.0 .5.:.0.0| 00c0 00 00 00 fd 10 00 c1 00-01 00 00 00 00 00 00 00 |...?..?. ........| token.c:569:processing result tokens. marker is 81(TDS7_RESULT) token.c:1574:processing TDS7 result metadata. mem.c:656:tds_free_all_results() token.c:1599:set current_results (4 columns) to tds->res_info token.c:1606:setting up 4 columns token.c:1543:tds7_get_data_info: colname = id type = 48 (tinyint) server's type = 48 (tinyint) column_varint_size = 0 column_size = 1 (1 on server) token.c:1543:tds7_get_data_info: colname = ppsdb_version type = 39 (varchar) server's type = 167 (xvarchar) column_varint_size = 2 column_size = 10 (10 on server) token.c:1543:tds7_get_data_info: colname = build_time type = 39 (varchar) server's type = 231 (x UCS-2 varchar) column_varint_size = 2 column_size = 52 (52 on server) token.c:1543:tds7_get_data_info: colname = comment type = 39 (varchar) server's type = 167 (xvarchar) column_varint_size = 2 column_size = 8000 (8000 on server) token.c:1615: name size/wsize type/wtype utype token.c:1616: -------------------- --------------- --------------- ------- token.c:1621: id 1/1 48/48 0 token.c:1621: ppsdb_version 10/10 39/167 0 token.c:1621: build_time 52/52 39/231 0 token.c:1621: comment 8000/8000 39/167 0 util.c:179:Changed query state from READING to PENDING odbc.c:3616:odbc_process_tokens: tds_process_tokens returned 0 odbc.c:3617: result_type=4049, TDS_DONE_COUNT=0, TDS_DONE_ERROR=0 odbc.c:3689:odbc_process_tokens: returning result_type 4049 odbc.c:3438:_SQLExecute: odbc_process_tokens returned result_type 4049 token.c:554:tds_process_tokens(0x7fad356011d0, 0x7ffee0bbf784, 0x7ffee0bbf780, 0x6914) util.c:179:Changed query state from PENDING to READING token.c:569:processing result tokens. marker is d1(ROW) token.c:675:tds_process_tokens::SET_RETURN stopping on current token util.c:179:Changed query state from READING to PENDING odbc.c:3616:odbc_process_tokens: tds_process_tokens returned 0 odbc.c:3617: result_type=4040, TDS_DONE_COUNT=0, TDS_DONE_ERROR=0 odbc.c:3689:odbc_process_tokens: returning result_type 4040 odbc.c:3438:_SQLExecute: odbc_process_tokens returned result_type 4040 odbc.c:4530:SQLNumResultCols(0x7fad35416630, 0x7ffee0bbf81e) odbc.c:4530:SQLNumResultCols(0x7fad35416630, 0x7ffee0bbfc8e) error_export.h:83:SQLErrorW(0x0, 0x0, 0x7fad35416630, 0x7ffee0bbe8c0, 0x7ffee0bbf3e0, 0x7fad3600b600, 512, 0x7ffee0bbf810) error_export.h:83:SQLErrorW(0x0, 0x0, 0x7fad35416630, 0x7ffee0bbe8c0, 0x7ffee0bbf3e0, 0x7fad3600b600, 512, 0x7ffee0bbf810) error_export.h:83:SQLErrorW(0x0, 0x0, 0x7fad35416630, 0x7ffee0bbe8c0, 0x7ffee0bbf3e0, 0x7fad3600b600, 512, 0x7ffee0bbf810) error_export.h:83:SQLErrorW(0x0, 0x0, 0x7fad35416630, 0x7ffee0bbe8c0, 0x7ffee0bbf3e0, 0x7fad3600b600, 512, 0x7ffee0bbf810) odbc.c:4020:SQLFetch(0x7fad35416630) odbc.c:3754:_SQLFetch(0x7fad35416630, 1, 0) token.c:554:tds_process_tokens(0x7fad356011d0, 0x7ffee0bc0374, 0x7ffee0bc0370, 0x6508) util.c:179:Changed query state from PENDING to READING token.c:569:processing result tokens. marker is d1(ROW) token.c:1951:tds_process_row(): reading column 0 data.c:719:tds_get_data: type 48, varint size 0 data.c:763:tds_get_data(): wire column size is 1 token.c:1951:tds_process_row(): reading column 1 data.c:719:tds_get_data: type 39, varint size 2 data.c:763:tds_get_data(): wire column size is 7 token.c:1951:tds_process_row(): reading column 2 data.c:719:tds_get_data: type 39, varint size 2 data.c:763:tds_get_data(): wire column size is 52 token.c:1951:tds_process_row(): reading column 3 data.c:719:tds_get_data: type 39, varint size 2 data.c:763:tds_get_data(): wire column size is 0 util.c:179:Changed query state from READING to PENDING odbc.c:3616:odbc_process_tokens: tds_process_tokens returned 0 odbc.c:3617: result_type=4040, TDS_DONE_COUNT=0, TDS_DONE_ERROR=0 odbc.c:3689:odbc_process_tokens: returning result_type 4040 odbc.c:4914:SQLGetData(0x7fad35416630, 1, 1, 0x8000008e030, 1024, 0x80000010db0) convert_tds2sql.c:293:odbc_tds2sql: src is 48 dest = 1 convert_tds2sql.c:429:odbc_tds2sql: outputting character data destlen = 1024 odbc.c:4914:SQLGetData(0x7fad35416630, 2, 1, 0x8000008f030, 1024, 0x80000010a30) convert_tds2sql.c:293:odbc_tds2sql: src is 167 dest = 1 odbc.c:4914:SQLGetData(0x7fad35416630, 3, 1, 0x80000090030, 1024, 0x80000010b30) convert_tds2sql.c:293:odbc_tds2sql: src is 231 dest = 1 odbc.c:4914:SQLGetData(0x7fad35416630, 4, 1, 0x80000091030, 1024, 0x80000010e30) convert_tds2sql.c:293:odbc_tds2sql: src is 167 dest = 1 odbc.c:4020:SQLFetch(0x7fad35416630) odbc.c:3754:_SQLFetch(0x7fad35416630, 1, 0) token.c:554:tds_process_tokens(0x7fad356011d0, 0x7ffee0bc0374, 0x7ffee0bc0370, 0x6508) util.c:179:Changed query state from PENDING to READING token.c:569:processing result tokens. marker is fd(DONE) token.c:2096:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 1 token.c:2115: rows_affected = 1 token.c:2118:tds_process_end() state set to TDS_IDLE util.c:179:Changed query state from READING to IDLE util.c:83:logic error: cannot change query state from IDLE to PENDING util.c:179:Changed query state from IDLE to IDLE odbc.c:3616:odbc_process_tokens: tds_process_tokens returned 0 odbc.c:3617: result_type=4052, TDS_DONE_COUNT=10, TDS_DONE_ERROR=0 odbc.c:3659:odbc_process_tokens: row_count=1 odbc.c:3888:SQLFetch: NO_DATA_FOUND error_export.h:83:SQLErrorW(0x0, 0x0, 0x7fad35416630, 0x7ffee0bbf1c0, 0x7ffee0bbfce0, 0x7fad3600b600, 512, 0x7ffee0bc0110) odbc.c:4248:SQLFreeStmt(0x7fad35416630, 2) odbc.c:4165:_SQLFreeStmt(0x7fad35416630, 2, 0) odbc.c:4248:SQLFreeStmt(0x7fad35416630, 0) odbc.c:4165:_SQLFreeStmt(0x7fad35416630, 0, 0) From sf at 4js.com Fri Aug 28 11:43:12 2020 From: sf at 4js.com (Sebastien FLAESCH) Date: Fri, 28 Aug 2020 17:43:12 +0200 Subject: [freetds] SQL Server 2019: CHAR(N) using UTF-8 is seen as SQL_NVARCHAR by SQLDescribeCol() In-Reply-To: References: <1609207a-0a70-5c44-cfd4-4dcbdf14dd37@4js.com> <4110fdf8-6ea9-c671-1d14-4176342c59f8@4js.com> <46ec34f9-2eca-4bc1-11d8-a2268fb3181a@4js.com> Message-ID: Hello! What is the status of UTF-8 support for CHAR/VARCHAR columns in SQL Server 2019 when using a _UTF8 DB collation? I have now FreeTDS 1.2.3 installed ... Here my ODBC datasource: [ftm_msvtest1_lison2_utf8_2019] Description = SQL Server 2019 Server = lison2 Database = msvtest1 Port = 1433 TDS_Version = 7.4 ClientCharset = UTF-8 My application C locale (my strings are in UTF-8): $ locale LANG= LANGUAGE= LC_CTYPE="en_US.utf8" LC_NUMERIC="en_US.utf8" LC_TIME="en_US.utf8" LC_COLLATE="en_US.utf8" LC_MONETARY="en_US.utf8" LC_MESSAGES="en_US.utf8" LC_PAPER="en_US.utf8" LC_NAME="en_US.utf8" LC_ADDRESS="en_US.utf8" LC_TELEPHONE="en_US.utf8" LC_MEASUREMENT="en_US.utf8" LC_IDENTIFICATION="en_US.utf8" LC_ALL=en_US.utf8 A) When fetching a CHAR(n) column, SQLDescribeCol() still returns sqltype -9 which is SQL_WVARCHAR, when I expect to get 1 / SQL_CHAR ... (See previous emails about this) B) When I try to insert UTF-8 data, I get this error: (-9833) [FreeTDS][SQL Server]Invalid data for UTF8-encoded characters I am binding my string buffers with SQL_VARCHAR / SQL_C_CHAR and provide directly UTF-8 data, as I do when using ISO-8859-15 locale. When binding with SQL_WVARCHAR it's better but I can see on the SQL Profiler that string parameters are passed as exec sp_executesql ... '... @px NVARCHAR', ...N'???' But the goal in my opinion is to have the whole chain using UTF-8: app string in UTF-8 <=> TDS protocol using UTF-8 <=> DB column in UTF-8 And thus avoid any charset conversion. When using a ISO-8859-15 client config with ClientCharset = ISO-8859-15 And my application strings in ISO-8859-15 and LC_ALL=en_US.iso885915, I still get the error: (-9833) [FreeTDS][SQL Server]Invalid data for UTF8-encoded characters ? Seb On 2/28/19 7:03 PM, Frediano Ziglio wrote: > Fine, it's the not still documented extension 10. If set to 1 (1 byte) > data are returned as UTF-8. > I don't know what extension 9 is but 10 is enough. > The collation has a weird bit set if the encoding is UTF-8. > > Frediano > > Il giorno gio 28 feb 2019 alle ore 14:22 Frediano Ziglio > ha scritto: >> >> Hi, >> there seems to be 2 new "feature" (it's like capabilities for TDS >> 7.4), 9 and 10, the relative ack values are 0x0101 and 0x01, client is >> sending 0x01 for both. >> Currently not documented in TDS protocol specification >> (https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/b46a581a-39de-4745-b076-ec4dbb7d13ec). >> The protocol version is still 7.4. >> I suppose I can try to send these feature extensions and see what >> happens, if server changes the encoding. >> >> Frediano >> >> Il giorno gio 28 feb 2019 alle ore 10:56 Frediano Ziglio >> ha scritto: >>> >>> Hi, >>> so, installed a sql 2019 and tried some queries. >>> Using the driver provided inside the docker image the "abc" is >>> returned as "abc ", so >>> the CHAR(10) are returned encoded in UTF-8 and the "10" is just the >>> number of bytes. >>> Now, why the server decided to return UTF-8 and not convert to NVARCHAR (which >>> make sense to me for old clients) it's the issue. Maybe they bump the >>> protocol version, >>> maybe they are using some other flags/version (like client version >>> passes through >>> the pre-login). Unfortunately the login is encrypted so I'll have to >>> dig a bit more (well, >>> just question of setup and use the bounce utility, not sure if it >>> supports pre-login). >>> >>> Frediano >>> >>> Il giorno gio 28 feb 2019 alle ore 10:50 Sebastien FLAESCH >>> ha scritto: >>>> >>>> Hello Craig, >>>> >>>> I don't think so: An ODBC program should be able to properly identify >>>> (as much as possible) the original database type used for a column. >>>> >>>> We must also distinguish the concept of "variable length" regarding the >>>> number of bytes used to encode characters, versus the actual length of >>>> the string in character units. >>>> >>>> Plus the fact that [N]CHAR columns can be blank-padded, while [N]VARCHAR >>>> columns are not and store the actual number of trailing white spaces of >>>> the string, try for ex: >>>> >>>> create table tab1 ( c1 char(10), c2 varchar(10) ) >>>> insert into tab1 values ( 'abc', 'abc ' ) >>>> select '['+c1+']', '['+c2+']' from tab1 >>>> >>>> You will see: >>>> >>>> [abc ] [abc ] >>>> >>>> (check SET ANSI_PADDING ON/OFF) >>>> >>>> ... >>>> >>>> UTF-8 is a variable-width encoding: >>>> >>>> a => needs 1 byte >>>> ? => needs 2 bytes >>>> ? => needs 3 bytes >>>> ... etc (there can be more than 3 bytes) >>>> >>>> In that context, one can see a "variable length" in byte units... >>>> >>>> But when counting in characters, 'a??' is 3 characters, no matter the >>>> encoding used to store this string. >>>> >>>> You have also the concept of byte-length semantics versus char-length >>>> semantics: When creating a CHAR(10) is this 10 bytes or 10 characters? >>>> Depending on the database brand, it's bytes (SQL Server), characters >>>> (PostgreSQL), or it can even be a mix and specified explicitly (like >>>> in Oracle DB). >>>> >>>> Note: You have then also the concept of "width" or "number of columns": >>>> A latin character takes one column, while an Asian logogram takes 2. >>>> See wcwidth() for more details. >>>> >>>> ... >>>> >>>> In SQL Server, NCHAR and NVARCHAR can store UTF-16 when the SC modifier >>>> is used in the database collation (they store UCS-2 when no SC is used) >>>> >>>> In UTF-16, a first range of characters are encoded on 2 bytes, but you >>>> can have "surrogate pairs" encoded on 4 bytes (two 16-bit code units). >>>> >>>> In your logic, the NCHAR/UTF-16 type could also be considered as a >>>> "variable length" type and SQLDecribeCol() could return SQL_WVARCHAR >>>> instead of SQL_WCHAR... It must not and does not. >>>> >>>> Cheers, >>>> Seb >>>> >>>> >>>> On 2/27/19 4:32 PM, Craig Jackson wrote: >>>>> I don't know anything about SQL Server 2019, but if they added the option >>>>> to allow UTF-8 encoding of character strings, it would seem natural that >>>>> said strings would be variable-length, even if declared CHAR(n). Strings >>>>> encoded in UTF-8 are inherently variable length. >>>>> >>>>> Craig Jackson >>>>> >>>>> On Wed, Feb 27, 2019 at 10:27 AM Sebastien FLAESCH wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> Just tried with TDS 7.4, it did not help. >>>>>> >>>>>> I have tested the MS ODBC driver 17.3.1.1, it works as expected >>>>>> ( I get 1/SQL_CHAR from SQLDescribeCol() ) >>>>>> >>>>>> You may know that it's very easy to setup an SQL Server 2019 with >>>>>> docker, do you? >>>>>> >>>>>> Cheers, >>>>>> Seb >>>>>> >>>>>> On 2/27/19 3:08 PM, Frediano Ziglio wrote: >>>>>>> Hi, >>>>>>> I would try to use TDS 7.4, not 7.3. >>>>>>> Also I would try to use Microsoft ODBC driver and a network analyzer >>>>>>> (like wireshark). >>>>>>> >>>>>>> Regards, >>>>>>> Frediano >>>>>>> >>>>>>> Il giorno mar 26 feb 2019 alle ore 11:26 Sebastien FLAESCH >>>>>>> ha scritto: >>>>>>>> >>>>>>>> Testing FreeTDS 1.1rc3 with SQL Server 2019: >>>>>>>> >>>>>>>> I get an unexpected SQL type code with a CHAR(10) column, when the >>>>>>>> database collation is using UTF-8. >>>>>>>> >>>>>>>> Instead of SQL_CHAR (or SQL_WCHAR), I get SQL_WVARCHAR. >>>>>>>> >>>>>>>> I have created a database with this collation: >>>>>>>> >>>>>>>> Latin1_General_100_CI_AS_SC_UTF8 >>>>>>>> >>>>>>>> Then created a table like this: >>>>>>>> >>>>>>>> CREATE TABLE mytab1 ( col1 CHAR(10) ) >>>>>>>> >>>>>>>> and inserted a row: >>>>>>>> >>>>>>>> INSERT INTO mytab1 VALUES ( 'abc' ) >>>>>>>> >>>>>>>> Then in the ODBC program: >>>>>>>> >>>>>>>> SQLExecDirect(.."SELECT * FROM mytab1"..) >>>>>>>> SQLDescribCol(...) >>>>>>>> >>>>>>>> Check the TDSDUMP trace in attachment (freetds-2019-1.log) >>>>>>>> >>>>>>>> token.c:1541:tds7_get_data_info: >>>>>>>> colname = col1 >>>>>>>> type = 39 (varchar) >>>>>>>> server's type = 231 (x UCS-2 varchar) <-- 231 ? >>>>>>>> column_varint_size = 2 >>>>>>>> column_size = 20 (20 on server) >>>>>>>> >>>>>>>> >>>>>>>> The same program, connecting to SQL Server 2017 (were DB collation is >>>>>> Latin1 >>>>>>>> without UTF-8): >>>>>>>> >>>>>>>> >>>>>>>> token.c:1541:tds7_get_data_info: >>>>>>>> colname = col1 >>>>>>>> type = 47 (char) >>>>>>>> server's type = 175 (xchar) <-- 175 >>>>>>>> column_varint_size = 2 >>>>>>>> column_size = 10 (10 on server) >>>>>>>> >>>>>>>> With SQL Server 2019, when using another collation (non-UTF-8) >>>>>>>> >>>>>>>> CREATE TABLE mytab2 ( col1 CHAR(10) COLLATE Latin1_General_CI_AS ) >>>>>>>> >>>>>>>> I get the expected tds type code... >>>>>>>> >>>>>>>> Seb >>>>>>>> _______________________________________________ >>>>>>>> FreeTDS mailing list >>>>>>>> FreeTDS at lists.ibiblio.org >>>>>>>> https://lists.ibiblio.org/mailman/listinfo/freetds >>>>>>> _______________________________________________ >>>>>>> FreeTDS mailing list >>>>>>> FreeTDS at lists.ibiblio.org >>>>>>> https://lists.ibiblio.org/mailman/listinfo/freetds >>>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> FreeTDS mailing list >>>>>> FreeTDS at lists.ibiblio.org >>>>>> https://lists.ibiblio.org/mailman/listinfo/freetds >>>>>> >>>>> _______________________________________________ >>>>> FreeTDS mailing list >>>>> FreeTDS at lists.ibiblio.org >>>>> https://lists.ibiblio.org/mailman/listinfo/freetds >>>>> >>>> >>>> _______________________________________________ >>>> FreeTDS mailing list >>>> FreeTDS at lists.ibiblio.org >>>> https://lists.ibiblio.org/mailman/listinfo/freetds > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > https://lists.ibiblio.org/mailman/listinfo/freetds >