File tree Expand file tree Collapse file tree 2 files changed +21
-19
lines changed
Expand file tree Collapse file tree 2 files changed +21
-19
lines changed Original file line number Diff line number Diff line change @@ -103,9 +103,7 @@ class ColumnDefinition {
103103
104104 // node-mysql compatibility: alias "db" to "schema"
105105 get db ( ) {
106- const start = this . _schemaStart ;
107- const end = start . _shemaLength ;
108- return this . _buf . utf8Slice ( start , end ) ;
106+ return this . schema ;
109107 }
110108}
111109
Original file line number Diff line number Diff line change @@ -52,24 +52,28 @@ assert.equal(
5252) ;
5353
5454// Spec (from example: https://dev.mysql.com/doc/internals/en/protocoltext-resultset.html)
55- packet = ColumnDefinition . toPacket (
56- {
57- catalog : 'def' ,
58- schema : '' ,
59- name : '@@version_comment' ,
60- orgName : '' ,
61- table : '' ,
62- orgTable : '' ,
55+ const inputColDef = {
56+ catalog : 'def' ,
57+ schema : '' ,
58+ name : '@@version_comment' ,
59+ orgName : '' ,
60+ table : '' ,
61+ orgTable : '' ,
6362
64- characterSet : 0x08 , // latin1_swedish_ci
65- columnLength : 0x1c ,
66- flags : 0 ,
67- columnType : 0xfd ,
68- decimals : 0x1f
69- } ,
70- sequenceId
71- ) ;
63+ characterSet : 0x08 , // latin1_swedish_ci
64+ columnLength : 0x1c ,
65+ flags : 0 ,
66+ columnType : 0xfd ,
67+ decimals : 0x1f
68+ }
69+ packet = ColumnDefinition . toPacket ( inputColDef , sequenceId ) ;
7270assert . equal (
7371 packet . buffer . toString ( 'hex' , 4 ) ,
7472 '0364656600000011404076657273696f6e5f636f6d6d656e74000c08001c000000fd00001f0000'
7573) ;
74+
75+ packet . offset = 4 ;
76+ const colDef = new ColumnDefinition ( packet , "utf8" ) ;
77+ const inspect = colDef . inspect ( ) ;
78+ assert . deepEqual ( inspect , inputColDef ) ;
79+ assert . equal ( colDef . db , inputColDef . schema ) ;
You can’t perform that action at this time.
0 commit comments