[sqlite] store query

2010-01-07 Thread Fabio Spadaro
hi all.

I'm building an wxPython' application  in advanced cases may require a
user to write a query and run it. I would also expect that the same
query is saved in the database to be reused whenever you want.
Someone gives me an indication?

-- 
Fabio Spadaro
www.fabiospadaro.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] store query

2010-01-07 Thread Simon Slavin

On 7 Jan 2010, at 8:29am, Fabio Spadaro wrote:

 I'm building an wxPython' application  in advanced cases may require a
 user to write a query and run it. I would also expect that the same
 query is saved in the database to be reused whenever you want.
 Someone gives me an indication?

Sure.  Use sqlite3_exec() to execute the query (since it will be supplied as a 
long string of text rather than bound variables).  And use a table with a TEXT 
column to store the queries in.

http://www.sqlite.org/c3ref/exec.html

You may have to deal with attempts to hack your database (i.e. to execute some 
command other than a SELECT), and you'll have to deal with quote signs 
carefully when you store and retrieve your queries.

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