Hello All,
are the tasks below possible in Scriptrunner? Unfortunately, the documentation is very poor it comes to adding to the external database. I am asking for help, unfortunately I am new to Scriptrunner:
...
Thank you in advance for your help and advices
--
Kazimierz
Thank you very much for your answer. I would like to clarify the statement "write SQL in an external database" is it possible to fill in a blank database? e.g. with
db.executeInsert("INSERT INTO TABLE MyTable VALUES (?, ?, ?)", ['some', 123, myVar])
?
Sure it would look like this:
def keys = DatabaseUtil.withSql('your_scriptrunner_resource_name'){sql->
sql.executeInsert('INSERT INTO TABLE MyTable VALUES (?, ?, ?)', ['some', 123, myVar])
}
log.info "${keys.size()} row(s) were inserted. List of keys: $keys"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The DatabaseUtil is only a shortcut to obtaining a groovy.sql.Sql object.
So it's not really their job to document that class.
You'll find that documentation in pages such as: https://groovy-lang.org/databases.html and https://docs.groovy-lang.org/latest/html/api/groovy/sql/Sql.html
But short pointers:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.