I have an application that allows the user to enter an SQL string with a placeholder for certain values my application produces. The application will the replace the placeholders with values and execute the SQL string through various database backends.
For the ODBC backend, I call SQLExecDirect() on the SQL strin which works nicely on regular queries, but fails for stored procedures with parameters.
Is there a simple way to extend this mechanism to support stored procedures ? A certain way how the SQL must be written ?
The only thing I can think of right now is to start parsing the SQL string and call SQLBindParameter() n times if it conatains a "call". But parsing SQL is tricky.
Any ideas ?
Working SQL example: SELECT columnA from foo where columnB = '%placeholder'
Non-working SQL: CALL StoredFoo('%placeholder')