On 26 Aug 2013, at 16:14, luis montes wrote:
> It seems to me that I should be able to
> do something like this from the command line:
>
> cat file.xml|sqlite3 database.db 'update table1 set column3=? where
> column1="some name";'
>
> That's it, I'm trying to update column 3 on a particular record with a
> string that is already stored on a file.
You don't make it clear what you expect from such a command.
Does the file which is named in the 'cat' command contain a series
of data values, one per line?
If not, does it perhaps contain some (hopefully well-formed) XML
date?
In either case, you seem to be hoping that the SQL command given
as an argument to the SQLite shell ('sqlite3') should somehow
be applied to each data value arriving via the shell ('bash')
pipe, as each value is somehow bound to the '?' in the SQL
command. This isn't a realistic hope.
If I was trying something like that, and if the data file contained
XML, I might use xsltproc to generate a safe series of UPDATE
commands and feed them to sqlite3.
Otherwise, I might use a Perl script based on the DBI module
(see, for example and without endorsement,
http://zetcode.com/db/sqliteperltutorial/).
I hope this helps
Niall O'Reilly
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users