At first I was thinking I was running into an issue with cfqueryparam and mysql. However when I change substitute them with static values I get the same error. This is stumping me, I'm too used to Microsoft SQL Server I guess. Any help would be greatly appreciated.
Here's the query, this works perfectly in mySql query browser, but fails when I run in cfquery:
LOCK TABLE categories WRITE;
SELECT @myRight := rgt FROM categories WHERE catid = <cfqueryparam cfsqltype="cf_sql_integer" value="#parentCategoryId#">;
UPDATE categories SET rgt = rgt + 2 WHERE rgt > @myRight;
UPDATE categories SET lft = lft + 2 WHERE lft > @myRight;
INSERT INTO categories(categoryName, lft, rgt) VALUES(<cfqueryparam cfsqltype="cf_sql_varchar" value="#newCatName#">, @myRight, @myRight + 2);
UNLOCK TABLES;
I'm getting the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT @myRight := rgt FROM categories WHERE catid = 5; UPDATE categories SE' at line 2
VENDORERRORCODE:1064 SQL State: 42000