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

Adding SQLITE_OPEN_URI flag #344

Closed
wants to merge 1 commit into from
Closed

Adding SQLITE_OPEN_URI flag #344

wants to merge 1 commit into from

Conversation

marcelofabri
Copy link

I've updated my SQLite version (as now I need to use SQLCipher), but I was surprised that FMDatabaseQueue's inits and databaseQueueWithPath: started returning nil, because sqlite3_open_v2 started returning SQLITE_CANTOPEN.

Adding SQLITE_OPEN_URI to the flags resolved the issue. I know that I can use initWithPath:flags:, but I think most people won't realize that this is needed.

I've updated my SQLite version (as now I need to use SQLCipher), but I was surprised that `FMDatabaseQueue`'s `init`s and `databaseQueueWithPath:` started returning `nil`, because `sqlite3_open_v2` started returning `SQLITE_CANTOPEN`.

Adding `SQLITE_OPEN_URI` to the flags resolved the issue. I know that I can use `initWithPath:flags:`, but I think most people won't realize that this is needed.
@ccgus
Copy link
Owner

ccgus commented Feb 23, 2015

So you're adding something like file:/// to the front of your database path?

@marcelofabri
Copy link
Author

I'm using absoluteString on an NSURL, which does return file:///.

@robertmryan
Copy link
Collaborator

Obviously, if you used path rather than absoluteString, this change would be unnecessary.

I do not think it is correct to make the path rendition of this method accept a URL string. If we wanted one that took NSURL, that's a different matter. But methods that take paths generally (never?) accept URL strings and I don't think this should either.

@marcelofabri
Copy link
Author

@robertmryan I would agree with you if this never worked. However, it was working before updating SQLite and this would be more a convenience.

But, as you said, FMDatabase clearly states that it needs a file system path, so I'll update my code to use path.

@ccgus ccgus closed this Feb 23, 2015
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 this pull request may close these issues.

3 participants