~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/ssl_test.c

  • Committer: Mark Atwood
  • Date: 2008-07-01 21:25:46 UTC
  • mto: This revision was merged to the branch mainline in revision 45.
  • Revision ID: mark@localhost.localdomain-20080701212546-jzs7ljtwcp2dcmgd
Remove all OpenSSL and all YaSSL code

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
int main(int argc, char **argv)
28
28
{
29
 
#ifdef HAVE_OPENSSL
30
 
  int   count, num;
31
 
  MYSQL mysql,*sock;
32
 
  MYSQL_RES *res;
33
 
  char  qbuf[160];
34
 
 
35
 
  if (argc != 3)
36
 
  {
37
 
    fprintf(stderr,"usage : ssl_test <dbname> <num>\n\n");
38
 
    exit(1);
39
 
  }
40
 
 
41
 
  mysql_init(&mysql);
42
 
#ifdef HAVE_OPENSSL
43
 
  mysql_ssl_set(&mysql,"../SSL/MySQL-client-key.pem",
44
 
    "../SSL/MySQL-client-cert.pem",
45
 
    "../SSL/MySQL-ca-cert.pem", 0, 0);
46
 
#endif
47
 
  if (!(sock = mysql_real_connect(&mysql,"127.0.0.1",0,0,argv[1],MYSQL_PORT,NULL,0)))
48
 
  {
49
 
    fprintf(stderr,"Couldn't connect to engine!\n%s\n\n",mysql_error(&mysql));
50
 
    perror("");
51
 
    exit(1);
52
 
  }
53
 
  mysql.reconnect= 1;
54
 
  count = 0;
55
 
  num = atoi(argv[2]);
56
 
  while (count < num)
57
 
  {
58
 
    sprintf(qbuf,SELECT_QUERY,count);
59
 
    if(mysql_query(sock,qbuf))
60
 
    {
61
 
      fprintf(stderr,"Query failed (%s)\n",mysql_error(sock));
62
 
      exit(1);
63
 
    }
64
 
    if (!(res=mysql_store_result(sock)))
65
 
    {
66
 
      fprintf(stderr,"Couldn't get result from query failed (%s)\n",
67
 
              mysql_error(sock));
68
 
      exit(1);
69
 
    }
70
 
#ifdef TEST
71
 
    printf("number of fields: %d\n",mysql_num_fields(res));
72
 
#endif
73
 
    mysql_free_result(res);
74
 
    count++;
75
 
  }
76
 
  mysql_close(sock);
77
 
#else /* HAVE_OPENSSL */
78
29
  printf("ssl_test: SSL not configured.\n");
79
 
#endif /* HAVE_OPENSSL */
80
30
  exit(0);
81
31
  return 0;                                     /* Keep some compilers happy */
82
32
}