Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Again, troubles with CursorAdapter
Message
De
16/08/2003 18:02:38
 
 
À
16/08/2003 17:15:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00819734
Message ID:
00820835
Vues:
52
>>Note If you execute SQLDISCONNECT( ) within an asynchronous function sequence or during a transaction, SQLDISCONNECT( ) generates an error.
>>
>>
>>According to this, current behavior SQLDisconnect() behavior is a legitimate BUG and, I assume, that it is not likely anyone relied on it. However, the fix I am thinking of is to force rollback rather than do nothing or generate an error.
>
>Doesn't this depend on SQLSetProp(n, "DisplayWarnings", .t.)
>
>BOb

Hi Bob,

No, this setting doesn't make any difference:
CLOSE DATABASES all
CLEAR
?VERSION()

con=SQLCONNECT("LocalServer") && point to any available SQL Server

IF con<1
	? "FAILED to connect!!!"
	RETURN
ENDIF

?[SQLGetProp(con, "DispWarnings")],SQLGetProp(con, "DispWarnings")

cConnString=SQLGETPROP(con,"ConnectString")

SQLEXEC(con,"SET ANSI_PADDING ON")
SQLEXEC(con,"DROP table testtransaction3")
SQLEXEC(con,"create table testtransaction3 (f1 int, f2 char(10))")



SQLSETPROP(con,"Transactions",2)
SQLEXEC(con,"insert into testtransaction3 values(1,'11111')")
SQLEXEC(con,"select @@TRANCOUNT as count", "trancount")
? "Current trancount:",trancount.count
*SQLROLLBACK(con) && <==== uncomment this line to see the difference

SQLSetProp(con, "DispWarnings", .T.)
?[SQLGetProp(con, "DispWarnings")],SQLGetProp(con, "DispWarnings")

? "Connection is disconnected!"
?[SQLDISCONNECT(con)=],SQLDISCONNECT(con)

?
con=SQLSTRINGCONNECT(cConnString)
? "Connect again and query data"
SQLEXEC(con,"select * from testtransaction3","currentstate")
SELECT currentstate
LIST
?[RECCOUNT()],RECCOUNT()

SQLEXEC(con,"DROP table testtransaction3")
SQLDISCONNECT(0)
VFP output:
Visual FoxPro 08.00.0000.2521 for Windows
SQLGetProp(con, "DispWarnings") .F.
Current trancount:           1
SQLGetProp(con, "DispWarnings") .T.
Connection is disconnected!
SQLDISCONNECT(con)=          1

Connect again and query data
Record#           F1 F2        
      1            1 11111     

RECCOUNT()          1
Thanks,
Aleksey.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform