/*
**    Name: fetch.c
**
**    Date: Thu Jan 17 12:02:13 2002
**
*/

#include "ODBC.h"
#include "rmamem.h"
#include <string.h>

/* Copy an output back to the caller; never more than was copied in */

void fetch_parameter(int parameter,ODBCLibParameterType type,int size)
    {
    int index;

    index = odbcparameter_index;

    if (index >= ODBCLIBMAXPARAMETERS)
        {
        return;
        }

    odbcparameter_index++;

    if (type == ODBC_VALUE || parameter <= 0)
        {
        return;
        }

    if (odbcquerytype.parameters[index].type == ODBC_REFERENCE &&
        odbcquerytype.parameters[index].value != 0 &&
        odbcparameter_copyback[index] > 0)
        {
        memcpy((void *)parameter,
               (void *)odbcquerytype.parameters[index].value,
               odbcparameter_copyback[index]);
        }
    }
