IreneKnapp / direct-sqlite

MIT License
35 stars 54 forks source link

Can't use URI #99

Closed domenkozar closed 1 year ago

domenkozar commented 1 year ago
{-# LANGUAGE OverloadedStrings #-}
module Main where

import Database.SQLite3

main = do
  db <- open2 "file:/nix/var/nix/db/db.sqlite?immutable=1" [SQLOpenURI] SQLVFSDefault
  close db
nix-shell -p "haskellPackages.ghcWithPackages (pkgs: [pkgs.direct-sqlite])" -I ~/dev --run "runghc Main.hs"
Main.hs: SQLite3 returned ErrorMisuse while attempting to perform open2 "file:/nix/var/nix/db/db.sqlite?immutable=1": bad parameter or other API misuse
domenkozar commented 1 year ago

@jchia let me know if you have any ideas how to fix this.

domenkozar commented 1 year ago
  db <- open2 "file:/nix/var/nix/db/db.sqlite?immutable=1" [SQLOpenReadOnly, SQLOpenURI] SQLVFSDefault

this works

IreneKnapp commented 1 year ago

glad you figured it out :)