Exemplo n.º 1
0
void
Ndbinfo::Row::check_attribute_type(AttributeHeader& ah, ColumnType type) const
{
  const Table& tab = getTable(m_req.tableId);
  const Uint32 colid = ah.getAttributeId();
  assert(colid < (Uint32)tab.m.ncols);
  assert(tab.col[colid].coltype == type);
}
bool
NdbInfoScanOperation::execDBINFO_TRANSID_AI(const SimpleSignal * signal)
{
  DBUG_ENTER("NdbInfoScanOperation::execDBINFO_TRANSID_AI");
  const TransIdAI* transid =
          CAST_CONSTPTR(TransIdAI, signal->getDataPtr());
  if (transid->connectPtr != m_result_data ||
      transid->transId[0] != m_transid0 ||
      transid->transId[1] != m_transid1)
  {
    // Drop signal that belongs to previous scan
    DBUG_RETURN(true); // Continue waiting
  }

  m_rows_received++;
  DBUG_PRINT("info", ("rows received: %d", m_rows_received));

  // Reset all recattr values before reading the new row
  for (unsigned i = 0; i < m_recAttrs.size(); i++)
  {
    if (m_recAttrs[i])
      m_recAttrs[i]->m_defined = false;
  }

  // Read attributes from long signal section
  AttributeHeader* attr = (AttributeHeader*)signal->ptr[0].p;
  AttributeHeader* last = (AttributeHeader*)(signal->ptr[0].p +
                                            signal->ptr[0].sz);
  while (attr < last)
  {
    const Uint32 col = attr->getAttributeId();
    const Uint32 len = attr->getByteSize();
    DBUG_PRINT("info", ("col: %u, len: %u", col, len));
    if (col < m_recAttrs.size())
    {
      NdbInfoRecAttr* rec_attr = m_recAttrs[col];
      if (rec_attr)
      {
        // Update NdbInfoRecAttr pointer, length and defined flag
        rec_attr->m_data = (const char*)attr->getDataPtr();
        rec_attr->m_len = len;
        rec_attr->m_defined = true;
      }
    }

    attr = attr->getNext();
  }

  DBUG_RETURN(false); // Don't wait more, process this row
}
Exemplo n.º 3
0
bool
Ndbinfo::Row::check_buffer_space(AttributeHeader& ah) const
{
  const Uint32 needed =  ah.getHeaderSize() + ah.getDataSize();
  const Uint32 avail = (Uint32)(end - curr);

  if(needed > avail)
  {
    ndbout_c("Warning, too small row buffer for attribute: %d, "
             "needed: %d, avail: %d", ah.getAttributeId(), needed, avail);
    assert(false);
    return false; // Not enough room in row buffer
  }
  return true;
}