mariadb/tests/insert_test.c
unknown ac02f54022 Removed some not used files
Remove the 'fs' file systems as this is not maintained.
Moved programs from client to tests


tests/deadlock_test.c:
  Rename: div/deadlock_test.c -> tests/deadlock_test.c
BitKeeper/deleted/.del-CorbaFS.idl~719ba9d93c206620:
  Delete: fs/CorbaFS.idl
BitKeeper/deleted/.del-Makefile.am~95f21e278745904c:
  Delete: fs/Makefile.am
BitKeeper/deleted/.del-RunServer.sh~34ea2653535fbb5c:
  Delete: fs/RunServer.sh
BitKeeper/deleted/.del-database.c~af098622e818ce0d:
  Delete: fs/database.c
BitKeeper/deleted/.del-dump.sql~68646092f0c5bc96:
  Delete: fs/dump.sql
BitKeeper/deleted/.del-korbit-kernel-2.4.1-patch~742e5e67c1132b2e:
  Delete: fs/korbit-kernel-2.4.1-patch
BitKeeper/deleted/.del-libmysqlfs.c~70cc07d61deedd16:
  Delete: fs/libmysqlfs.c
BitKeeper/deleted/.del-libmysqlfs.h~7b60f308be50370e:
  Delete: fs/libmysqlfs.h
BitKeeper/deleted/.del-my.cnf~bbd975fd6377e704:
  Delete: fs/my.cnf
BitKeeper/deleted/.del-mysqlcorbafs.c~fc58c116eeea996a:
  Delete: fs/mysqlcorbafs.c
BitKeeper/deleted/.del-mysqlcorbafs.h~414821d6836e655a:
  Delete: fs/mysqlcorbafs.h
BitKeeper/deleted/.del-mysqlcorbafs_test.c~8bb3afa230542e05:
  Delete: fs/mysqlcorbafs_test.c
BitKeeper/deleted/.del-README~b9f437fbd6dce7a5:
  Delete: fs/README
BitKeeper/deleted/.del-mysqlfsck~247a2d2b9729b95e:
  Delete: fs/mysqlfsck
tests/insert_test.c:
  Rename: client/insert_test.c -> tests/insert_test.c
tests/list_test.c:
  Rename: client/list_test.c -> tests/list_test.c
tests/select_test.c:
  Rename: client/select_test.c -> tests/select_test.c
BitKeeper/deleted/.del-thimble.cc~3fa3754a4c639242:
  Delete: client/thimble.cc
tests/thread_test.c:
  Rename: client/thread_test.c -> tests/thread_test.c
tests/connect_test.c:
  Rename: client/connect_test.c -> tests/connect_test.c
tests/showdb_test.c:
  Rename: client/showdb_test.c -> tests/showdb_test.c
tests/ssl_test.c:
  Rename: client/ssl_test.c -> tests/ssl_test.c
BitKeeper/deleted/.del-mysql_install.c~8c089740d79a92:
  Delete: extra/mysql_install.c
BitKeeper/deleted/.del-cache_manager.cc~c506b365b140d30c:
  Delete: sql/cache_manager.cc
BitKeeper/deleted/.del-cache_manager.h~adb8639e510c6f6e:
  Delete: sql/cache_manager.h
client/Makefile.am:
  Move insert_test, select_test and thread_test under 'tests'
extra/Makefile.am:
  Remove not used program mysql_install
sql/item_strfunc.cc:
  Simple optimization
sql/item_sum.cc:
  Simple code cleanup.
tests/Makefile.am:
  Added test programs
2003-04-22 22:41:59 +03:00

59 lines
1.5 KiB
C

/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <stdio.h>
#include <stdlib.h>
#include "mysql.h"
#define INSERT_QUERY "insert into test (name,num) values ('item %d', %d)"
int main(int argc, char **argv)
{
int count,num;
MYSQL *sock,mysql;
char qbuf[160];
if (argc != 3)
{
fprintf(stderr,"usage : insert_test <dbname> <Num>\n\n");
exit(1);
}
mysql_init(&mysql);
if (!(sock = mysql_real_connect(&mysql,NULL,NULL,NULL,argv[1],0,NULL,0)))
{
fprintf(stderr,"Couldn't connect to engine!\n%s\n",mysql_error(&mysql));
perror("");
exit(1);
}
num = atoi(argv[2]);
count = 0;
while (count < num)
{
sprintf(qbuf,INSERT_QUERY,count,count);
if(mysql_query(sock,qbuf))
{
fprintf(stderr,"Query failed (%s)\n",mysql_error(sock));
exit(1);
}
count++;
}
mysql_close(sock);
exit(0);
return 0;
}