Skip to content

Commit

Permalink
release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
per committed Jul 15, 2022
1 parent b4f9777 commit 1229b9c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# data-utils
Groovy data utils
Groovy data utils. The main issue I needed to address was the reliance on System classloader in @Grab to handle JDBC drivers.
This is very inconvenient when using an IDE such as [Gride](/perNyfelt/gride) as it requires you to copy jars to the Gride lib folder and
restart the IDE in order for the System classpath to be updated.

However, with some Reflection magic it is possible to do without this. This is what se.alipsa.groovy.datautil.SqlUtil does.

Here is an example:

```groovy
@Grab('se.alipsa.groovy:data-utils:1.0.0')
@Grab('org.postgresql:postgresql:42.4.0')
import se.alipsa.groovy.datautil.SqlUtil
def idList = new ArrayList()
SqlUtil.withInstance("jdbc:postgresql://localhost:5432/mydb", "dbUser", "dbPasswd", "org.postgresql.Driver") { sql ->
sql.query('SELECT id FROM project') { rs ->
while (rs.next()) {
idList.add(rs.getLong(1))
}
}
}
```
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>se.alipsa.groovy</groupId>
<artifactId>data-utils</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0.0</version>

<name>Groovy Data Utils</name>
<description>utilities for use in Groovy applications e.g. Gride</description>
Expand Down

0 comments on commit 1229b9c

Please sign in to comment.