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 09:06 Go to next message
Trond Einar Nilsen is currently offline Trond Einar NilsenFriend
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 09:06]

Report message to a moderator

Re: SQL parameters [message #774767 is a reply to message #774099] Wed, 04 January 2012 14:59 Go to previous messageGo to next message
Will Smythe is currently offline Will SmytheFriend
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 11:48 Go to previous message
Trond Einar Nilsen is currently offline Trond Einar NilsenFriend
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: Fri Nov 28 18:44:00 GMT 2014

Powered by FUDForum. Page generated in 0.02239 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software