PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com _____________________________________________________________
Thanks, Mark, it works well like that, I put my statement variable as global, which is not very clean, but efficient. With just one newStatement in the program, everything is OK.
Before I tried that, I tried to close the Connection object periodically, which is supposed to close the connection and invalidate all other objects (like statements) attached to it. After about 60 calls, it stopped, ODBC trace telling that too many client tesks were running. Moreover, I didn't see any close connection on my trace. Does this Connection.Close function work well, question which is very important in entreprise production environments ?
Thanks again.
Mikael LAUSSEUR Aalto Consultant FRANCE
Mark Storer wrote:
PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com _____________________________________________________________
It doesn't look like you CAN close a statement. You could close the connection periodically (I don't recommend it), but statements don't have a 'close', nor can any of the other ADBC objects close a statement for you.
However, there's really no reason to have more than one at a time. Make the statement a parameter to your recursive function. You'll also need to take care not to invalidate your Statement object.
Your current code:
function RecursiveFct(...) {
ordreCLVar = connCLVar.newStatement();
ordreCLVar.execute(ordsqlVar);
while (...) {
enr = ordreCLVar.getRow();
... call to the same recursive function RecursiveFct(...) ...
}
When one iteration of your recursive function returned, a shared statement would have been altered.
You'd have to do something more like:
// get all the rows var enr = new Array(0); // empty array, we'll be adding to it as we go var len = 0; while(...) { len = enr.push( ordreCLVar.getRow() ); // append the row object }
// we're now done with the statement object, so we can pass it on
// act on the rows recursively for(var i = 0; i < len; ++i) { ... call to the same recursive function ... }
--Mark Storer Software Engineer Cardiff Software #include <disclaimer> typdef std::disclaimer<Cardiff> Discard;
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Aalto Public Sent: Wednesday, January 21, 2004 3:00 AM To: PDF Zone Subject: [PDFdev] How to close a Javascript statement ?
PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com _____________________________________________________________
Hi,
I have a recursive Javscript function (Acrobat 6.0 pro, Windows XP) which creates a new SQL statement in each function call, with ADBC on an Access database :
function RecursiveFct(...) { ordreCLVar = connCLVar.newStatement(); ordreCLVar.execute(ordsqlVar); while (...) { enr = ordreCLVar.getRow(); ... call to the same recursive function RecursiveFct(...) ... } }
I don't close my SQL statement, because I don't know how to do that.
I then trace my ODBC driver, and I notice that after about 220 execute statements, my Access ODBC driver says it can't open tables anymore.
Is it possible to close a SQL statement, so I could free my database resources ?
Thanks
Mikael LAUSSEUR Aalto Consultant
To change your subscription: http://www.pdfzone.com/discussions/lists-pdfdev.html
