mariadb/tests/connect_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

65 lines
1.9 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"
static void change_user(MYSQL *sock,const char *user, const char *password,
const char *db,my_bool warning)
{
if (mysql_change_user(sock,user,password,db) != warning)
{
fprintf(stderr,"Couldn't change user to: user: '%s', password: '%s', db: '%s': Error: %s\n",
user, password ? password : "", db ? db : "",
mysql_error(sock));
}
}
int main(int argc, char **argv)
{
MYSQL *sock;
if (!(sock=mysql_init(0)))
{
fprintf(stderr,"Couldn't initialize mysql struct\n");
exit(1);
}
mysql_options(sock,MYSQL_READ_DEFAULT_GROUP,"connect");
if (!mysql_real_connect(sock,NULL,NULL,NULL,NULL,0,NULL,0))
{
fprintf(stderr,"Couldn't connect to engine!\n%s\n",mysql_error(sock));
perror("");
exit(1);
}
if (mysql_select_db(sock,"test"))
{
fprintf(stderr,"Couldn't select database test: Error: %s\n",
mysql_error(sock));
}
change_user(sock,"test_user","test_user","test",0);
change_user(sock,"test",NULL,"test",0);
change_user(sock,"test_user",NULL,"test",1);
change_user(sock,"test_user",NULL,NULL,1);
change_user(sock,"test_user","test_user","mysql",1);
mysql_close(sock);
exit(0);
return 0;
}