summaryrefslogtreecommitdiff
path: root/tests/select_test.c
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-04-22 22:41:59 +0300
committerunknown <monty@narttu.mysql.fi>2003-04-22 22:41:59 +0300
commitac02f54022f2a64ada230ef4a3f446b26b143275 (patch)
tree5d018897c694206dbaf1995bb7862e5d5ad8a93d /tests/select_test.c
parent43f1511a31a8e47682410ca5b02eb0dd4aba16d8 (diff)
downloadmariadb-git-ac02f54022f2a64ada230ef4a3f446b26b143275.tar.gz
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
Diffstat (limited to 'tests/select_test.c')
-rw-r--r--tests/select_test.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/select_test.c b/tests/select_test.c
new file mode 100644
index 00000000000..ee2a9192865
--- /dev/null
+++ b/tests/select_test.c
@@ -0,0 +1,73 @@
+/* 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 */
+
+#if defined(_WIN32) || defined(_WIN64)
+#include <windows.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include "mysql.h"
+
+#define SELECT_QUERY "select name from test where num = %d"
+
+
+int main(int argc, char **argv)
+{
+ int count, num;
+ MYSQL mysql,*sock;
+ MYSQL_RES *res;
+ char qbuf[160];
+
+ if (argc != 3)
+ {
+ fprintf(stderr,"usage : select_test <dbname> <num>\n\n");
+ exit(1);
+ }
+
+ mysql_init(&mysql);
+ if (!(sock = mysql_real_connect(&mysql,NULL,0,0,argv[1],0,NULL,0)))
+ {
+ fprintf(stderr,"Couldn't connect to engine!\n%s\n\n",mysql_error(&mysql));
+ perror("");
+ exit(1);
+ }
+
+ count = 0;
+ num = atoi(argv[2]);
+ while (count < num)
+ {
+ sprintf(qbuf,SELECT_QUERY,count);
+ if(mysql_query(sock,qbuf))
+ {
+ fprintf(stderr,"Query failed (%s)\n",mysql_error(sock));
+ exit(1);
+ }
+ if (!(res=mysql_store_result(sock)))
+ {
+ fprintf(stderr,"Couldn't get result from %s\n",
+ mysql_error(sock));
+ exit(1);
+ }
+#ifdef TEST
+ printf("number of fields: %d\n",mysql_num_fields(res));
+#endif
+ mysql_free_result(res);
+ count++;
+ }
+ mysql_close(sock);
+ exit(0);
+ return 0; /* Keep some compilers happy */
+}