Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BatchUpdateCount in CursorAdapter causes memory-leak
Message
De
17/02/2004 09:55:08
Reno Fiedermutz
Smartstream Technologies
Vienna, Autriche
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
BatchUpdateCount in CursorAdapter causes memory-leak
Divers
Thread ID:
00877926
Message ID:
00877926
Vues:
79
Whenever I use the property BatchUpdateCount for what it was intended - collect several SQL-Statements to send them as one single batchcommand to the server (SQLServer) - VFP executes fine, but never again and by no means releases the memory it allocated for the execution. Dealing with some millions of rows, VFP rather prefers to crash then to release the memory allocated.
Does anyone have similar experiences with BatchUpdateCount > 1 against SQL Server via ODBC?

I'm posting a sample code which assumes a table testtable in SQL Server with the fields one (primary),two,three, all integer:

LOCAL oCursorAdapter as CursorAdapter, cConnectionString as String

cConnectionString = "driver=SQL Server;server=lb-et-1;database=testdb;uid=sa;pwd=xxx;trusted_connection=no;"
* Shared connection to the DB
nHandle = SQLSTRINGCONNECT(cConnectionString,.T.)

oCursorAdapter = NEWOBJECT("CursorAdapter")
WITH oCursorAdapter
.Alias = "testcursor"
.DataSource = nHandle
.DataSourceType = "ODBC"
.SelectCmd = "SELECT one,two,three from testtable"
.Tables = "testtable"
.KeyFieldList = "one"
.UpdatableFieldList = "two,three"
.UpdateNameList = "one testtable.one,two testtable.two,three testtable.three"
.BufferModeOverride = 5
.FetchAsNeeded = .T.
.AllowDelete = .T.
.AllowInsert = .T.
.AllowUpdate = .T.
.BatchUpdateCount = 50
.FetchSize = -1
.SendUpdates = .T.
.WhereType = 1
ENDWITH

IF oCursorAdapter.CursorFill ()
SELECT testcursor
* do something with the data, so there will result some update-candidates
REPLACE ALL two WITH two + 1
REPLACE ALL three WITH three - 1
?SYS(1016) && memory before
TABLEUPDATE(.T.)
ELSE
LOCAL ARRAY aErrors[1]
AERROR(aErrors)
ENDIF
SQLDISCONNECT(nHandle)
RELEASE oCursorAdapter
CLOSE ALL
CLEAR all
?SYS(1016) && memory after: VFP did not deallocate and will not do it in subsequent executions
Répondre
Fil
Voir

Click here to load this message in the networking platform