Formatted the canonical query test.
The file is now formatted according to the style guide.
This commit is contained in:
@ -42,6 +42,12 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!utils_init())
|
||||||
|
{
|
||||||
|
printf("Utils library init failed.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (mysql_library_init(num_elements, server_options, server_groups))
|
if (mysql_library_init(num_elements, server_options, server_groups))
|
||||||
{
|
{
|
||||||
printf("Embedded server init failed.\n");
|
printf("Embedded server init failed.\n");
|
||||||
@ -57,29 +63,31 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!feof(infile) && fgets(readbuff, 4092, infile))
|
while (!feof(infile) && fgets(readbuff, 4092, infile))
|
||||||
{
|
{
|
||||||
fgets(readbuff,4092,infile);
|
char* nl = strchr(readbuff, '\n');
|
||||||
char* nl = strchr(readbuff, '\n');
|
if (nl)
|
||||||
if(nl)
|
{
|
||||||
{
|
*nl = '\0';
|
||||||
*nl = '\0';
|
}
|
||||||
}
|
if (strlen(readbuff) > 0)
|
||||||
psize = strlen(readbuff);
|
{
|
||||||
qbuff = gwbuf_alloc(psize + 7);
|
psize = strlen(readbuff);
|
||||||
*(qbuff->sbuf->data + 0) = (unsigned char)psize;
|
qbuff = gwbuf_alloc(psize + 7);
|
||||||
*(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8);
|
*(qbuff->sbuf->data + 0) = (unsigned char) psize;
|
||||||
*(qbuff->sbuf->data + 2) = (unsigned char)(psize>>16);
|
*(qbuff->sbuf->data + 1) = (unsigned char) (psize >> 8);
|
||||||
*(qbuff->sbuf->data + 4) = 0x03;
|
*(qbuff->sbuf->data + 2) = (unsigned char) (psize >> 16);
|
||||||
memcpy(qbuff->start + 5,readbuff,psize + 1);
|
*(qbuff->sbuf->data + 4) = 0x03;
|
||||||
tok = qc_get_canonical(qbuff);
|
memcpy(qbuff->start + 5, readbuff, psize + 1);
|
||||||
fprintf(outfile,"%s\n",tok);
|
tok = qc_get_canonical(qbuff);
|
||||||
free(tok);
|
fprintf(outfile, "%s\n", tok);
|
||||||
gwbuf_free(qbuff);
|
free(tok);
|
||||||
|
gwbuf_free(qbuff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fclose(infile);
|
fclose(infile);
|
||||||
fclose(outfile);
|
fclose(outfile);
|
||||||
mysql_library_end();
|
mysql_library_end();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user