Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGL Development Tools » SQL parameters(How to specify parameters)
SQL parameters [message #774099] Tue, 03 January 2012 04:06 Go to next message
Trond Einar Nilsen is currently offline Trond Einar Nilsen
Messages: 33
Registered: December 2011
Member
I am developing for Power7 (iSeries) and have used EGL CE width success. For EDT I expected this to work:

function getG8(G8search string inOut, UserLogon string in, counter int in) returns(G8A[])
LIBFIL = "NOR.SECNREL0";
get G8Array from ds
with #sql{SELECT G8JWNB as G8JWNB FROM :LIBFIL where G8AUNA like :G8search};
return(G8Array);
end

but it seems like the ":" is not used to specify parameters anymore. I cannot find out how to do it. Probably I have to use "?" somehow, but how?
/Trond E. Nilsen

[Updated on: Tue, 03 January 2012 04:06]

Report message to a moderator

Re: SQL parameters [message #774767 is a reply to message #774099] Wed, 04 January 2012 09:59 Go to previous messageGo to next message
Will Smythe is currently offline Will Smythe
Messages: 41
Registered: July 2009
Member
As you have discovered, the :hostVariable syntax is not supported in EDT. You can use "?" in your SQL to identify parameters, but this does not work for the table name (as you may have discovered). This is a SQL limitation.

The following code demonstrates how you might accomplish what you are trying to do:
    ds SQLDataSource?{@resource {}};
    tableName String = "snippet";
    
    stmt SQLStatement?;
    prepare stmt from ds with "select * from " + tableName + " where id > ?";
    
    snippets Snippet[];
    get snippets from ds with stmt using id;

See the EGL Data Access spec for more details on Prepare and the other data access statements: https://bugs.eclipse.org/bugs/show_bug.cgi?id=355573
Re: SQL parameters [message #775130 is a reply to message #774767] Thu, 05 January 2012 06:48 Go to previous message
Trond Einar Nilsen is currently offline Trond Einar Nilsen
Messages: 33
Registered: December 2011
Member
Thanks Will, got it working now
Previous Topic:Extension Point Modeling Framework
Next Topic:EDT 0.8.0 Planning
Goto Forum:
  


Current Time: Thu Aug 21 16:15:49 EDT 2014

Powered by FUDForum. Page generated in 0.02235 seconds