File tree Expand file tree Collapse file tree 4 files changed +16
-12
lines changed
test/integration/connection Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ ClientHandshake.prototype.start = function () {
17
17
} ;
18
18
19
19
ClientHandshake . prototype . sendSSLRequest = function ( connection ) {
20
- var sslRequest = new Packets . SSLRequest ( this . clientFlags ) ;
20
+ var sslRequest = new Packets . SSLRequest ( this . clientFlags , connection . config . charsetNumber ) ;
21
21
connection . writePacket ( sslRequest . toPacket ( ) ) ;
22
22
} ;
23
23
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ function ConnectionConfig (options) {
59
59
this . maxPacketSize = 0 ;
60
60
this . charsetNumber = ( options . charset )
61
61
? ConnectionConfig . getCharsetNumber ( options . charset )
62
- : options . charsetNumber || Charsets . UTF8_GENERAL_CI ;
62
+ : options . charsetNumber || Charsets . UTF8MB4_UNICODE_CI ;
63
63
64
64
this . compress = options . compress || false ;
65
65
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ var ClientConstants = require('../constants/client');
2
2
var Packet = require ( '../packets/packet' ) ;
3
3
var Charsets = require ( '../constants/charsets' ) ;
4
4
5
- function SSLRequest ( flags )
5
+ function SSLRequest ( flags , charset )
6
6
{
7
7
this . clientFlags = flags | ClientConstants . SSL ;
8
+ this . charset = charset ;
8
9
}
9
10
10
11
SSLRequest . prototype . toPacket = function ( )
@@ -17,7 +18,7 @@ SSLRequest.prototype.toPacket = function ()
17
18
18
19
packet . writeInt32 ( this . clientFlags ) ;
19
20
packet . writeInt32 ( 0 ) ; // max packet size. todo: move to config
20
- packet . writeInt8 ( Charsets . UTF8_GENERAL_CI ) ;
21
+ packet . writeInt8 ( this . charset ) ;
21
22
return packet ;
22
23
} ;
23
24
Original file line number Diff line number Diff line change @@ -5,14 +5,15 @@ var assert = require('assert');
5
5
// test data stores
6
6
var testData = [
7
7
'ютф восемь' ,
8
+ 'Experimental' ,
8
9
'परीक्षण' ,
9
10
'test тест テスト փորձաsրկում পরীক্ষা kiểm tra' ,
10
11
'ტესტი પરીક્ષણ מבחן פּרובירן اختبار'
11
12
] ;
12
13
13
14
var resultData = null ;
14
15
15
- // tests
16
+ // test inserting of non latin data if we are able to parse it
16
17
17
18
var testEncoding = function ( err ) {
18
19
assert . ifError ( err ) ;
@@ -35,13 +36,15 @@ var testEncoding = function (err) {
35
36
36
37
// init test sequence
37
38
( function ( ) {
38
- connection . query (
39
- 'CREATE TABLE IF NOT EXISTS `test-charset-encoding` ' +
40
- '( `field` VARCHAR(1000) CHARACTER SET latin1 COLLATE latin1_danish_ci)' ,
41
- function ( err ) {
42
- assert . ifError ( err ) ;
43
- connection . query ( 'DELETE from `test-charset-encoding`' , testEncoding ) ;
44
- } ) ;
39
+ connection . query ( 'DROP TABLE IF EXISTS `test-charset-encoding`' , function ( err ) {
40
+ connection . query (
41
+ 'CREATE TABLE IF NOT EXISTS `test-charset-encoding` ' +
42
+ '( `field` VARCHAR(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci)' ,
43
+ function ( err ) {
44
+ assert . ifError ( err ) ;
45
+ connection . query ( 'DELETE from `test-charset-encoding`' , testEncoding ) ;
46
+ } ) ;
47
+ } ) ;
45
48
} ) ( ) ;
46
49
47
50
process . on ( 'exit' , function ( ) {
You can’t perform that action at this time.
0 commit comments