How can I conditionally parametrize a SQLite database in AIR? For example this query:
//selectedID is the ID I want to select
query.text = "select * from table where id=@ID";
query.parameters['@ID']=selectedID;
But I want the where
statement to appear only if selectedID
is greater than 0.
What I would normally do is:
query.text = "select * from table"+(selectedID>0?" where id="+selectedID:'');
However, I read on the LiveDocs performance-wise it is better to use paramet开发者_运维知识库ers.
Is it possible to parametrize a whole statement or that's only possible for values? Or maybe this is good-enough:
query.text = "select * from table"+(selectedID>0?" where id=@ID":'');
query.parameters['@ID']=selectedID;
if (selectedID > 0)
{
query.text = .....
query.parameters['@ID'] = ...
}
else
{
query.text = .....
{
精彩评论