|
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
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.