I’m novice to Groovy and I have a doubt. Let’s say I’m doing something like this :
db.execute '''
//my sql commands
'''
Programmatically how can I find that my execute method succeeds?
I tried this way :
def status = db.execute '''
//my sql commands
'''
But even though the data have been inserted into the db ( which I have viewed in my mysql client ), the status returns false. Its confusing for me. Whats going on?
I’m assuming you’re using the groovy.sql.Sql object. If you look at the API (linked previously) for the execute() method, it says it will return
falsefor either a row count return value or a no results return value.Since you mentioned an insert statement, check your row count via: