diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-03 17:10:30 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-03 17:10:30 +0100 |
commit | 5c8c3467906d996c04210cc8350edbd027ccc32a (patch) | |
tree | b0d34eb87cd589b27b422059eff599b3b80ba24e /src/main/java/io/trygvis/esper/testing/core/db/FileDao.java | |
parent | 35ba1a6f765f72a1d91a5456c7556e6274f8c3a9 (diff) | |
download | esper-testing-5c8c3467906d996c04210cc8350edbd027ccc32a.tar.gz esper-testing-5c8c3467906d996c04210cc8350edbd027ccc32a.tar.bz2 esper-testing-5c8c3467906d996c04210cc8350edbd027ccc32a.tar.xz esper-testing-5c8c3467906d996c04210cc8350edbd027ccc32a.zip |
o Skipping builds where the job is a <mavenModule>.
o Using the build's timestamp instead of createdDate in the UI.
Diffstat (limited to 'src/main/java/io/trygvis/esper/testing/core/db/FileDao.java')
-rwxr-xr-x | src/main/java/io/trygvis/esper/testing/core/db/FileDao.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/core/db/FileDao.java b/src/main/java/io/trygvis/esper/testing/core/db/FileDao.java index affe1c8..a7d7199 100755 --- a/src/main/java/io/trygvis/esper/testing/core/db/FileDao.java +++ b/src/main/java/io/trygvis/esper/testing/core/db/FileDao.java @@ -41,4 +41,15 @@ public class FileDao { return some(rs.getBinaryStream(1)); } } + + public SqlOption<InputStream> loadByUrl(URI uri) throws SQLException { + try (PreparedStatement s = c.prepareStatement("SELECT data FROM file WHERE url=?")) { + s.setString(1, uri.toASCIIString()); + ResultSet rs = s.executeQuery(); + if(!rs.next()) { + return none(); + } + return some(rs.getBinaryStream(1)); + } + } } |