tdbc::odbc

Check-in [757c1c7919]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix endless loop bug. In my tests, sqlreturn is first 0, then -1.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tdbcodbc-stwo
Files: files | file ages | folders
SHA1: 757c1c7919c6d1ed31ef0935140794832a3cf5a4
User & Date: stwo 2017-05-16 12:21:39
Original User & Date: stu 2017-05-16 12:21:39
Context
2017-05-17
14:03
Add iodbc. check-in: ecf668745d user: stwo tags: tdbcodbc-stwo
2017-05-16
12:21
Fix endless loop bug. In my tests, sqlreturn is first 0, then -1. check-in: 757c1c7919 user: stwo tags: tdbcodbc-stwo
2017-05-04
19:07
TEA_INIT required bump to TEA 3.10 as well. check-in: a0030f73db user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tdbcodbc.c.

862
863
864
865
866
867
868


869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
    SQLSMALLINT i;		/* Loop index for going through diagnostics */
    const char* sep = "";	/* Separator string for messages */
    const char* sqlstate;	/* SQL state */
    Tcl_Obj* resultObj;		/* Result string containing error message */
    Tcl_Obj* codeObj;		/* Error code object */
    Tcl_Obj* lineObj;		/* Object holding one diagnostic */
    Tcl_DString bufferDS;	/* Buffer for transferring messages */



    resultObj = Tcl_NewObj();
    codeObj = Tcl_NewStringObj("TDBC", -1);

    /* Loop through the diagnostics */

    i = 1;
    while (SQLGetDiagRecW(handleType, handle, i, state, &nativeError,
			  msg, SQL_MAX_MESSAGE_LENGTH, &msgLen)
	   != SQL_NO_DATA) {

	/* Add the diagnostic to ::errorCode */

	Tcl_DStringInit(&bufferDS);
	DStringAppendWChars(&bufferDS, state, 5);
	sqlstate = Tcl_DStringValue(&bufferDS);
	lineObj = Tcl_NewStringObj(sqlstate, Tcl_DStringLength(&bufferDS));






>
>







|
|
|







862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
    SQLSMALLINT i;		/* Loop index for going through diagnostics */
    const char* sep = "";	/* Separator string for messages */
    const char* sqlstate;	/* SQL state */
    Tcl_Obj* resultObj;		/* Result string containing error message */
    Tcl_Obj* codeObj;		/* Error code object */
    Tcl_Obj* lineObj;		/* Object holding one diagnostic */
    Tcl_DString bufferDS;	/* Buffer for transferring messages */

    SQLRETURN sqlreturn;

    resultObj = Tcl_NewObj();
    codeObj = Tcl_NewStringObj("TDBC", -1);

    /* Loop through the diagnostics */

    i = 1;
    while ((sqlreturn = SQLGetDiagRecW(handleType, handle, i, state, &nativeError,
				       msg, SQL_MAX_MESSAGE_LENGTH, &msgLen))
	   != SQL_NO_DATA && sqlreturn >= 0) {

	/* Add the diagnostic to ::errorCode */

	Tcl_DStringInit(&bufferDS);
	DStringAppendWChars(&bufferDS, state, 5);
	sqlstate = Tcl_DStringValue(&bufferDS);
	lineObj = Tcl_NewStringObj(sqlstate, Tcl_DStringLength(&bufferDS));