File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
test/integration/connection/encoding Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ var mysql = require ( '../../../../index.js' ) ;
2
+ var common = require ( '../../../common' ) ;
3
+ var assert = require ( 'assert' ) ;
4
+
5
+ var connection = common . createConnection ( { charset : 'UTF8_GENERAL_CI' } ) ;
6
+ connection . query ( 'create table if not exists __test_client_encodings (name VARCHAR(200))' , function ( err ) {
7
+ assert . ifError ( err ) ;
8
+ connection . query ( 'delete from __test_client_encodings' , function ( err ) {
9
+ assert . ifError ( err ) ;
10
+ connection . end ( ) ;
11
+
12
+ var connection1 = common . createConnection ( { charset : 'CP1251_GENERAL_CI' } ) ;
13
+ connection1 . query ( 'insert into __test_client_encodings values("привет, мир")' , function ( err ) {
14
+ assert . ifError ( err ) ;
15
+ connection1 . end ( ) ;
16
+
17
+ var connection2 = common . createConnection ( { charset : 'KOI8R_GENERAL_CI' } ) ;
18
+ connection2 . query ( 'select * from __test_client_encodings' , function ( err , rows ) {
19
+ assert . ifError ( err ) ;
20
+ assert . equal ( rows [ 0 ] . name , 'привет, мир' ) ;
21
+ connection2 . end ( ) ;
22
+ } ) ;
23
+ } ) ;
24
+ } ) ;
25
+ } ) ;
You can’t perform that action at this time.
0 commit comments