Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug opening a database with an accent in path #277

Open
jfburdet opened this issue Jan 30, 2024 · 1 comment · May be fixed by #278
Open

Possible bug opening a database with an accent in path #277

jfburdet opened this issue Jan 30, 2024 · 1 comment · May be fixed by #278
Assignees

Comments

@jfburdet
Copy link

Hi,
The following code is crashing when the directory containing the database contains accents. I'm not skilled enough to check if the bug is in exqlite code ou kino_db. I apologize in advance if I didn't open the bug in the right project.

Mix.install([
  {:kino_db, "~> 0.2.3"},
  {:exqlite, "~> 0.11"}
])

defmodule M do
  def create_and_open_db(path) do
    File.rmdir(path)
    File.mkdir(path)

    db_path = path <> "/database.db"

    System.cmd("sqlite3", [db_path, ".version"])

    opts = [database: db_path]
    {:ok, conn} = Kino.start_child({Exqlite, opts})

    Exqlite.query!(conn, "PRAGMA table_list", []) |> dbg()
  end
end

# Sucess
M.create_and_open_db("./no_accent")

# Failure
M.create_and_open_db("./répertoire_accentué")
``
@warmwaffles
Copy link
Member

Oh this is interesting, I'll need to dig into it a little bit more. This is probably a mistake in handling the binary coming from erlang into the nif when calling sqlite3_open.

@warmwaffles warmwaffles self-assigned this Jan 30, 2024
@greg-rychlewski greg-rychlewski linked a pull request Feb 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants