573
573
if (option[0][0] == '-' && option[0][1] == '-')
575
char *end=strcend(*option,'=');
580
*end=0; /* Remove '=' */
582
/* Change all '_' in variable name to '-' */
583
for (end= *option ; *(end= strcend(end,'_')) ; )
585
switch (find_type(*option+2,&option_types,2)) {
588
options->port=atoi(opt_arg);
593
my_free(options->unix_socket,MYF(MY_ALLOW_ZERO_PTR));
594
options->unix_socket=my_strdup(opt_arg,MYF(MY_WME));
597
case 3: /* compress */
599
options->client_flag|= CLIENT_COMPRESS;
601
case 4: /* password */
604
my_free(options->password,MYF(MY_ALLOW_ZERO_PTR));
605
options->password=my_strdup(opt_arg,MYF(MY_WME));
608
case 20: /* connect_timeout */
609
case 6: /* timeout */
611
options->connect_timeout=atoi(opt_arg);
616
my_free(options->user,MYF(MY_ALLOW_ZERO_PTR));
617
options->user=my_strdup(opt_arg,MYF(MY_WME));
620
case 8: /* init-command */
621
add_init_command(options,opt_arg);
626
my_free(options->host,MYF(MY_ALLOW_ZERO_PTR));
627
options->host=my_strdup(opt_arg,MYF(MY_WME));
630
case 10: /* database */
633
my_free(options->db,MYF(MY_ALLOW_ZERO_PTR));
634
options->db=my_strdup(opt_arg,MYF(MY_WME));
637
case 12: /* return-found-rows */
638
options->client_flag|=CLIENT_FOUND_ROWS;
640
case 13: /* Ignore SSL options */
575
char *end=strrchr(*option,'=');
580
*end=0; /* Remove '=' */
582
/* Change all '_' in variable name to '-' */
583
for (end= *option ; *(end= strrchr(end,'_')) ; )
585
switch (find_type(*option+2,&option_types,2)) {
588
options->port=atoi(opt_arg);
593
my_free(options->unix_socket,MYF(MY_ALLOW_ZERO_PTR));
594
options->unix_socket=my_strdup(opt_arg,MYF(MY_WME));
597
case 3: /* compress */
599
options->client_flag|= CLIENT_COMPRESS;
601
case 4: /* password */
604
my_free(options->password,MYF(MY_ALLOW_ZERO_PTR));
605
options->password=my_strdup(opt_arg,MYF(MY_WME));
608
case 20: /* connect_timeout */
609
case 6: /* timeout */
611
options->connect_timeout=atoi(opt_arg);
616
my_free(options->user,MYF(MY_ALLOW_ZERO_PTR));
617
options->user=my_strdup(opt_arg,MYF(MY_WME));
620
case 8: /* init-command */
621
add_init_command(options,opt_arg);
626
my_free(options->host,MYF(MY_ALLOW_ZERO_PTR));
627
options->host=my_strdup(opt_arg,MYF(MY_WME));
630
case 10: /* database */
633
my_free(options->db,MYF(MY_ALLOW_ZERO_PTR));
634
options->db=my_strdup(opt_arg,MYF(MY_WME));
637
case 12: /* return-found-rows */
638
options->client_flag|=CLIENT_FOUND_ROWS;
640
case 13: /* Ignore SSL options */
646
case 17: /* charset-lib */
647
my_free(options->charset_dir,MYF(MY_ALLOW_ZERO_PTR));
646
case 17: /* charset-lib */
647
my_free(options->charset_dir,MYF(MY_ALLOW_ZERO_PTR));
648
648
options->charset_dir = my_strdup(opt_arg, MYF(MY_WME));
651
my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR));
651
my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR));
652
652
options->charset_name = my_strdup(opt_arg, MYF(MY_WME));
654
case 19: /* Interactive-timeout */
655
options->client_flag|= CLIENT_INTERACTIVE;
658
if (!opt_arg || atoi(opt_arg) != 0)
659
options->client_flag|= CLIENT_LOCAL_FILES;
661
options->client_flag&= ~CLIENT_LOCAL_FILES;
664
options->client_flag&= ~CLIENT_LOCAL_FILES;
666
case 24: /* max-allowed-packet */
654
case 19: /* Interactive-timeout */
655
options->client_flag|= CLIENT_INTERACTIVE;
658
if (!opt_arg || atoi(opt_arg) != 0)
659
options->client_flag|= CLIENT_LOCAL_FILES;
661
options->client_flag&= ~CLIENT_LOCAL_FILES;
664
options->client_flag&= ~CLIENT_LOCAL_FILES;
666
case 24: /* max-allowed-packet */
668
options->max_allowed_packet= atoi(opt_arg);
668
options->max_allowed_packet= atoi(opt_arg);
670
670
case 25: /* protocol */
671
671
if ((options->protocol= find_type(opt_arg,
672
&sql_protocol_typelib,0)) <= 0)
672
&sql_protocol_typelib,0)) <= 0)
674
674
fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg);
678
case 27: /* multi-results */
679
options->client_flag|= CLIENT_MULTI_RESULTS;
681
case 28: /* multi-statements */
682
case 29: /* multi-queries */
683
options->client_flag|= CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS;
678
case 27: /* multi-results */
679
options->client_flag|= CLIENT_MULTI_RESULTS;
681
case 28: /* multi-statements */
682
case 29: /* multi-queries */
683
options->client_flag|= CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS;
685
685
case 30: /* secure-auth */
686
686
options->secure_auth= true;
688
688
case 31: /* report-data-truncation */
689
689
options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1;