#include <stdio.h>#include <stdlib.h>#include "mysql.h"Include dependency graph for connect_test.c:

Go to the source code of this file.
Functions | |
| static void | change_user (MYSQL *sock, const char *user, const char *password, const char *db, my_bool warning) |
| int | main (int argc, char **argv) |
| static void change_user | ( | MYSQL * | sock, | |
| const char * | user, | |||
| const char * | password, | |||
| const char * | db, | |||
| my_bool | warning | |||
| ) | [static] |
Definition at line 21 of file connect_test.c.
References mysql_change_user(), mysql_error(), and sock.
Referenced by main().
00023 { 00024 if (mysql_change_user(sock,user,password,db) != warning) 00025 { 00026 fprintf(stderr,"Couldn't change user to: user: '%s', password: '%s', db: '%s': Error: %s\n", 00027 user, password ? password : "", db ? db : "", 00028 mysql_error(sock)); 00029 } 00030 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 33 of file connect_test.c.
References change_user(), exit, mysql_close(), mysql_error(), mysql_init(), mysql_options(), MYSQL_READ_DEFAULT_GROUP, mysql_real_connect(), mysql_select_db(), NULL, perror(), and sock.
00034 { 00035 MYSQL *sock; 00036 00037 if (!(sock=mysql_init(0))) 00038 { 00039 fprintf(stderr,"Couldn't initialize mysql struct\n"); 00040 exit(1); 00041 } 00042 mysql_options(sock,MYSQL_READ_DEFAULT_GROUP,"connect"); 00043 if (!mysql_real_connect(sock,NULL,NULL,NULL,NULL,0,NULL,0)) 00044 { 00045 fprintf(stderr,"Couldn't connect to engine!\n%s\n",mysql_error(sock)); 00046 perror(""); 00047 exit(1); 00048 } 00049 sock->reconnect= 1; 00050 00051 if (mysql_select_db(sock,"test")) 00052 { 00053 fprintf(stderr,"Couldn't select database test: Error: %s\n", 00054 mysql_error(sock)); 00055 } 00056 00057 change_user(sock,"test_user","test_user","test",0); 00058 change_user(sock,"test",NULL,"test",0); 00059 change_user(sock,"test_user",NULL,"test",1); 00060 change_user(sock,"test_user",NULL,NULL,1); 00061 change_user(sock,"test_user","test_user","mysql",1); 00062 00063 mysql_close(sock); 00064 exit(0); 00065 return 0; 00066 }
Here is the call graph for this function:

1.4.7

