Skip to content

Commit

Permalink
SQLiteSupport added verification that full directory path is created
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed May 12, 2024
1 parent c8739a2 commit 9231394
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sqlite/src/main/scala/lightdb/sqlite/SQLiteSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ import lightdb.model.AbstractCollection
import lightdb.query.{PagedResults, Query, SearchContext, Sort}
import lightdb.util.FlushingBacklog

import java.nio.file.Path
import java.nio.file.{Files, Path}
import java.sql.{Connection, DriverManager, PreparedStatement, ResultSet, Types}

trait SQLiteSupport[D <: Document[D]] extends IndexSupport[D] {
private lazy val path: Path = collection.db.directory.resolve(collection.collectionName).resolve("sqlite.db")
private lazy val path: Path = {
val p = collection.db.directory.resolve(collection.collectionName).resolve("sqlite.db")
Files.createDirectories(p.getParent)
p
}
// TODO: Should each collection have a connection?

private var _connection: Option[Connection] = None
Expand Down

0 comments on commit 9231394

Please sign in to comment.