Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shared connection problem
Message
From
08/10/2003 13:38:33
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Shared connection problem
Miscellaneous
Thread ID:
00836358
Message ID:
00836358
Views:
58
Hi,

VFP8 sp1 have fixed the problem with Asyncronous download.
Very well!

But now i found this problem.
If i open a asyncronous Statement on a Shared connection, and
this exec a download that busy the connection,
other Statement on this connection not see this busy status, but
if a sqlexec is done on this, a ODBC SQL error message is return,
and this report a busy connection status.

repro code
CLEAR
h1=SQLSTRINGCONNECT('Driver={SQL Server};Network=DBNETLIB;SERVER=Server;DATABASE=G1;Trusted_Connection=Yes',.T.)

CURSORSETPROP("FetchSize",1,0)
CURSORSETPROP("FetchAsNeeded",.T.,0)
CURSORSETPROP("AllowSimultaneousFetch",.F.,0)
TEXT TO cmd NOSHOW
CREATE TABLE #T1 (id INT)
DECLARE @id INT
SET @id=0
WHILE @id<100000
	BEGIN
		INSERT #T1 VALUES (@id)
		SET @id=@id+1
	END
ENDTEXT
? 'Build Temporary Table ....'
IF SQLEXEC(m.h1,m.cmd)=1	AND SQLSETPROP(m.h1,"Asynchronous",.T.)=1
	T1=SECONDS()
	? 'Exec StatementBusy 1 ..... '
	IF SQLEXEC(m.h1,'SELECT id FROM #T1','C1')#-1
		?? 'Wait ...'
		DO WHILE !USED('C1') AND SQLEXEC(m.h1)=0 AND INKEY(0.1)=0
		ENDDO
		?? 'Build Cursor in ',SECONDS()-M.T1
		? ' Connection 1 of StatementBusy is Busy ',SQLGETPROP(m.h1,"ConnectBusy")
		h2=SQLCONNECT(m.h1)
		? 'ASYNCRONOUS StatementBusy 2 ',SQLGETPROP(m.h2,"Asynchronous")
		? 'Exec StatementBusy 2 ..........'
		IF !SQLGETPROP(m.h2,"ConnectBusy")
			T1=SECONDS()
			IF SQLEXEC(m.h2,'SELECT id FROM #T1','C2')<0
				? MESSAGE()
				? 'But connection of StatementBusy 2 is Busy :',SQLGETPROP(m.h2,"ConnectBusy") 
				&& name is connectBusy, not StatementBusy then it must to be .T.
			ELSE
				?? 'Wait ...'
				DO WHILE !USED('C2') AND SQLEXEC(m.h2)=0 AND INKEY(0.1)=0
				ENDDO
				?? 'Build Cursor 2 in ',SECONDS()-M.T1
			ENDIF
			RETURN
		ENDIF
		SQLCANCEL(m.h2)
		SQLDISCONNECT(m.h2)
		RETURN
	ENDIF
ENDIF
SQLCANCEL(m.h1)
SQLDISCONNECT(m.h1)
Then the solutions are two:
- monitor shared connection status with VFP language
- exec the SQLEXEC() and catch the error

Fabio
Next
Reply
Map
View

Click here to load this message in the networking platform