This commit is contained in:
Michael Kolupaev 2014-06-05 16:02:18 +04:00
parent 9c7b5555fd
commit 68f6a9263a

View File

@ -31,7 +31,7 @@ public:
Connection::Packet packet = connection.receivePacket();
if (Protocol::Server::Data == packet.type)
return packet.block;
return sample_block = packet.block;
else if (Protocol::Server::Exception == packet.type)
{
packet.exception->rethrow();
@ -48,6 +48,15 @@ public:
if (!sent_query)
sendQueryAndGetSampleBlock();
if (!blocksHaveEqualStructure(block, sample_block))
{
std::stringstream message;
message << "Block structure different from table structure.\n"
<< "\nTable structure:\n(" << sample_block.dumpStructure() << ")\nBlock structure:\n(" << block.dumpStructure() << ")\n";
throw DB::Exception(message.str());
}
connection.sendData(block);
}
@ -74,6 +83,7 @@ public:
private:
Connection & connection;
String query;
Block sample_block;
bool sent_query;
};