Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Locate method rises an insufficient memory error message



Permlink Replies: 4 - Last Post: Feb 19, 2015 1:41 AM Last Post By: Vladimir Ulchenko
Patricio Cerda

Posts: 122
Registered: 3/13/01
Locate method rises an insufficient memory error message
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 11, 2015 9:27 AM
Hi,

I have a DataSnap application that works well in many aspects but now that I want to locate a specific record based on one index field, the Locate() method fails always with following error message: "Insuficient memory for this operation". I'm using C++ Builder XE5 and dbExpress TSQLDataSet component. This is the specific code that shows the error message:
...
else if(true == CDS_DTH_Ventas_Terreno->Locate("ID_SISGAV", UltimoLOG, OpcionesDeBusqueda))
...

Here, CDS_DTH_Ventas_Terreno is a ClientDataSet that is linked with a TDataSetProvider and then with a TSQLDataSet that has following CommandText: "select * from dbo.DTH_Ventas order by ID_SISGAV desc". The 'dbo.DTH_Ventas' points to an MS-SQLServer table through a TSQLConnection component, and this table has about 200 thousand records, but there are other piece of code where I'm doing the same process over another table with similar quantity of records and works well.

Any idea about what parameter or property could be wrong?

Best regards,
Patricio Cerda
Patricio Cerda

Posts: 122
Registered: 3/13/01
Re: Locate method rises an insufficient memory error message
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 12, 2015 6:17 AM   in response to: Patricio Cerda in response to: Patricio Cerda
I have a DataSnap application that works well in many aspects but now that I want to locate a specific record based on one index field, the Locate() method fails always with following error message: "Insuficient memory for this operation". I'm using C++ Builder XE5 and dbExpress TSQLDataSet component. This is the specific code that shows the error message:
...
else if(true == CDS_DTH_Ventas_Terreno->Locate("ID_SISGAV", UltimoLOG, OpcionesDeBusqueda))
...

Here, CDS_DTH_Ventas_Terreno is a ClientDataSet that is linked with a TDataSetProvider and then with a TSQLDataSet that has following
CommandText: "select * from dbo.DTH_Ventas order by ID_SISGAV desc". The 'dbo.DTH_Ventas' points to an MS-SQLServer table through a TSQLConnection component, and this table has about 200 thousand records, but there are other piece of code where I'm doing the same process over another table with similar quantity of records and works well.

Another related problem is that also Last() method results on this error message, that is an exception class EDBClient kind of error message. The query that I'm using has a 'desc' order, but if I change it by 'asc' order then I need to move the cursos to the last record, but then I have the same exception class EDBClient error message: 'Insufficient memory for this operation.'

The MS-SQLServer tabla appear to be ok and has the 'ID_SISGAV' field defined as PrimaryKey. More over, I could access and execute query's to this table using RapidSQL without any problem. I can't find what is wrong. Any help?

Best regards,
Patricio Cerda
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Locate method rises an insufficient memory error message
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 12, 2015 10:06 PM   in response to: Patricio Cerda in response to: Patricio Cerda
On Wed, 11 Feb 2015 09:27:35 -0800, Patricio Cerda <> wrote:

Any idea about what parameter or property could be wrong?

locate utilizes sequential access (full scan) of the underlying dataset so its entire content is going to be fetched

--
Vladimir Ulchenko aka vavan
Patricio Cerda

Posts: 122
Registered: 3/13/01
Re: Locate method rises an insufficient memory error message
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 18, 2015 5:32 PM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Thanks Vladimir for your comment.

locate utilizes sequential access (full scan) of the underlying dataset so its entire content is going to be fetched

I'm using DataSnap and the PacketRecords property of TClientDataSet component, that points to TDataSetProvider and to TSQLDataSet, to reduce the quantity of records that are fetched. Do you say that Locate method don't consider this property? How can I find a specific record more efficiently?

Best regards,
Patricio Cerda
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Locate method rises an insufficient memory error message
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 19, 2015 1:41 AM   in response to: Patricio Cerda in response to: Patricio Cerda
On Wed, 18 Feb 2015 17:32:02 -0800, Patricio Cerda <> wrote:

I'm using DataSnap and the PacketRecords property of TClientDataSet component, that points to TDataSetProvider and to TSQLDataSet, to reduce the quantity of records that are fetched. Do you say that Locate method don't consider this property?

right, there are many CDS methods forcing it to fetch the entire rowset
see CheckProviderEOF in dbclient.pas to get the idea

How can I find a specific record more efficiently?

that depends on the task and the design of your app

for example you could simply use separated stored procedure/query checking for existence of specific record or implement some kind of
incremental fetching adding that specific record to the target CDS

--
Vladimir Ulchenko aka vavan
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02