[freetds] Reusing STMT handle for use with placeholders and data at execution
frode at nordahl.net
Thu Feb 3 03:32:37 EST 2005
I have a small application that first does a quick query to check
something, then goes on to insert or update something based on the
results of the first query.
However, the second query fails, without any errors from GetDiagRec,
unless I call SQLFreeStmt with both SQL_CLOSE and SQL_RESET_PARAMS.
I ran SQL Profiler on the server, and saw that the actual query also
changed. Normally the placeholders are replaced with variable names,
but when not calling FreeStmt with SQL_RESET_PARAMS first, they show up
Should I allways call FreeStmt with SQL_RESET_PARAMS before attempting
to run a query using placeholders, or is this a bug somewhere?
SQLPrepare(hstmt, "SELECT COUNT(x) ...", SQL_NTS);
SQLPrepare(hstmt, "INSERT INTO x (a, b, c) VALUES (?, ?, ?)", SQL_NTS);
More information about the FreeTDS