Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

Unable to open db file when db file is in a different disk partition than application path #7

@J-F-Liu

Description

@J-F-Liu

For example, application runs on "d:/website/app", db file is in "e:/data/erp_development.db"
then the connection string becomes:

sqlite3:e/data/erp_development.db?scheme=sqlite3&user=&pas
sword=&host=e&port=&query=&fragment=&adapter=sqlite3&path=/data/erp_development.db

I fixed this issue by add the following line into dm-sqlite-adapter/adapter.rb file inside normalize_options(options) method:

#added code
if options[:host]
  path = options[:host] + ':' + path
end

#orginal code
options.update(:adapter => 'sqlite3', :path => path)

Then the connection string becomes:

sqlite3:ee:/data/erp_development.db?scheme=sqlite3&user=&pas
sword=&host=e&port=&query=&fragment=&adapter=sqlite3&path=e:/data/erp_development.db

and it works!

So do you think the added code will break other scenarios or it fixes a general issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions