1
/* Copyright (C) 2000 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
24
#define SELECT_QUERY "select name from test where num = %d"
27
int main(int argc, char **argv)
37
fprintf(stderr,"usage : ssl_test <dbname> <num>\n\n");
43
mysql_ssl_set(&mysql,"../SSL/MySQL-client-key.pem",
44
"../SSL/MySQL-client-cert.pem",
45
"../SSL/MySQL-ca-cert.pem", 0, 0);
47
if (!(sock = mysql_real_connect(&mysql,"127.0.0.1",0,0,argv[1],MYSQL_PORT,NULL,0)))
49
fprintf(stderr,"Couldn't connect to engine!\n%s\n\n",mysql_error(&mysql));
58
sprintf(qbuf,SELECT_QUERY,count);
59
if(mysql_query(sock,qbuf))
61
fprintf(stderr,"Query failed (%s)\n",mysql_error(sock));
64
if (!(res=mysql_store_result(sock)))
66
fprintf(stderr,"Couldn't get result from query failed (%s)\n",
71
printf("number of fields: %d\n",mysql_num_fields(res));
73
mysql_free_result(res);
77
#else /* HAVE_OPENSSL */
78
printf("ssl_test: SSL not configured.\n");
79
#endif /* HAVE_OPENSSL */
81
return 0; /* Keep some compilers happy */