Re: Invalid Cursor State By SELECT after INSERT

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
John Mazza wrote:
> odbc.c:3021:_SQLExecute(0xa096b60)
> odbc.c:3026:_SQLExecute() starting with state 2
> error.c:609:SQLGetDiagRec(3, 0xa096b60, 1, 0xbf96441e, 0xbf96442c,
> 0xbf96421e, 512, 0xbf964428)
> error.c:512:_SQLGetDiagRec(3, 0xa096b60, 1, 0xbf96441e, 0xbf96442c,
> 0xbf96421e, 512, 0xbf964428)
> error.c:609:SQLGetDiagRec(3, 0xa096b60, 2, 0xbf96441e, 0xbf96442c,
> 0xbf96421e, 512, 0xbf964428)
> error.c:512:_SQLGetDiagRec(3, 0xa096b60, 2, 0xbf96441e, 0xbf96442c,
> 0xbf96421e, 512, 0xbf964428)
> error.c:609:SQLGetDiagRec(3, 0xa096b60, 1, 0x121c48, 0xbf964788,
> 0x1293b8, 0, 0xbf964784)
> error.c:512:_SQLGetDiagRec(3, 0xa096b60, 1, 0x121c48, 0xbf964788,
> 0x1293b8, 0, 0xbf964784)
> error.c:609:SQLGetDiagRec(3, 0xa096b60, 1, 0x121c48, 0xbf964788,
> 0x186428, 42, 0xbf964784)
> error.c:512:_SQLGetDiagRec(3, 0xa096b60, 1, 0x121c48, 0xbf964788,
> 0x186428, 42, 0xbf964784)
> error.c:609:SQLGetDiagRec(3, 0xa096b60, 1, 0x121c48, 0xbf964788,
> 0x186428, 0, 0xbf964784)
> error.c:512:_SQLGetDiagRec(3, 0xa096b60, 1, 0x121c48, 0xbf964788,
> 0x186428, 0, 0xbf964784)
> error.c:609:SQLGetDiagRec(3, 0xa096b60, 1, 0x121c48, 0xbf964788,
> 0x186428, 42, 0xbf964784)
> error.c:512:_SQLGetDiagRec(3, 0xa096b60, 1, 0x121c48, 0xbf964788,
> 0x186428, 42, 0xbf964784)
> error.c:609:SQLGetDiagRec(3, 0xa096b60, 2, 0x121c48, 0xbf964788,
> 0x186428, 0, 0xbf964784)
> error.c:512:_SQLGetDiagRec(3, 0xa096b60, 2, 0x121c48, 0xbf964788,
> 0x186428, 0, 0xbf964784)
> odbc.c:3764:SQLFreeHandle(3, 0x0xa096b60)
> odbc.c:3853:_SQLFreeStmt(0xa096b60, 1, 0)
> odbc.c:3932:SQLFreeStmt(0xa0aaa70, 0)
> odbc.c:3853:_SQLFreeStmt(0xa0aaa70, 0, 0)
> query.c:1935:tds_send_cancel: not in_cancel and not idle
> query.c:1944:tds_send_cancel: sending cancel packet

That doesn't look very good.  

There are two diagnostic records.  I guess one says the cursor state is
invalid.  What does the other one say?  

Attached is a patch that will print the diagnostic text to the TDSDUMP
log. Or you can fetch tomorrow's snapshot.  

--jkl

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
clearer_errors.diff (application/octet-stream, 1.4 KB)
Index: src/odbc/error.c
===================================================================
RCS file: /cvsroot/freetds/freetds/src/odbc/error.c,v
retrieving revision 1.52
diff -u -r1.52 error.c
--- src/odbc/error.c	7 May 2008 08:42:30 -0000	1.52
+++ src/odbc/error.c	23 Jul 2008 19:58:34 -0000
@@ -509,9 +509,6 @@
 	SQLINTEGER odbc_ver = SQL_OV_ODBC2;
 	SQLHANDLE parent;
 
-	tdsdump_log(TDS_DBG_FUNC, "_SQLGetDiagRec(%d, %p, %d, %p, %p, %p, %d, %p)\n", 
-			handleType, handle, numRecord, szSqlState, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
-
 	if (numRecord <= 0 || cbErrorMsgMax < 0)
 		return SQL_ERROR;
 
@@ -559,6 +556,9 @@
 
 	if (asprintf(&p, "%s%s", msgprefix, msg) < 0)
 		return SQL_ERROR;
+
+	tdsdump_log(TDS_DBG_FUNC, "_SQLError: \"%s\"\n", p);
+
 	result = odbc_set_string(szErrorMsg, cbErrorMsgMax, pcbErrorMsg, p, -1);
 	free(p);
 
Index: src/odbc/odbc.c
===================================================================
RCS file: /cvsroot/freetds/freetds/src/odbc/odbc.c,v
retrieving revision 1.485
diff -u -r1.485 odbc.c
--- src/odbc/odbc.c	14 Jul 2008 15:12:42 -0000	1.485
+++ src/odbc/odbc.c	23 Jul 2008 19:58:35 -0000
@@ -3998,9 +3998,6 @@
 
 	INIT_HSTMT;
 
-	tdsdump_log(TDS_DBG_FUNC, "_SQLGetStmtAttr(%p, %d, %p, %d, %p)\n", 
-			hstmt, (int)Attribute, Value, (int)BufferLength, StringLength);
-
 	/* TODO assign directly, use macro for size */
 	switch (Attribute) {
 	case SQL_ATTR_APP_PARAM_DESC:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.