Feature req: Shell .open command should inform user what file it opened

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Feature req: Shell .open command should inform user what file it opened

bob_sqlite-2
In the command shell, the .open command will either open an existing file
or create a new one if it doesn't already exist. This can be confusing.

It's even more confusing on Windows if the user has forgotten that the
path should be written with forward slashes instead of the usual Windows
backslashes.

This is the situation that baffled me for some time today. Backslashes
in the path are ignored. So my request to open an existing file was
changed to a request to open a new file in the default directory. I
didn't have permission, so Windows put it into the VirtualStore instead.
There was no error message. All I knew was that I was unable to access the
data as expected. Even the .databases command displayed what appeared to
be the correct path to the file including the backslashes.

All I'm asking is that the .open command gives a simple response saying
if it created a new file or opened an existing one and display the actual
path and filename. This would make it obvious what file had actually been
opened. With the above user error the directory would display as the
default directory and the filename would contain all the elements of the
user's intended path squished together. The message would look something
like this.

"Opened new file C:/Program Files/SQLite/UsersBobDocumentsProgTest.sqlite"

The equivalent message if the user had entered the path correctly would be.

    "Opened existing file C:/Users/Bob/Documents/Prog/Test.sqlite"

This would make it clear to the user that the wrong file had been opened.
It seems easily do-able. Hope this helps.

Bob
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] Feature req: Shell .open command should inform user what file it opened

Hick Gunter
IIRC SQLite will create a new database file only if (and when) the user enters a command that actually accesses the file. This avoids creating empty files if the user mistypes the file name. So the desired output might be required to appear "later".

Use the already implemented flag -readonly to return an error if the file does not exist.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von [hidden email]
Gesendet: Dienstag, 22. Jänner 2019 15:29
An: [hidden email]
Betreff: [EXTERNAL] [sqlite] Feature req: Shell .open command should inform user what file it opened

In the command shell, the .open command will either open an existing file or create a new one if it doesn't already exist. This can be confusing.

It's even more confusing on Windows if the user has forgotten that the path should be written with forward slashes instead of the usual Windows backslashes.

This is the situation that baffled me for some time today. Backslashes in the path are ignored. So my request to open an existing file was changed to a request to open a new file in the default directory. I didn't have permission, so Windows put it into the VirtualStore instead.
There was no error message. All I knew was that I was unable to access the data as expected. Even the .databases command displayed what appeared to be the correct path to the file including the backslashes.

All I'm asking is that the .open command gives a simple response saying if it created a new file or opened an existing one and display the actual path and filename. This would make it obvious what file had actually been opened. With the above user error the directory would display as the default directory and the filename would contain all the elements of the user's intended path squished together. The message would look something like this.

"Opened new file C:/Program Files/SQLite/UsersBobDocumentsProgTest.sqlite"

The equivalent message if the user had entered the path correctly would be.

    "Opened existing file C:/Users/Bob/Documents/Prog/Test.sqlite"

This would make it clear to the user that the wrong file had been opened.
It seems easily do-able. Hope this helps.

Bob
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] Feature req: Shell .open command should inform user what file it opened

David Raymond
The other reason for this is to give you a chance to set a number of permanent pragmas that affect that first page that gets written. Page size, schema version, text encoding etc.

But testing it right now it looks like when you use a non-existing file name, both .open and ATTACH do indeed create the  new file right away, just as a 0 byte file without that first page written. (I've made my fair share of new files when putting a typo into ATTACH when using the CLI)

So as far as a dot command in the CLI application goes, I agree that it would be kind of nice for the CLI to explicitly call out "opening existing file x" vs "creating new file x"

I vaguely recall asking in here over a year ago if there was any way to tell if you had just opened a brand new file or an existing one. If I remember correctly the consensus was no, because as soon as you try most things to check it, it makes the new file and the check becomes moot.

-----Original Message-----
From: sqlite-users [mailto:[hidden email]] On Behalf Of Hick Gunter
Sent: Tuesday, January 22, 2019 10:13 AM
To: 'SQLite mailing list'
Subject: Re: [sqlite] [EXTERNAL] Feature req: Shell .open command should inform user what file it opened

IIRC SQLite will create a new database file only if (and when) the user enters a command that actually accesses the file. This avoids creating empty files if the user mistypes the file name. So the desired output might be required to appear "later".

Use the already implemented flag -readonly to return an error if the file does not exist.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von [hidden email]
Gesendet: Dienstag, 22. Jänner 2019 15:29
An: [hidden email]
Betreff: [EXTERNAL] [sqlite] Feature req: Shell .open command should inform user what file it opened

In the command shell, the .open command will either open an existing file or create a new one if it doesn't already exist. This can be confusing.

It's even more confusing on Windows if the user has forgotten that the path should be written with forward slashes instead of the usual Windows backslashes.

This is the situation that baffled me for some time today. Backslashes in the path are ignored. So my request to open an existing file was changed to a request to open a new file in the default directory. I didn't have permission, so Windows put it into the VirtualStore instead.
There was no error message. All I knew was that I was unable to access the data as expected. Even the .databases command displayed what appeared to be the correct path to the file including the backslashes.

All I'm asking is that the .open command gives a simple response saying if it created a new file or opened an existing one and display the actual path and filename. This would make it obvious what file had actually been opened. With the above user error the directory would display as the default directory and the filename would contain all the elements of the user's intended path squished together. The message would look something like this.

"Opened new file C:/Program Files/SQLite/UsersBobDocumentsProgTest.sqlite"

The equivalent message if the user had entered the path correctly would be.

    "Opened existing file C:/Users/Bob/Documents/Prog/Test.sqlite"

This would make it clear to the user that the wrong file had been opened.
It seems easily do-able. Hope this helps.

Bob
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users