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
Recebe 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));
}
Notices | Trademarks | Downloads | Library | Support | Feedback
Copyright IBM Corporation 1999, 2006 Last updated: 5월 25, 2006
as07910_