Grupo cniElementValue

Essas funções recuperam o valor do elemento de sintaxe especificado.

Sintaxe

CciSize cniElementBitArrayValue(
    int*            returnCode,
    CciElement*     targetElement,
    const struct CciBitArray*   value);
CciBool
cniElementBooleanValue(
    int*            returnCode,
    CciElement*  targetElement);
CciSize
cniElementByteArrayValue(
    int*            returnCode,
    CciElement*     targetElement,
    const struct CciByteArray*  value);
CciSize
cniElementCharacterValue(
    int*            returnCode,
    CciElement*     targetElement,
    const CciChar*             value,
    CciSize                    length);
struct CciDate
cniElementDateValue(
    int*            returnCode,
    CciElement*  targetElement);
CciSize
cniElementDecimalValue(
    int*            returnCode,
    CciElement*     targetElement,
    const CciChar*             value,
    CciSize                    length);
struct CciTimestamp
cniElementGmtTimestampValue(
    int*            returnCode,
    CciElement*  targetElement);
struct CciTime
cniElementGmtTimeValue(
    int*            returnCode,
    CciElement*  targetElement);
CciInt
cniElementIntegerValue(
    int*            returnCode,
    CciElement*  targetElement);
CciReal
cniElementRealValue(
    int*            returnCode,
    CciElement*  targetElement);
struct CciTimestamp
cniElementTimestampValue(
    int*            returnCode,
    CciElement*  targetElement);
struct CciTime
cniElementTimeValue(
    int*            returnCode,
    CciElement*  targetElement);

Parâmetros

returnCode
O código de retorno da função (saída).
Os possíveis códigos de retorno são:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
  • CCI_INV_DATA_POINTER
  • CCI_INV_DATA_BUFLEN
  • CCI_INV_BUFFER_TOO_SMALL
targetElement
O endereço do objeto do elemento de sintaxe de destino (entrada).
value
O endereço de um buffer de saída no qual o valor do elemento de sintaxe é armazenado (entrada). Utilizado somente nas chamadas de funções relevantes.
length
O comprimento do buffer de saída, em caracteres, especificado pelo parâmetro value (entrada). Utilizado somente nas chamadas de funções relevantes.

Valores de Retorno

  • Se bem-sucedida, o valor do elemento de destino é retornado.
  • Se o tamanho dos dados de um elemento puder variar, o tamanho correto dos dados é retornado.
  • Se o comprimento especificado for muito pequeno, o código de erro é definido como CCI_BUFFER_TOO_SMALL.
  • Se ocorrer um erro, o parâmetro returnCode indica o motivo do erro.

Exemplo

     numberOfChars     = cniElementCharacterValue(
		&rc, firstChild, (CciChar*)&elementValue,
sizeof(elementValue)
		 		 );

if (rc==CCI_BUFFER_TOO_SMALL) {
        free(elementValue);
        elementValue      = (CciChar*)malloc(numberOfChars * sizeof(CciChar));
        numberOfChars     = cniElementCharacterValue(
                                    &rc, firstChild, (CciChar*)&elementValue, sizeof(elementValue));
  }
Avisos | Marcas Registradas | Downloads | Biblioteca | Suporte | Feedback
Direitos Autorais IBM Corporation 1999, 2006 Última Atualização: 1 Sep 2006
as07910_