0

I'm trying to test a SQL query for groovy/grails. Going over why is the SQL insert is not working, I'm trying to print out that query line. Surprising, not even that work, so I'm investigating about the string formatting in groovy. If someone has a clue about it please let me know.

println  """INSERT INTO iu (version, path, uuid, name, description,
                            sourceversionfrom, sourceversionexto,
                            targetversionfrom, targetversionexto,
                            phase, directive, classname, methodname,
                            functionalarea_id, upgradepath_id, date_created,
                            last_updated, mark4delete, firstAvailable_id,
                            lastAvailable_id, uniqueid_id, elementcreateddate,
                            purpose, implementationdetails, userimpact)
              VALUES ( ${this.version}, ${this.path}, ${this.uuid}, ${this.name},
                       ${this.description}, ${this.sourceversionfrom},
                       ${this.sourceversionexto}, ${this.targetversionfrom},
                       ${this.targetversionexto}, ${this.phase}, ${this.directive},
                       ${this.classname}, ${this.methodname}, $functionalarea_id,
                       $upgradepath_id, NOW(), NOW(), 0, ${this.projID},
                       ${this.projID}, ${this.uniqueid_id},
                       ${this.getElementCreatedDate()}, ${this.purpose},
                       ${this.implementationDetails}, ${this.userImpact} )"""

the program halts and stands by after that line

1
  • What do you mean by "the program halts and stands by"? It crashes? It prints nothing out and hangs? BTW: The code you posted looks fine to me... Commented Mar 14, 2012 at 14:06

1 Answer 1

1

There's nothing wrong with your query string. The program may be hanging on retrieving one of the properties (version, path, uuid, etc.) through a getter, or on the call to getElementCreatedDate.

To see what your program is doing when it hangs, you can generate a thread dump. When groovy is being run interactively in a terminal or console window, send a QUIT signal or type ctrl-\ on Linux or OS X, or type ctrl-break on Windows. Look for the "main" thread and scan down the stack trace until you reach your own code.

Sign up to request clarification or add additional context in comments.

1 Comment

The function ${this.getElementCreatedDate()} is the trouble source. I have isolated the problem, it is producing a NULL pointer that is causing the program to stand still ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.