aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/trygvis/esper/testing/core/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/trygvis/esper/testing/core/db')
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/core/db/FileDao.java11
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));
+ }
+ }
}