Beispiel #1
0
//------------------------------------------------------------------------------
void WESplClient::write(const messageqcpp::ByteStream& Msg)
{
	setBytesTx(getBytesTx() + Msg.length());
	try
	{
		if(Msg.length()>0)
			fClnt->write(Msg);
	}
	catch(...)
	{
			//ignore it
	}
}
void BatchInsertProc::buildPkg(messageqcpp::ByteStream& bs)
{
	bs.reset();
	bs << (ByteStream::byte) WE_SVR_BATCH_INSERT;
	bs << fUniqueId;
	bs << (uint32_t) fTxnid;
	bs << fCurrentPMid; //to keep track of PMs
	bs += getPkg();
}
void BatchInsertProc::buildLastPkg(messageqcpp::ByteStream& bs)
{
	bs.reset();
	bs << (ByteStream::byte) WE_SVR_BATCH_INSERT_END;
	bs << fUniqueId;
	bs << (ByteStream::quadbyte) fTxnid;
	bs << (ByteStream::byte)fIsAutocommitOn;
	bs << fTableOid;
	bs << (ByteStream::byte) fErrorCode;
}
Beispiel #4
0
uint TupleConstantOnlyStep::nextBand(messageqcpp::ByteStream &bs)
{
	RGData rgDataOut;
	uint rowCount = 0;

	if (!fEndOfResult)
	{
		try
		{
			bs.restart();

			if (traceOn() && dlTimes.FirstReadTime().tv_sec == 0)
				dlTimes.setFirstReadTime();

			rgDataOut.reinit(fRowGroupOut, 1);
			fRowGroupOut.setData(&rgDataOut);

			fillInConstants();
			fRowGroupOut.serializeRGData(bs);
			rowCount = fRowGroupOut.getRowCount();
		}
		catch(const std::exception& ex)
		{
			catchHandler(ex.what(), fSessionId);
			if (status() == 0)
				status(tupleConstantStepErr);
		}
		catch(...)
		{
			catchHandler("TupleConstantStep next band caught an unknown exception", fSessionId);
			if (status() == 0)
				status(tupleConstantStepErr);
		}

		fEndOfResult = true;
	}
	else
	{
		// send an empty / error band
		RGData rgData(fRowGroupOut, 0);
		fRowGroupOut.setData(&rgData);
		fRowGroupOut.resetRowGroup(0);
		fRowGroupOut.setStatus(status());
		fRowGroupOut.serializeRGData(bs);

		if (traceOn())
		{
			dlTimes.setLastReadTime();
			dlTimes.setEndOfInputTime();
			printCalTrace();
		}
	}

	return rowCount;
}
Beispiel #5
0
uint32_t SubAdapterStep::nextBand(messageqcpp::ByteStream &bs)
{
	RGData rgDataOut;
	bool more = false;
	uint32_t rowCount = 0;

	try
	{
		bs.restart();
		
		more = fOutputDL->next(fOutputIterator, &rgDataOut);
		if (!more || cancelled())
		{
			//@bug4459.
			while (more)
				more = fOutputDL->next(fOutputIterator, &rgDataOut);			
			fEndOfResult = true;
		}

		if (more && !fEndOfResult)
		{
			fRowGroupDeliver.setData(&rgDataOut);
			fRowGroupDeliver.serializeRGData(bs);
			rowCount = fRowGroupDeliver.getRowCount();
		}
	}
	catch(const std::exception& ex)
	{
		catchHandler(ex.what(), ERR_IN_DELIVERY, fErrorInfo, fSessionId);
		while (more)
			more = fOutputDL->next(fOutputIterator, &rgDataOut);
		fEndOfResult = true;
	}
	catch(...)
	{
		catchHandler("SubAdapterStep next band caught an unknown exception",
						ERR_IN_DELIVERY, fErrorInfo, fSessionId);
		while (more)
			more = fOutputDL->next(fOutputIterator, &rgDataOut);
		fEndOfResult = true;
	}

	if (fEndOfResult)
	{
		// send an empty / error band
		RGData rgData(fRowGroupDeliver, 0);
		fRowGroupDeliver.setData(&rgData);
		fRowGroupDeliver.resetRowGroup(0);
		fRowGroupDeliver.setStatus(status());
		fRowGroupDeliver.serializeRGData(bs);
	}

	return rowCount;
}
/** @brief serializes the object into the passed byte stream.
*/
void TableColumn::serialize(messageqcpp::ByteStream& b)
{
    if (preserialized->length() != 0)
    {
        b += *preserialized;
        preserialized->reset();
// 		cerr << "returning a preserialized column" << endl;
        return;
    }

    messageqcpp::ByteStream::octbyte rowCount;
    messageqcpp::ByteStream::octbyte oid;
    messageqcpp::ByteStream::byte nullFlag;
    messageqcpp::ByteStream::byte columnType;

    oid = fColumnOID;
    b << oid;

    columnType = fColumnType;
    b << columnType;

    if (fIsNullColumn)
        nullFlag = 1;
    else
        nullFlag = 0;

    b << nullFlag;

    if (!fIsNullColumn)
    {
        if (fColumnType == UINT64)
        {
            rowCount = fIntValues->size();
            b << rowCount;
            b.append((uint8_t*) & (*fIntValues)[0], 8 * rowCount);
        }
        else if (fColumnType == STRING)
        {
            rowCount = fStrValues->size();
            b << rowCount;

            for (uint32_t i = 0; i < rowCount; i++)
                b << (*fStrValues)[i];
        }
    }


}
Beispiel #7
0
uint32_t TupleUnion::nextBand(messageqcpp::ByteStream &bs)
{
	RGData mem;
	bool more;
	uint32_t ret = 0;

	bs.restart();
	more = output->next(outputIt, &mem);
	if (more)
		outputRG.setData(&mem);
	else {
		mem = RGData(outputRG, 0);
		outputRG.setData(&mem);
		outputRG.resetRowGroup(0);
		outputRG.setStatus(status());
	}
	outputRG.serializeRGData(bs);
	ret = outputRG.getRowCount();

	return ret;
}
Beispiel #8
0
uint32_t TupleHavingStep::nextBand(messageqcpp::ByteStream &bs)
{
	RGData rgDataIn;
	RGData rgDataOut;
	bool more = false;
	uint32_t rowCount = 0;

	try
	{
		bs.restart();

		more = fInputDL->next(fInputIterator, &rgDataIn);
		if (dlTimes.FirstReadTime().tv_sec ==0)
            dlTimes.setFirstReadTime();

		if (!more || cancelled())
		{
			fEndOfResult = true;
		}

		bool emptyRowGroup = true;
		while (more && !fEndOfResult && emptyRowGroup)
		{
			if (cancelled())
			{
				while (more)
					more = fInputDL->next(fInputIterator, &rgDataIn);
				break;
			}

			fRowGroupIn.setData(&rgDataIn);
			rgDataOut.reinit(fRowGroupOut, fRowGroupIn.getRowCount());
			fRowGroupOut.setData(&rgDataOut);

			doHavingFilters();

			if (fRowGroupOut.getRowCount() > 0)
			{
				emptyRowGroup = false;
				fRowGroupOut.serializeRGData(bs);
				rowCount = fRowGroupOut.getRowCount();
			}
			else
			{
				more = fInputDL->next(fInputIterator, &rgDataIn);
			}
		}

		if (!more)
		{
			fEndOfResult = true;
		}
	}
	catch(const std::exception& ex)
	{
		catchHandler(ex.what(), tupleHavingStepErr, fErrorInfo, fSessionId);
		while (more)
			more = fInputDL->next(fInputIterator, &rgDataIn);
		fEndOfResult = true;
	}
	catch(...)
	{
		catchHandler("TupleHavingStep next band caught an unknown exception",
					 tupleHavingStepErr, fErrorInfo, fSessionId);
		while (more)
			more = fInputDL->next(fInputIterator, &rgDataIn);
		fEndOfResult = true;
	}

	if (fEndOfResult)
	{
		// send an empty / error band
		rgDataOut.reinit(fRowGroupOut, 0);
		fRowGroupOut.setData(&rgDataOut);
		fRowGroupOut.resetRowGroup(0);
		fRowGroupOut.setStatus(status());
		fRowGroupOut.serializeRGData(bs);

		dlTimes.setLastReadTime();
		dlTimes.setEndOfInputTime();

		if (traceOn())
			printCalTrace();
	}

	return rowCount;
}
Beispiel #9
0
uint TupleAnnexStep::nextBand(messageqcpp::ByteStream &bs)
{
    RGData rgDataOut;
    bool more = false;
    uint rowCount = 0;

    try
    {
        bs.restart();

        more = fOutputDL->next(fOutputIterator, &rgDataOut);
        if (traceOn() && dlTimes.FirstReadTime().tv_sec ==0)
            dlTimes.setFirstReadTime();

        if (more && !cancelled())
        {
            fRowGroupDeliver.setData(&rgDataOut);
            fRowGroupDeliver.serializeRGData(bs);
            rowCount = fRowGroupDeliver.getRowCount();
        }
        else
        {
            if (more)
                more = fOutputDL->next(fOutputIterator, &rgDataOut);
            fEndOfResult = true;
        }
    }
    catch(const std::exception& ex)
    {
        catchHandler(ex.what(), fSessionId);
        if (status() == 0)
            status(ERR_IN_DELIVERY);
        while (more)
            more = fOutputDL->next(fOutputIterator, &rgDataOut);
        fEndOfResult = true;
    }
    catch(...)
    {
        catchHandler("TupleAnnexStep next band caught an unknown exception", fSessionId);
        if (status() == 0)
            status(ERR_IN_DELIVERY);
        while (more)
            more = fOutputDL->next(fOutputIterator, &rgDataOut);
        fEndOfResult = true;
    }

    if (fEndOfResult)
    {
        // send an empty / error band
        rgDataOut.reinit(fRowGroupDeliver, 0);
        fRowGroupDeliver.setData(&rgDataOut);
        fRowGroupDeliver.resetRowGroup(0);
        fRowGroupDeliver.setStatus(status());
        fRowGroupDeliver.serializeRGData(bs);

        if (traceOn())
        {
            dlTimes.setLastReadTime();
            dlTimes.setEndOfInputTime();
        }

        if (traceOn())
            printCalTrace();
    }

    return rowCount;
}
Beispiel #10
0
void TypelessData::serialize(messageqcpp::ByteStream &b) const
{
	b << len;
	b.append(data, len);
}