RB Smissaert wrote:
Have tried this now and working beautifully.
One thing I couldn't figure out is how to set the row delimiter.
I can set the column delimiter fine with .mode csv, but couldn't see
something similar for the rows. The delimiter for rows should be vbCrLf.
As SQLite is written in C does it have the option to output to memory, say
an array and produce the pointer to that memory, rather than a text file?
RBS
-----Original Message-----
From: Dennis Cote [mailto:[EMAIL PROTECTED]
Sent: 17 November 2006 15:04
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] select from commandprompt with output to file
RB Smissaert wrote:
How would I run these 4 commands via a .bat file or via whatever means:
cd c:\test\ReadCodes
c:\test\Program\sqlite3 c:\test\ReadCodes\ReadCode.db"
.output testfile.txt
select * from readcode where read_code glob 'G2*';
It must be simple, but I can't see it.
RBS,
You need to put all your sqlite shell commands in one file, say
sqlitecmds.txt. This includes the dot commands and the SQL statements.
So sqlitecmds.txt contains:
.output testfile.txt
select * from readcode where read_code glob 'G2*';
Then you need to put your DOS shell commands in another file, say
readcode.bat. This file will contain the commnad to run sqlite and
redirect its input to the file of sqlite commnads above. So readcode.bat
contains:
cd c:\test\ReadCodes
c:\test\Program\sqlite3 c:\test\ReadCodes\ReadCode.db < sqlitecmds.txt
Then you tell the DOS shell (actually cmd.exe) to run the commands in
your readcode.bat file by typing the batch file name at the command prompt.
C:\>readcode
This will execute your batch file commands, which will run the sqlite
shell program, which will read and execute the commands in the sqlite
commands file, which will write its output to the file testfile.txt in
the current directory (which will be C:\test\ReadCodes).
HTH
Dennis Cote
----------------------------------------------------------------------------
-
To unsubscribe, send email to [EMAIL PROTECTED]
----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------
You can achieve the structure you want by memory mapping a file and
writing to it. Then it will be in virtual memory and you will have a
pointer to it. It is not an Sqlite feature, but one your programming
language can do through its API. On Windows just use the regular Win32
API to map the file and to write. You can then access everything you
wrote using the pointer.
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------