One of the goals of the EDT project is to provide a large collection of source code examples, known as snippets, that show how to complete various tasks in EGL. These code samples can be very useful for someone that has never written an application in EGL before, and they can help experienced EGL developers remember how to write an infrequently used operation, or educate themselves on previously unused parts of the language. The current collection of EGL snippets can be found on the EDT Code Snippets wiki page, which is conveniently broken down into sections on; EGL native types, user defined types, statements, database access, services, and Rich UI development.
While most snippets are only a few lines long, and describe how to use a particular statement or type found in the EGL language, there are some snippets that describe higher level concepts that are often used in a typical EGL application. An example of a small snippet is the following, which shows how to declare a new Dictionary with some initial values:
While most snippets are only a few lines long, and describe how to use a particular statement or type found in the EGL language, there are some snippets that describe higher level concepts that are often used in a typical EGL application. An example of a small snippet is the following, which shows how to declare a new Dictionary with some initial values:
http://wiki.eclipse.org/EDT:Declaring_data#Values_of_type_Dictionary |
An example of a larger snippet, which shows how to load multiple rows of values from a database, can be found in the section on working with a database:
http://wiki.eclipse.org/EDT:Working_with_a_database#Getting_multiple_rows_with_one_statement |
While there is a lot of content on these pages, there is always room for more! If you have a suggestion, feel free to post a comment to this blog entry, and we can see about adding it to the collection. Better yet, if you're an Eclipse member, you can add the snippet yourself using the instructions found on the snippet page. Once you see how easy it is to add a new snippet (I added one to the Dictionary section while writing this blog entry and with Devo songs running through my head), you will hopefully find yourself adding many new snippets to share with the EDT community.
Brian
Brian
Here's another example showing multiple parameters being passed. This differs in that the bounding parentheses for the parms are not required.
ReplyDeletetry
get jobsRecords from dataSource using dateYYYYMMDD, timeHHMMSS with
#sql{
select JBNAME, JBUSER, JBNUMBER, JBIJOBID, JBSTATUS, JBTYPE, JBSUBTYP,
JBSBSNAM, JBSBSLIB, JBPERCENT, JBSAMPLEDT, JBSAMPLETM
from SYSJOBSP where JBSAMPLEDT = ? and JBSAMPLETM = ?
order by JBPERCENT desc
fetch first 10 rows only
};
onException(ex sqlException)
logException(ex);
end
Hi Buster,
DeleteThanks for sharing! Everyone can add directly to Code Snippets on the the EDT wiki (since it's a wiki).
Looking forward to lots more great snippet shares.