[Dev-C++] SQL "SELECT COUNT(*)" loads whole table into memory
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ed C. <em...@to...> - 2004-01-02 06:57:49
|
Hi all, =20 Not technically a Dev-Cpp question, but I'm hoping somebody can help, anyway. I'm working with an ODBC driver for Visual FoxPro 6 (as well as = ODBC drivers for several other RDBMSs). My application is supposed to loop through a list of tables, run the single SQL statement "SELECT COUNT(*) = FROM tblname", get the result, then move on. At the end, I go back and tally = all the row counts. =20 In the process, I am simply reusing all my handles (environment, connections, and recordsets), calling SQLGetData and SQLCloseCursor = after each query. =20 Now, here's the problem: even though I'm just doing SELECT COUNT(*), the entire table is getting loaded into memory. My application's memory = usage goes from 6 MB to 100 +, though if I comment out just the FoxPro = database interaction, it stays around 8 MB, where I would expect it to be. The = logic and coding I'm doing for the FoxPro queries is absolutely identical to = the logic I'm using on the other databases, except, of course, for the connection string, and I'm not having this problem with the other = systems. I should also point out that removing some of the larger tables from the = list of tables to check results in an almost perfectly corresponding drop in = RAM usage. =20 For what it's worth, doing the same query directly from Visual FoxPro 6 results in a RAM spike under 1 KB. =20 Anybody know what's wrong? Is there a driver setting I need to use or something? =20 Thanks! =20 -Ed |