File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ type BaseSession struct {
4747 lastQueryInfo map [string ]* atomic.Value
4848 tx Transaction
4949 ignoreAutocommit bool
50+ charset CharacterSetID
5051
5152 // When the MySQL database updates any tables related to privileges, it increments its counter. We then update our
5253 // privilege set if our counter doesn't equal the database's counter.
@@ -263,15 +264,18 @@ func (s *BaseSession) GetCharacterSet() CharacterSetID {
263264
264265// GetCharacterSetResults returns the result character set for this session (defined by the system variable `character_set_results`).
265266func (s * BaseSession ) GetCharacterSetResults () CharacterSetID {
266- sysVar , _ := s .systemVars [characterSetResultsSysVarName ]
267- if sysVar .Val == nil {
268- return CharacterSet_Unspecified
269- }
270- charSet , err := ParseCharacterSet (sysVar .Val .(string ))
271- if err != nil {
272- panic (err ) // shouldn't happen
267+ if s .charset == CharacterSet_Unspecified {
268+ sysVar , _ := s .systemVars [characterSetResultsSysVarName ]
269+ if sysVar .Val == nil {
270+ return CharacterSet_Unspecified
271+ }
272+ var err error
273+ s .charset , err = ParseCharacterSet (sysVar .Val .(string ))
274+ if err != nil {
275+ panic (err ) // shouldn't happen
276+ }
273277 }
274- return charSet
278+ return s . charset
275279}
276280
277281// GetCollation returns the collation for this session (defined by the system variable `collation_connection`).
You can’t perform that action at this time.
0 commit comments