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

sqlite_db_filename returns "" instead of undef #50

Closed
dboehmer opened this issue May 22, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@dboehmer
Copy link

commented May 22, 2019

The method sqlite_db_filename is documented to return undef for in-memory databases.

Retrieve the current (main) database filename. If the database is in-memory or temporary, this returns C<undef>.

But instead it returns an empty string:

$ perl -w -MDBI -E 'say defined ? qq("$_") : "undef" for DBI->connect("dbi:SQLite::memory:")->sqlite_db_filename; say $DBD::SQLite::VERSION'
""
1.62

I'm not confident enough in C to fix this in code. If you'd rather adjust the documentation to the existing behavior I can provide a PR.

@charsbar charsbar closed this in d4de220 May 22, 2019

@charsbar

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

Thanks for spotting this. Until recently, the comment in sqlite3.c has said like this:

If there is no attached database N on the database
** connection D, or if database N is a temporary or in-memory database, then
** a NULL pointer is returned.

However, it has actually been returning an emtpy string or NULL depending on the situation, at least since 2013. And now, the latest version of sqlite3.c has changed its comment as follows.

 If there is no attached database N on the database
** connection D, or if database N is a temporary or in-memory database, then
** this function will return either a NULL pointer or an empty string.

I committed a change in the pod. I'm not going to release this today, but it's about time to release the next stable version, so I think this commit will be in soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.