MySQL
-
I've been faffing around with MariaDB with the view to converting our SQL Server Apps. First step is to convert out CRUD code generator. I'm used to SQL Server which insists that I prefix a parameter value with @ MySQL has no such rule and you can end up with something like
select *
from vwTestMAF
where TestMAFID = -1 or TestMAFID = TestMAFID;where the TestMAFID is both the field name and the parameter name and the query naturally does not work. Is there a naming convention for MySQL parameter (prefixing the parameter name with @ did not work either!)
Never underestimate the power of human stupidity RAH
-
I've been faffing around with MariaDB with the view to converting our SQL Server Apps. First step is to convert out CRUD code generator. I'm used to SQL Server which insists that I prefix a parameter value with @ MySQL has no such rule and you can end up with something like
select *
from vwTestMAF
where TestMAFID = -1 or TestMAFID = TestMAFID;where the TestMAFID is both the field name and the parameter name and the query naturally does not work. Is there a naming convention for MySQL parameter (prefixing the parameter name with @ did not work either!)
Never underestimate the power of human stupidity RAH
Perhaps qualifying the field names could help.
...where vwTestMAF.TestMAFID = -1 or vwTestMAF.TestMAFID = TestMAFID;
Cheers, Mick ------------------------------------------------ It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
-
I've been faffing around with MariaDB with the view to converting our SQL Server Apps. First step is to convert out CRUD code generator. I'm used to SQL Server which insists that I prefix a parameter value with @ MySQL has no such rule and you can end up with something like
select *
from vwTestMAF
where TestMAFID = -1 or TestMAFID = TestMAFID;where the TestMAFID is both the field name and the parameter name and the query naturally does not work. Is there a naming convention for MySQL parameter (prefixing the parameter name with @ did not work either!)
Never underestimate the power of human stupidity RAH
The old MySQL method was to placehold with ? so and you had to add the values in the right order, currently MySQL uses @ and it works, not sure about MariaDB; select * from vwTestMAF where TestMAFID = -1 or TestMAFID = ?;
-
Perhaps qualifying the field names could help.
...where vwTestMAF.TestMAFID = -1 or vwTestMAF.TestMAFID = TestMAFID;
Cheers, Mick ------------------------------------------------ It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
Qualifying the names did the trick, I was hoping there was a standard convention the mysql users would recognise.