Cicode Programming Reference > Cicode Function Categories > SQL Functions > SQLParamsClearAll

SQLParamsClearAll

Remove all parameters associated with a particular connection object.

Each database provider (Odbc, OleDb, SQL Server) uses parameterized queries in a different way. It is recommended that you look at documentation and examples included with your database.

This function is a blocking function and should not be called from a foreground task.

Building queries from pieces (SQLSet, SQLAppend) or adding parameters to either queries or connections (SQLParam functions) requires a few calls to respective CiCode functions. If a few functions try to manipulate the same connection in the same time some conflicts and unintended operations may occur. It is a typical multithreading problem.

To avoid this, instead of manipulating connections, consider using locally created and locally disposed queries. For example:

int function SAFE_SQL_CICODE_MULTITHREAD_USE()
//locally created query
int hStmt = SQLQueryCreate(hConnection);

//Set the query
SQLSet(hStmt, "select * from TAB where NAME=@Name");

//Add parameters to the query
SQLParamsSetAsString(hStmt, "Name", "Aaa");

//Execute the query
SQLGetRecordset(hStmt, "");

//the locally created query is disposed
SQLQueryDispose(hStmt);
End

Syntax

SQLParamsClearAll(hSQL)

hSQL:

The handle to the DB connection object, returned from either SQLCreate() or SQLConnect() function. The handle identifies the DB connection object where details of the associated SQL connection are stored.

Return Value

0 (zero) if successful, otherwise an error number is returned. (For details of the 307 error code, call the SQLErrMsg function).

Related Functions

SQLSet, SQLAppend, SQLExec, SQLGetRecordset, SQLCall, SQLGetScalar, SQLEnd, SQLParamsSetAsInt, SQLParamsSetAsReal, SQLParamsSetAsString, SQLParamsClearAll

Example

See SQLParamsSetAsInt

SQL Functions

Published June 2018