It seems that the sqlite3.exe shell buffers output of some shell directives 
(.help) when compiled
with a non-cygwin compiler and run in a non cmd.exe Windows shell - but oddly, 
it does not buffer
the output of errors, other directives (.dump), or any SQL commands:

cygwin$ sqlite3.exe 
.help
some erroneous statement;
some erroneous statement;
SQL error: near "some": syntax error
create table foo(a,b,c);
.dump
BEGIN TRANSACTION;
CREATE TABLE foo(a,b,c);
COMMIT;
.help
another erroneous statement;
another erroneous statement;
SQL error: near "another": syntax error
.help
.databases             List names and files of attached databases
.dump ?TABLE? ...      Dump the database in an SQL text format
.echo ON|OFF           Turn command echo on or off
.exit                  Exit this program
.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.

...etc... 2 1/2 .help outputs occur at this point.

I've measured how much output is buffered and it is exactly 4096 bytes each 
time.

So we have 3 different things going on here:
(1) shell prompts are never displayed at all.
(2) the output of sql commands and errors are immediately displayed and never 
buffered
(3) the output of some shell directives (such as .help) are buffered and only 
displayed when it
exceeds 4096 bytes.

So it would appear that there must be 3 different types of console writing 
strategies going on in
the Windows sqlite3.exe program. Case (1) probably has an erroneous Windows 
console/tty check. It
should be fairly easy to change the sqlite3 shell code to unify all these 
Windows outputs into
using the same mechanism. 

--- rahed <[EMAIL PROTECTED]> wrote:

> Joe Wilson <[EMAIL PROTECTED]> writes:
> 
> > I've seen this same behavior when running a MinGW-compiled sqlite3.exe in 
> > the cygwin shell. It
> has
> > something to do with the lack of flushing of information written to stdout 
> > (until close()
> anyway).
> > If you blindly type in the sqlite commands - it does work. Once you exit 
> > the shell via .q you
> can
> > see the entire output of the session.
> >
> > One workaround is to use a cygwin-compiled sqlite3.exe. Perhaps hacking the 
> > sqlite shell not
> to
> > buffer its console output would also do the trick.
> >
> 
> I entered the commands (which I didn't do before) and I can see the
> output immediately. So the only hitch is a command line without a
> prompt sqlite>. 
> 
> -- 
> Radek
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to