× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 2/13/2013 3:48 PM, Charles Wilt wrote:
It'd be better IMO, to make the parm option(*OMIT)

Then you could use the built in special value of *OMIT, instead of a string.

I _think_ you might not even have to check for anything as an *OMITted parm
gives a *NULL address..

Charles


On Wed, Feb 13, 2013 at 12:42 PM, James H. H. Lampert wrote:

On 2/13/13 7:11 AM, Charles Wilt wrote:
It's not '*NULL'

it's *NULL

Without the quotes.

Uh, Charles, as I said, '*NULL' passed to my front-end (because it
expects an RPG string) becomes *NULL when the front-end calls Java:

(I have the front-end for dbmd.getPrimaryKeys() set up so that the
string "*NULL" becomes a *NULL, for both catalog and schema).

JHHL

The issue (if one wants to call it that) is that the wrapper wants an
RPG character variable, and thus either an actual name, *OMIT or a
special marker that means '*NULL'.

D JDBC_GetPrimaryKeys...
D PI like(ResultSet)
D dbmd like(DatabaseMetaData) const
D catalog 32767A varying const options(*varsize)
D schema 32767A varying const options(*varsize)
D table 32767A varying const options(*varsize)

catalog = 'MYSERIAL';
schema = 'MYLIB';
table = 'MYTABLE'
rs = getDatabaseMetaData_getPrimaryKeys(dbmd:
catalog:
schema:
table);

The advantage here is that one can use literals in the call. The
disadvantage is that the wrapper needs to do some work to convert the
RPG character variable to a Java string.

If a slightly different design decision were made, the wrapper would ask
for a jString, the same way the underlying Java function does:

d catalog s like(jString)
d schema s like(jString)
d table s like(jString)

d getDatabaseMetaData_getPrimaryKeys...
d pr ExtProc(*JAVA:
d 'java.sql.DatabaseMetaData':
d 'getPrimaryKeys')
d like(ResultSet)
d catalog like(jString)
d schema like(jString)
d table like(jString)

catalog = char2str('MYSERIAL');
schema = char2str('MYLIB');
table = char2str('MYTABLE');
keysRS = getDatabaseMetaData_getPrimaryKeys(dbmd:
catalog:
schema:
table);

If the caller wants to pass *NULLs through, it could look like this:
catalog = *NULL;
schema = char2str('MYLIB');
table = char2str('MYTABLE');
keysRS = getDatabaseMetaData_getPrimaryKeys(dbmd:
catalog:
schema:
table);

The advantage is that if we're already passing jString objects around,
we don't need to do a conversion from RPG to Java. Also, there isn't
any work done by the wrapper. The disadvantage is that if we're passing
RPG variables around, each caller needs to convert to the Java object.

I can see the rationale for either choice. I like *OMIT over a special
value, but the wrapper will still have to have code to assign *NULL to
the Java object.
--buck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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.