Hi,

firstly thanks for your answer, [EMAIL PROTECTED] works very very well !

We are doing a very hard work with mySQL , used as main database inside
our ERP Oasi. (instead of DB2 or ORACLE).

We have a performance problem with memory usage.

the process accesses to database via ODBC (iodbc2-12+myodbc2.50.22) and all
seems to be OK, except for the memory usage.

We have a table with 1,5 millions of record that a client program needs to
scan and the client process size grows up because it reserves memory to store
rows.

do_query(), inside execute.c calls mysql_store_result(), and in this way all
the data is transefferd to the client.

I tryed to uncomment the portion of the code above in execute.c having:

.............................................................................
................................ if (stmt_options.cursor_type ==
 SQL_CURSOR_FORWARD_ONLY)
    stmt->result=mysql_use_result(&stmt->dbc->mysql);
  else
     stmt->result=mysql_store_result(&stmt->dbc->mysql);
.............................................................................
................................

and I have set  the correct option before the SQLPrepare() statement:

SQLSetStmtOption(vst->startHstmt,SQL_CURSOR_TYPE,SQL_CURSOR_FORWARD_ONLY);

I don't need the scrolled cursor, so in this way the driver calls
mysql_use_result saving a lot of memory.

It works, but when I execute another query, building a different statement,
with or without setting the statement option for the cursor type, (note that
the code perform another SQLAllocStatement()), i got this error:

-----------------------
SQL error              : -1
line number            : 107
SQL state              : S1000
native error code      : 2014
[TCX][MyODBC]Commands out of sync;  You can't run this command now

the query is:

           [select * from archcont where codcon = ?]

archcont is another table, a little one.

I know that the comment in execute.c says:
/* We can't use USE_RESULT because SQLRowCount will fail in this case! */

but i don't need to use SQLRowCount  when i set  the cursor type as
SQL_CURSOR_FORWARD_ONLY, of course.

Anyway, if there is another method to save memory, please let me know how
I can do it, without change my code (if it is possible).

Regards

marcello
------------------------------------------------
marcello giovagnoli
Logical System s.r.l.
Via Rocco Scotellaro 23
60035 JESI AN
ITALY
e-mail: [EMAIL PROTECTED]

-------------------------------------------------------

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to