SQLDBC::PreparedStatement::bindParameter

Prototypes

SQLDBC_Retcode SQLDBC::PreparedStatement::bindParameter(const SQLDBC_UInt2 Index, const SQLDBC_HostType Type, void *paramAddr, SQLDBC_Length *LengthIndicator, const SQLDBC_Length Size, const SQLDBC_Bool Terminate=SQLDBC_TRUE);

Description

Lie le paramètre de numéro Index à l'ordre Sql courant. La numérotation des paramètres commence à 1.

Le type natif du paramètre est donné par Type.

La taille maximale d'une valeur du paramètre est donnée par Size.

La valeur du paramètre est transmise par l'adresse paramAddr et son indicateur ou sa taille par LengthIndicator.

Les valeurs possibles de Type sont les suivantes :

Les valeurs possibles de StrLen_or_IndPtr sont les suivantes :

Le résultat est SQLDBC_OK en cas de succès.

Exemple

#include <SQLDBC.h>

static SQLDBC_PreparedStatement *hOrdreSql;
static long E;
static SQLDBC_Length IndicateurE;
static long TableE[256];
static SQLDBC_Length IndicateurTableE[256];
static char C[20];
static SQLDBC_Length IndicateurC;
static char TableC[256][20];
static SQLDBC_Length IndicateurTableC[256];

...
/* Parametre unitaire. */
if (hOrdreSql->bindParameter(1, SQLDBC_HOSTTYPE_INT4, (void *)&E, 0, &IndicateurE, sizeof(long))!=SQLDBC_OK) ...
/* Parametre en tableau. */
if (hOrdreSql->bindParameter(2, SQLDBC_HOSTTYPE_INT4, (void *)TableE, 0, IndicateurTableE, sizeof(long))!=SQLDBC_OK) ... /* Parametre unitaire. */
if (hOrdreSql->bindParameter(1, SQLDBC_HOSTTYPE_ASCII, (void *)&C, 0, &IndicateurC, sizeof(char)*20)!=SQLDBC_OK) ...
/* Parametre en tableau. */
if (hOrdreSql->bindParameter(2, SQLDBC_HOSTTYPE_ASCII, (void *)TableC, 0, IndicateurTableC, sizeof(char)*20)!=SQLDBC_OK) ...

Voir aussi

SQLDBC::PreparedStatement::setBatchSize pour fixer la taille des tableaux des paramètres d'un ordre Sql. SQLDBC::PreparedStatement::bindColumn pour lier un résultat d'une requête. SQLDBC::Connection::releaseStatement pour libérer un ordre Sql.