SQLRETURN SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGER StringLength);
La valeur de l'option est donnée par le paramètre ValuePtr de taille StringLength.
Voici les attributs usuels :
Le résultat est SQL_SUCCESS en cas de succès.
#include <sqlcli1.h>
static SQLHANDLE hConnexion;
static SQLINTEGER Option;
...
if (SQLSetStmtAttr(hConnexion, SQL_ATTR_DEFERRED_PREPARE, (SQLPOINTER)SQL_DEFERRED_PREPARE_ON, SQL_NTS)!=SQL_SUCCESS)
{
...
}
...
if (SQLSetStmtAttr(hConnexion, SQL_ATTR_NOSCAN, (SQLPOINTER)SQL_NOSCAN_ON, SQL_NTS)!=SQL_SUCCESS)
{
...
}
...
if (SQLSetStmtAttr(hConnexion, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER)30, SQL_NTS)!=SQL_SUCCESS)
{
...
}
...
if (SQLSetStmtAttr(hConnexion, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER)SQL_NONSCROLLABLE, SQL_NTS)!=SQL_SUCCESS)
{
...
}
...
if (SQLSetStmtAttr(hConnexion, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER)SQL_NONSCROLLABLE, SQL_NTS)!=SQL_SUCCESS)
{
...
}
...
if (SQLSetStmtAttr(hConnexion, SQL_ATTR_BLOCK_FOR_NROWS, (SQLPOINTER)8192, SQL_NTS)!=SQL_SUCCESS)
{
...
}
...
if (SQLSetStmtAttr(hConnexion, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTER)256, SQL_NTS)!=SQL_SUCCESS)
{
...
}
...
if (SQLSetStmtAttr(hConnexion, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)256, SQL_NTS)!=SQL_SUCCESS)
{
...
}
...
if (SQLGetStmtAttr(hConnexion, SQL_ATTR_DEFERRED_PREPARE, (SQLPOINTEUR)&Option, sizeof(SQLINTEGER), NULL)!=SQL_SUCCESS)
{
...
}
...
if (SQLGetStmtAttr(hConnexion, SQL_ATTR_NOSCAN, (SQLPOINTEUR)&Option, sizeof(SQLINTEGER), NULL)!=SQL_SUCCESS)
{
...
}
...
if (SQLGetStmtAttr(hConnexion, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTEUR)&Option, sizeof(SQLINTEGER), NULL)!=SQL_SUCCESS)
{
...
}
...
if (SQLGetStmtAttr(hConnexion, SQL_ATTR_CURSOR_TYPE, (SQLPOINTEUR)&Option, sizeof(SQLINTEGER), NULL)!=SQL_SUCCESS)
{
...
}
...
if (SQLGetStmtAttr(hConnexion, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTEUR)&Option, sizeof(SQLINTEGER), NULL)!=SQL_SUCCESS)
{
...
}
...
if (SQLGetStmtAttr(hConnexion, SQL_ATTR_BLOCK_FOR_NROWS, (SQLPOINTEUR)&Option, sizeof(SQLINTEGER), NULL)!=SQL_SUCCESS)
{
...
}
...
if (SQLGetStmtAttr(hConnexion, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTEUR)&Option, sizeof(SQLINTEGER), NULL)!=SQL_SUCCESS)
{
...
}
...
if (SQLGetStmtAttr(hConnexion, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTEUR)&Option, sizeof(SQLINTEGER), NULL)!=SQL_SUCCESS)
{
...
}
...
if (SQLGetStmtAttr(hConnexion, SQL_ATTR_ROWS_FETCHED_PTR, (SQLPOINTEUR)&Option, sizeof(SQLINTEGER), NULL)!=SQL_SUCCESS)
{
...
}
...