Re: [sqlite] Proposed enhancement to the sqlite3.exe command-lineshell

2014-03-31 Thread Mohit Sindhwani

On 11/2/2014 1:57 AM, Richard Hipp wrote:

On Mon, Feb 10, 2014 at 12:51 PM,  wrote:


I second the idea of a kind of "WARNING: All your work will be lost, are
you sure you want to quit? (y/N)" on trying to exit, but *ONLY* if the
application was started by (double-)clicking on it, otherwise the warning
will be a nuisance when running test scripts.


I think I know how to detect a double-click launch versus a command-line
launch on windows.  But I don't know how to do this, or even if it is
possible to do, on Mac or Linux.  Anybody have any ideas?


I genuinely feel that we should give a warning at start up and leave it 
at that... everything else is likely to rely on numerous assumptions.  
For example, a slightly more eager user may go to the command line and 
run sqlite3.exe but not realize that his database is not saved.  I think 
we should keep it simple.  Most users learn very quickly once their data 
has gone away!


Best Regards,
Mohit.


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Proposed enhancement to the sqlite3.exe command-lineshell

2014-02-11 Thread Dominique Devienne
On Mon, Feb 10, 2014 at 9:23 PM, Richard Hipp  wrote:

> (1) Reword the banner to make it more terse and to try to avoid
> "banner fatigue".
>

Thanks.


> (2) If opened with no command-line arguments (and hence on an in-memory
> database) output a warning in the banner.
>
>(a)  On unix the warning is bold.
>(b)  On windows the warning is bold and red.
>(c)  The warning suggests the use of ".open FILENAME"
>

That's very terminal specific and doesn't play nice with color blindness,
nor if someone had a DOS window with red background (someone out there has
a good reason for that).

There's a reason IMHO some Unix commands have an explicit opt-in --color
switch.

So unless you add such a --color switch to sqlite3 itself, I'd stick with
normal text, as ever, and as default.

If sqlite3 could live this long w/o errors written out in red, it surely
can also survive w/o bold and/or red warning text.


> (3) Added the ".save" command as an alias for ".backup".  But there is no
> mention of this in the banner.  (Trying to keep the banner succinct.)
>
> There is no warning prior to close because (in my experience) most users
> will do a hard kill of some kind (Ctrl-D or closing the console window) in
> which case no warning is possible.


I for one often start sqlite3 at the command line w/o arguments, for
experimentation, and .quit properly, not using a hard kill, and would
rather not have such an exit warning indeed.

In fact, maybe sqlite3 should gain a -q (--quiet) switch to avoid any
banner or training-wheels warning, given the new trend on colorful warnings?

My $0.02. --DD
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Proposed enhancement to the sqlite3.exe command-lineshell

2014-02-10 Thread Richard Hipp
On Mon, Feb 10, 2014 at 2:38 PM, Tim Streater  wrote:

> I wouldn't worry about whether the user clicks a red button in one corner
> or another. If they do that, presumably they risk corrupting their database
> anyway.
>

No.  SQLite is hardened against hard-kills like this. The database is
unharmed by clicking the red button or sending a "kill -9" or doing a
"force quit" or pulling the power plug.
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Proposed enhancement to the sqlite3.exe command-lineshell

2014-02-10 Thread Richard Hipp
The latest patch for this is:


http://www.sqlite.org/src/vdiff?from=0dfa7ee9157ea6b1=fe284afe739c497e=1

Changes:

(1) Reword the banner to make it more terse and to try to avoid "banner
fatigue".

(2) If opened with no command-line arguments (and hence on an in-memory
database) output a warning in the banner.

   (a)  On unix the warning is bold.
   (b)  On windows the warning is bold and red.
   (c)  The warning suggests the use of ".open FILENAME"

(3) Added the ".save" command as an alias for ".backup".  But there is no
mention of this in the banner.  (Trying to keep the banner succinct.)

There is no warning prior to close because (in my experience) most users
will do a hard kill of some kind (Ctrl-D or closing the console window) in
which case no warning is possible.


-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Proposed enhancement to the sqlite3.exe command-lineshell

2014-02-10 Thread Tim Streater
On 10 Feb 2014 at 19:25, Simon Slavin  wrote:

> I don't like the idea anyway.  There should be no difference between
> double-clicking on an app and starting it by typing its name.

I would go for:

1) Warning at startup if an in-memory db is being used

2) Add .save /path/to/filename so the work can be saved

3) Add option to enable the warning in (4) (e.g. to put in .sqliterc)

4) Add warning if you ctrl-d or .quit (previously enabled, see (3))


Is all that backwards compatible? I wouldn't worry about whether the user 
clicks a red button in one corner or another. If they do that, presumably they 
risk corrupting their database anyway. I've never double-clicked on sqlite3 and 
wouldn't expect to.

--
Cheers  --  Tim
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Proposed enhancement to the sqlite3.exe command-lineshell

2014-02-10 Thread Simon Slavin

On 10 Feb 2014, at 5:57pm, Richard Hipp  wrote:

> On Mon, Feb 10, 2014 at 12:51 PM,  wrote:
> 
>> I second the idea of a kind of "WARNING: All your work will be lost, are
>> you sure you want to quit? (y/N)" on trying to exit, but *ONLY* if the
>> application was started by (double-)clicking on it, otherwise the warning
>> will be a nuisance when running test scripts.
> 
> I think I know how to detect a double-click launch versus a command-line
> launch on windows.  But I don't know how to do this, or even if it is
> possible to do, on Mac or Linux.  Anybody have any ideas?

I don't think it's possible on a Mac for a command-line application.  The 
changes you make for double-click command line are stored in something 
(info.plist) which isn't included when your product is the single executable 
file.

I don't like the idea anyway.  There should be no difference between 
double-clicking on an app and starting it by typing its name.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Proposed enhancement to the sqlite3.exe command-lineshell

2014-02-10 Thread Kevin Martin

On 10 Feb 2014, at 17:57, Richard Hipp  wrote:

> I think I know how to detect a double-click launch versus a command-line
> launch on windows.  But I don't know how to do this, or even if it is
> possible to do, on Mac or Linux.  Anybody have any ideas?

For me, It's not so much how it is launched that matters, but whether it is 
running interactively. I would only want the behaviour altered if stdin is a 
terminal. What about something as simple as

isatty(STDIN_FILENO);

Thanks,
Kevin

 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Proposed enhancement to the sqlite3.exe command-lineshell

2014-02-10 Thread Richard Hipp
On Mon, Feb 10, 2014 at 12:51 PM,  wrote:

> I second the idea of a kind of "WARNING: All your work will be lost, are
> you sure you want to quit? (y/N)" on trying to exit, but *ONLY* if the
> application was started by (double-)clicking on it, otherwise the warning
> will be a nuisance when running test scripts.
>

I think I know how to detect a double-click launch versus a command-line
launch on windows.  But I don't know how to do this, or even if it is
possible to do, on Mac or Linux.  Anybody have any ideas?


-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Proposed enhancement to the sqlite3.exe command-lineshell

2014-02-10 Thread tonyp
I second the idea of a kind of "WARNING: All your work will be lost, are you 
sure you want to quit? (y/N)" on trying to exit, but *ONLY* if the 
application was started by (double-)clicking on it, otherwise the warning 
will be a nuisance when running test scripts.


-Original Message- 
From: Richard Hipp

Sent: Monday, February 10, 2014 6:15 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Proposed enhancement to the sqlite3.exe 
command-lineshell


What if, instead of opening a standard database, the sqlite3.exe
command-line shell just issued a warning message reminding the user that
they are working on a transient in-memory database and suggesting the use
of the ".open" command to connect to a persistent on-disk database.  Like
in this patch:

http://www.sqlite.org/src/info/90e9deae4a


--
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users