Moved result set processing functions to modutil.c from tee.c.

This commit is contained in:
Markus Makela
2015-01-13 09:45:58 +02:00
parent e0a460b869
commit d194af0733
3 changed files with 41 additions and 38 deletions

View File

@ -31,7 +31,7 @@
#include <buffer.h>
#include <string.h>
#include <mysql_client_server_protocol.h>
#include <modutil.h>
/**
* Check if a GWBUF structure is a MySQL COM_QUERY packet
*
@ -493,3 +493,29 @@ GWBUF* modutil_get_next_MySQL_packet(
return_packetbuf:
return packetbuf;
}
/**
* Count the number of EOF packets in the buffer.
* @param reply Buffer to use
* @return Number of EOF packets
*/
int
modutil_count_EOF(GWBUF *reply)
{
unsigned char* ptr = (unsigned char*) reply->start;
unsigned char* end = (unsigned char*) reply->end;
int pktlen,eof = 0;
while(ptr < end)
{
pktlen = gw_mysql_get_byte3(ptr) + 4;
if(PTR_IS_EOF(ptr))
{
eof++;
}
ptr += pktlen;
}
return eof;
}