After comparing the Java version of my primary key retriever with the JDBCR4 version, I decided to take a look at the source for JDBC_FreeResult().

FOUND IT!

stmt = rs_getStatement(rs);
stmt_close(stmt);
DeleteLocalRef(JNIENV_P: rs);
DeleteLocalRef(JNIENV_P: stmt);
rs = *NULL;

Note that it assumes that the result set has a valid, retrievable statement, and doesn't allow for the possibility that (as is the case with the result set returned from a getPrimaryKeys() call) the statement is either hidden or nonexistent.

When I changed it to:

stmt = rs_getStatement(rs);
if (stmt <> *NULL);
stmt_close(stmt);
endif;
DeleteLocalRef(JNIENV_P: rs);
if (stmt <> *NULL);
DeleteLocalRef(JNIENV_P: stmt);
endif;
rs = *NULL;

everything worked fine.

Would anybody happen to know whether or not it's OK to change the order of the DeleteLocalRef calls (i.e., do "stmt" before "rs")? This would allow me to avoid having two identical IF statements, but I fear it might also create a hidden flaw that might not show up in tests. If I can help it, I'd rather not send out a product with a memory leak (or worse)!

--
JHHL

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.