On Wed, 24 Oct 2012 09:00:31 +0000, YAN HONG YE <yanhong...@mpsa.com>
wrote:

>
>sqlite3 -html -header t9_engine.db "select id,partnumber,\"abc.jpg\" as 
>img,pcs from engine where id>7;" >> n.html
>here               \"abc.jpg\"         couldn't work.

Please be more specific about "couldn't work". 
What error message did you get? 

By the way, in SQL, delimiters for string literals are single quotes, 
so you need to code 'abc.jpg'.


>sqlite3 -html -header t9_engine.db "select id,partnumber,'<img src=\"  
>'||pic||' \" height=220/>' as img,pcs from engine where id>7; ">> n.html
>Same problem.

Same comment: wat error message do you get?
It works for me (Ubuntu, bash shell) :

$ sqlite3 t9_engine.db
SQLite version 3.7.14.1 2012-10-04 19:37:12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table engine (id integer,partnumber integer,pic text,pcs
integer);
sqlite> insert into engine values (8,9,'abc',2);
sqlite> .q

$ sqlite3 -html -header t9_engine.db "select id,partnumner,'<img src=\"
'||pic||' \" height=220/>' as img,pcs from engine where id>7; "
<TR><TH>id</TH>
<TH>partnumner</TH>
<TH>img</TH>
<TH>pcs</TH>
</TR>
<TR><TD>8</TD>
<TD>9</TD>
<TD>&lt;img src=&quot;  abc &quot; height=220/&gt;</TD>
<TD>2</TD>
</TR>
$ 


>strcpy(bh1,"sqlite3 -html -header t9_engine.db \"select 
>id,partnumber,substr(\'<img src=\"\'||pic||\'\" height=220/>\',1,180) as 
>img,pcs from engine where id>7;\" >> n.html");
>Same problem.

This just produces a text string (if the code is correct). 
It is bad practice to fork to the sqlite3 commandline tool from within a
program. You are supposed to use the API, either the C-API
http://sqlite.org/c3ref/intro.html or some API provided by a "wrapper"
for the computer language your application is coded in.
By the way, I don't think the substr() is at the right place.

Hope this helps.

-- 
Groet, Cordialement, Pozdrawiam, Regards,

Kees Nuyt

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

Reply via email to