-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gpgk: 出力ファイルが既に存在するとき、破棄して新しいものを作成(上書き保存) (#344)
close #339 - 既存の実装 - DBファイルがすでに存在する場合、それに接続した - 変更後 - DBファイルがすでに存在する場合、まずそれを削除する 他のsink(例えばgeojson)でも、 `File::create` 、つまり存在したら破棄して新しいものを作成している: [create - Rust By Example 日本語版](https://doc.rust-jp.rs/rust-by-example-ja/std_misc/file/create.html) DBの中身を全部drop、なども可能ではあるが、ややこしいので、1ファイルで存在するSQLiteであるため、ファイルを削除するという方式をとっている。 ~~元のSink実装では、 `output_path` が `sqlite://~` であることも想定していたが、そのようなユースケースは今のところないこと、そのようなURLの場合はファイル削除がややこしいことなどから、その分岐自体を削除し、他のsinkと同様にoutput_pathはファイルパスであるという想定にしている。~~ → `"sqlite::memory:"` で使いたいケースがあるので、残す。ただし、ファイルパスの場合のみ、まずファイルを削除する。 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **新機能** - データベースを初期化するための`from_path`メソッドが削除され、URLを使用してデータベースを初期化する`from_url`メソッドが導入されました。 - **バグ修正** - `GpkgSink`の初期化ロジックが修正され、`output_path`が存在する場合はそのファイルを削除してから`GpkgHandler`インスタンスを作成するように変更されました。 <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
3 changed files
with
7 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters