Skip to content

Commit

Permalink
Added method for clearing SPARQL events
Browse files Browse the repository at this point in the history
  • Loading branch information
mishajw committed Apr 19, 2016
1 parent 2b93c51 commit ccfd3b6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/backend/util/DB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ object DB {
""".update.apply()
}

def resetSparql() = {
sql"""
DELETE FROM events
WHERE id IN (
SELECT event_id FROM located_events_db
);
""".update.apply()

sql"""
DELETE FROM locations;
""".update.apply()
}

def dateRange: Option[(java.sql.Date, java.sql.Date)] = {
sql"""
SELECT
Expand Down Expand Up @@ -293,7 +306,7 @@ object DB {
new java.sql.Date(cal.getTime.getTime)
}

private def fromSqlDate(d: java.sql.Date, precisionRaw: String): Date = {
def fromSqlDate(d: java.sql.Date, precisionRaw: String): Date = {
val precision = precisionRaw match {
case "PreciseToYear" => PreciseToYear
case "PreciseToMonth" => PreciseToMonth
Expand Down

0 comments on commit ccfd3b6

Please sign in to comment.