Ejemplo n.º 1
0
HiveReturn HiveRowSet::getFieldAsI64(size_t column_idx, int64_t* buffer, int* is_null_value,
                                     char* err_buf, size_t err_buf_len) {
  RETURN_ON_ASSERT(buffer == NULL, __FUNCTION__,
                   "Column data output buffer cannot be NULL.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(is_null_value == NULL, __FUNCTION__,
                   "Column data is_null_value (output) cannot be NULL.", err_buf, err_buf_len,
                   HIVE_ERROR);
  RETURN_ON_ASSERT(getColumnCount() == 0, __FUNCTION__,
                   "Rowset contains zero columns.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(column_idx >= getColumnCount(), __FUNCTION__,
                   "Column index out of bounds.", err_buf, err_buf_len, HIVE_ERROR);

  if (m_last_column_fetched != column_idx) {
    extractField(column_idx);
    m_bytes_read = 0; /* Reset the read offset if different from the last column fetched */
    m_last_column_fetched = column_idx;
    m_is_completely_read = false;
  }
  if (m_is_completely_read) {
    return HIVE_NO_MORE_DATA; /* This column has already been completely fetched */
  }
  /* If the column data is the same as the null format spec... */
  if (strcmp(getNullFormat(), m_field_buffer) == 0) {
    *is_null_value = 1;
    *buffer = 0;
  } else {
    *is_null_value = 0;
    *buffer = ATOI64(m_field_buffer);
  }
  m_is_completely_read = true;
  return HIVE_SUCCESS;
}
Ejemplo n.º 2
0
bool readXMLInteger64(xmlNodePtr node, const char* tag, uint64_t& value)
{
    char* nodeValue = (char*)xmlGetProp(node, (xmlChar*)tag);

    if (nodeValue) {
        value = ATOI64(nodeValue);
        xmlFree(nodeValue);
        return true;
    }

    return false;
}
Ejemplo n.º 3
0
int64_t MySQLResult::getDataLong(const std::string &s)
{
	listNames_t::iterator it = m_listNames.find(s);
	if(it == m_listNames.end())
	{
		std::cout << "Error during getDataLong(" << s << ")." << std::endl;
		return 0;
	}

	if(m_row[it->second] == NULL)
		return 0;

	return ATOI64(m_row[it->second]);
}
Ejemplo n.º 4
0
int64_t DBResult::getDataLong(const std::string& s) const
{
	listNames_t::const_iterator it = m_listNames.find(s);
	if (it == m_listNames.end()) {
		std::cout << "[Error - DBResult::getDataLong] Column '" << s << "' does not exist in result set." << std::endl;
		return 0;
	}

	if (m_row[it->second] == NULL) {
		return 0;
	}

	return ATOI64(m_row[it->second]);
}
Ejemplo n.º 5
0
s64t TCalcDisplay::getDisplay() { 
   return hexmode ? STRTOUL64(number,0,16) : ATOI64(number);
}