On Thu, 25 Oct 2012 01:20:24 +0000, YAN HONG YE <yanhong...@mpsa.com>
wrote:

>char bh1[320];
>memset(bh1,0,320);
>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");
>system(bh1);                          //here couldn't work

As we said before "here couldn't work" is insufficient to describe your
problem.  Please show us the contents of bh1 just before the system()
call, and the error codes and error messages returned.

It is bad practice to shell out to the sqlite3 commandline tool from
within a program. As you see, you'll get all kinds of quoting issues
(probably the root cause of the failure here). 

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.

There is excellent sample code on the internet, like
http://icculus.org/~chunky/stuff/sqlite3_example/sqlite3_example_bind.c

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