Posted At : February 10, 2008 10:32 AM 3 Comments
If you want to utilise multiple queries per sql statement and you are using the MYSQL JDBC connector you need to add the following to your jdbc connector querystring.
This will allow you to do queries like the following to return autoincrement values:
Please note however that this functionality is disabled as it can leave the door open for SQL Injection attacks. However, as long as you always use cfqueryparam for all the dynamic parts of your query you will be fine.
3 Comments
If you allow multiple queries, are you setting yourself up for SQL injection?
Hi tsammons,
Yes and No - you are opening a potential way that sql injection queries can happen, by appending a semi-colon and writing a new query. But if you are correctly using cfqueryparam's in all your queries then it won't happen.
And conversely by not allowing multiple queries, you are not protecting yourself from all potential SQL injection's attacks.
Cheers,
Mark
Brill -This looks like this can reduce the need for a CFLOCK or CFTRANSACTION around an insert while we write the record and then retrieve the new ID.
Additionally, bulk insertion of data should be quicker too.
Thanks
Martin