Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Groovy
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p><strong>Table of Contents</strong></p> <img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e3RvY30&locale=en_GB&version=2" data-macro-name="toc"> <table class="wysiwyg-macro" data-macro-name="note" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e25vdGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"> <h1>This is a DRAFT PAGE for an unreleased version of Groovy and is incomplete and subject to change</h1></td></tr></table> <h1>Groovy 1.8.1 release notes</h1> <p>The 1.8.1 release of Groovy is primarily a bug fix release but also comes with the new features outlined below.</p> <h3>Support for begin() / end() methods when processing files line by line with the groovy command</h3> <p>A feature found in other scripting languages like Perl or Awk is to be able to have a begin / end method when processing a file line by line. The groovy command supports this mode of operation, but didn't support the begin / end methods. (this feature is actually going to be available in 1.7.11 and 1.8.1, but time ran short for inclusion in the 1.8 final release)</p> <p>More concretely, if you have a text file named dummy.txt, and you want to count the number of lines it contains, you could do this on the command-line:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> groovy -a -ne 'def begin() { nb = 0 }; def end() { System.err.println nb }; nb++' dummy.txt </pre></td></tr></table> <h3>Sql batch support that allows PreparedStatements to be used as shown in these examples:</h3> <p>Shown for a batch size of 20:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> def updateCounts = sql.withBatch(20, 'insert into TABLENAME(a, b, c) values (?, ?, ?)') { ps -> ps.addBatch(10, 12, 5) // varargs style ps.addBatch([7, 3, 98]) // list ps.addBatch([22, 67, 11]) ... } </pre></td></tr></table> <p>Named parameters (into maps or domain objects) are also supported:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> def updateCounts = sql.withBatch(20, 'insert into TABLENAME(a, b, c) values (?.foo, :bar, :baz)') { ps -> ps.addBatch([foo:10, bar:12, baz:5]) // map ps.addBatch(foo:7, bar:3, baz:98) // Groovy named args allow outer brackets to be dropped ... } </pre></td></tr></table> <p>Named ordinal parameters (into maps or domain objects) are also supported:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> def updateCounts = sql.withBatch(20, 'insert into TABLENAME(a, b, c) values (?1.foo, ?2.bar, ?2.baz)') { ps -> ps.addBatch([[foo:22], [bar:67, baz:11]]) // list of maps or domain objects ps.addBatch([foo:10], [bar:12, baz:5]) // varargs allows outer brackets to be dropped ps.addBatch([foo:7], [bar:3, baz:98]) ... } def updateCounts2 = sql.withBatch(5, 'insert into TABLENAME(a, b, c) values (?1, ?2.bar, ?2.baz)') { ps -> ps.addBatch(10, [bar:12, baz:5]) ps.addBatch(7, [bar:3, baz:98]) ... } </pre></td></tr></table>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced