lrd_bind_placeholder

Binds a host variable to a placeholder.

LRDRET lrd_bind_placeholder( LRD_CURSOR *mptCursor, char *mpszPlaceholder, LRD_VAR_DESC *mptVarDesc, unsigned long muliOption, int miDBErrorSeverity );

mptCursor A pointer to an LRD_CURSOR structure.
mpszPlaceholder A pointer to a string containing the placeholder name.
mptVarDesc A pointer to the descriptor of a variable being bound.
muliOption One of the LRD Binding Options.
miDBErrorSeverity The Error Severity Levels of a failure in a database routine.

The lrd_bind_placeholder function binds a host variable or array to a placeholder. This function is used together with lrd_assign.

For more details refer to the Function Header File lrd.h in the include directory.

Return Values

See LRD Return Values.

Parameterization

The following argument can be parameterized using standard parameterization: mpszPlaceholder

Example

In the following example, lrd_assign assigns values to the host variable F_D1 and L_D2. The lr_bind_placeholder function binds the host variable to the placeholders F and L.

 /* Insert employee data into the employee table. */
// For Oracle 
lrd_stmt(Csr2, "insert into employees (emp_firstname,emp_lastname)", "values(:F,:L)", -1, 1 /*Deferred*/, 1 /*Dflt Ora Ver*/, 0);

/* For OCBC values in lrd_stmt are represented with "?": "values(?,?)" */
lrd_assign(&F_D1, "Jim", "", 0, 0);
lrd_assign(&F_D1, "Bob", "", 1, 0);
lrd_assign(&F_D1, "Mike", "", 2, 0);

// For Oracle 
lrd_bind_placeholder(Csr2, "F", &F_D1, 0, 0);
/* For ODBC, use column number as place holder instead of "F":
    lrd_bind_placeholder(Csr2, "1", &F_D1, 0, 0); */
lrd_assign(&L_D2, "Smith", "", 0, 0);
lrd_assign(&L_D2, "Jones", "", 1, 0);
lrd_assign(&L_D2, "Anderson", "", 2, 0);

// For Oracle
lrd_bind_placeholder(Csr2, "L", &L_D2, 0, 0);
/* For ODBC, use column number as place holder instead of "L":
    lrd_bind_placeholder(Csr2, "2", &L_D2, 0, 0);  */