SQLite Parameters - Not allowing tablename as parameter

前端 未结 2 1101
盖世英雄少女心
盖世英雄少女心 2020-11-29 09:18

I\'m developing an application in AIR via Flex, but I\'m not seeing where I\'m going wrong with SQLite (I\'m used to MySQL). Parameters work, but only in certain instances.

2条回答
  •  星月不相逢
    2020-11-29 09:59

    Not sure if this is the same but I ran across something similar in Java. Basically you can't add a table as a parameter so you must generate the statement like so:

    var statement:SQLStatement = new SQLStatement();
    statement.connection = connection;
    statement.text = stringUtil.substitute("INSERT :Fields FROM {0}", "Category");
    statement.parameters[":Fields"] = "*";
    statement.execute;
    

    This is mostly likely not the securest solution, so you might want to some custom validation of the data before you add the table name.. so someone doesn't try to send it the table name ";drop tableName..."

提交回复
热议问题