Example #1
0
void Preparation::prepare(std::size_t pos, const Poco::Any&)
{
	ODBCColumn col(_rStmt, pos);

	switch (col.type())
	{
		case MetaColumn::FDT_INT8:
			return preparePOD<Poco::Int8>(pos, SQL_C_STINYINT); 

		case MetaColumn::FDT_UINT8:
			return preparePOD<Poco::UInt8>(pos, SQL_C_UTINYINT);

		case MetaColumn::FDT_INT16:
			return preparePOD<Poco::Int16>(pos, SQL_C_SSHORT);

		case MetaColumn::FDT_UINT16:
			return preparePOD<Poco::UInt16>(pos, SQL_C_USHORT);

		case MetaColumn::FDT_INT32:
			return preparePOD<Poco::Int32>(pos, SQL_C_SLONG);

		case MetaColumn::FDT_UINT32:
			return preparePOD<Poco::UInt32>(pos, SQL_C_ULONG);

		case MetaColumn::FDT_INT64:
			return preparePOD<Poco::Int64>(pos, SQL_C_SBIGINT);

		case MetaColumn::FDT_UINT64:
			return preparePOD<Poco::UInt64>(pos, SQL_C_UBIGINT);

		case MetaColumn::FDT_BOOL:
			return preparePOD<bool>(pos, SQL_C_BIT);

		case MetaColumn::FDT_FLOAT:
			return preparePOD<float>(pos, SQL_C_FLOAT);

		case MetaColumn::FDT_DOUBLE:
			return preparePOD<float>(pos, SQL_C_DOUBLE);

		case MetaColumn::FDT_STRING:
			return prepareRaw(pos, SQL_C_CHAR, maxDataSize(pos));

		case MetaColumn::FDT_BLOB:
			return prepareRaw(pos, SQL_C_BINARY, maxDataSize(pos));

		default: 
			throw DataFormatException("Unsupported data type.");
	}

	prepareRaw(pos, SQL_C_BINARY, maxDataSize(pos));
}
Example #2
0
int AbstractSshChannel::handleChannelOrExtendedChannelData(const QByteArray &data)
{
    checkChannelActive();

    const int bytesToDeliver = qMin<quint32>(data.size(), maxDataSize());
    if (bytesToDeliver != data.size())
        qWarning("Misbehaving server does not respect local window, clipping.");

    m_localWindowSize -= bytesToDeliver;
    if (m_localWindowSize < maxPacketSize()) {
        m_localWindowSize += maxPacketSize();
        m_sendFacility.sendWindowAdjustPacket(m_remoteChannel, maxPacketSize());
    }
    return bytesToDeliver;
}