/* gcc bug21582.c -g -o bug21582 -L/home/sbester/servers/5.0-bk/lib -I/home/sbester/servers/5.0-bk/include -lmysqlclient -lz */ #include #include #include #include #include "mysql.h" char *query="/*bug21582*/ CREATE TEMPORARY TABLE `a`(`b` INT)ENGINE=MyISAM"; int main() { MYSQL *mysql; MYSQL_RES *r=NULL; int count=0; int res=0; int error=0; my_bool b=1; printf("\nBUG21582 testcase. http://bugs.mysql.com/bug.php?id=21582\n"); printf("-----------------------------------------------------------\n"); for(count=0;count<10000;count++) { if(count % 50==0) printf("loop: %07d\n",count); mysql=mysql_init(NULL); if(!mysql_real_connect(mysql,"127.0.0.1", "root", "12345", "test",3306, NULL, 0)) { printf("Cannot connect: %s\n",mysql_error(mysql)); sleep(10); } else { res=mysql_query(mysql,query); if(res!=0) { printf("query failed: %s\n",mysql_error(mysql)); error++; } mysql_close(mysql); } } printf("\n\nTotal errors = %d\n",error); }