@@ -397,21 +397,22 @@ _mysql_ConnectionObject_Initialize(
397
397
"read_default_file" , "read_default_group" ,
398
398
"client_flag" , "ssl" ,
399
399
"local_infile" ,
400
- "read_timeout" , "write_timeout" ,
400
+ "read_timeout" , "write_timeout" , "charset" ,
401
401
NULL } ;
402
402
int connect_timeout = 0 ;
403
403
int read_timeout = 0 ;
404
404
int write_timeout = 0 ;
405
405
int compress = -1 , named_pipe = -1 , local_infile = -1 ;
406
406
char * init_command = NULL ,
407
407
* read_default_file = NULL ,
408
- * read_default_group = NULL ;
408
+ * read_default_group = NULL ,
409
+ * charset = NULL ;
409
410
410
411
self -> converter = NULL ;
411
412
self -> open = 0 ;
412
413
413
414
if (!PyArg_ParseTupleAndKeywords (args , kwargs ,
414
- "|ssssisOiiisssiOiii :connect" ,
415
+ "|ssssisOiiisssiOiiis :connect" ,
415
416
kwlist ,
416
417
& host , & user , & passwd , & db ,
417
418
& port , & unix_socket , & conv ,
@@ -422,7 +423,8 @@ _mysql_ConnectionObject_Initialize(
422
423
& client_flag , & ssl ,
423
424
& local_infile ,
424
425
& read_timeout ,
425
- & write_timeout
426
+ & write_timeout ,
427
+ & charset
426
428
))
427
429
return -1 ;
428
430
@@ -486,6 +488,9 @@ _mysql_ConnectionObject_Initialize(
486
488
if (ssl ) {
487
489
mysql_ssl_set (& (self -> connection ), key , cert , ca , capath , cipher );
488
490
}
491
+ if (charset ) {
492
+ mysql_options (& (self -> connection ), MYSQL_SET_CHARSET_NAME , charset );
493
+ }
489
494
490
495
conn = mysql_real_connect (& (self -> connection ), host , user , passwd , db ,
491
496
port , unix_socket , client_flag );
0 commit comments