@@ -39,7 +39,6 @@ import (
3939 "github.com/dolthub/go-mysql-server/sql/expression"
4040 "github.com/dolthub/go-mysql-server/sql/expression/function/aggregation"
4141 "github.com/dolthub/go-mysql-server/sql/mysql_db"
42- "github.com/dolthub/go-mysql-server/sql/mysql_db/serial"
4342 "github.com/dolthub/go-mysql-server/sql/parse"
4443 "github.com/dolthub/go-mysql-server/sql/plan"
4544 "github.com/dolthub/go-mysql-server/sql/transform"
@@ -1014,7 +1013,7 @@ func TestUserPrivileges(t *testing.T, h Harness) {
10141013 Address : "localhost" ,
10151014 })
10161015 engine .Analyzer .Catalog .MySQLDb .AddRootAccount ()
1017- engine .Analyzer .Catalog .MySQLDb .CanPersist = true
1016+ engine .Analyzer .Catalog .MySQLDb .SetPersister ( & mysql_db. NoopPersister {})
10181017
10191018 for _ , statement := range script .SetUpScript {
10201019 if sh , ok := harness .(SkippingHarness ); ok {
@@ -1074,7 +1073,7 @@ func TestUserPrivileges(t *testing.T, h Harness) {
10741073 defer engine .Close ()
10751074
10761075 engine .Analyzer .Catalog .MySQLDb .AddRootAccount ()
1077- engine .Analyzer .Catalog .MySQLDb .CanPersist = true
1076+ engine .Analyzer .Catalog .MySQLDb .SetPersister (mysql_db. NoopPersister {})
10781077 rootCtx := harness .NewContextWithClient (sql.Client {
10791078 User : "root" ,
10801079 Address : "localhost" ,
@@ -1175,7 +1174,7 @@ func TestUserAuthentication(t *testing.T, h Harness) {
11751174 engine := mustNewEngine (t , harness )
11761175 defer engine .Close ()
11771176 engine .Analyzer .Catalog .MySQLDb .AddRootAccount ()
1178- engine .Analyzer .Catalog .MySQLDb .CanPersist = true
1177+ engine .Analyzer .Catalog .MySQLDb .SetPersister ( & mysql_db. NoopPersister {})
11791178 if script .SetUpFunc != nil {
11801179 script .SetUpFunc (ctx , t , engine )
11811180 }
@@ -5401,47 +5400,47 @@ func TestPrivilegePersistence(t *testing.T, h Harness) {
54015400 engine := mustNewEngine (t , harness )
54025401 defer engine .Close ()
54035402 engine .Analyzer .Catalog .MySQLDb .AddRootAccount ()
5403+ engine .Analyzer .Catalog .MySQLDb .SetPersister (& mysql_db.NoopPersister {})
54045404 ctx := NewContextWithClient (harness , sql.Client {
54055405 User : "root" ,
54065406 Address : "localhost" ,
54075407 })
5408- engine .Analyzer .Catalog .MySQLDb .CanPersist = true
54095408
54105409 var users []* mysql_db.User
54115410 var roles []* mysql_db.RoleEdge
5412- engine .Analyzer .Catalog .MySQLDb .SetPersistCallback (
5413- func (ctx * sql.Context , buf []byte ) error {
5414- // erase everything from users and roles
5415- users = make ([]* mysql_db.User , 0 )
5416- roles = make ([]* mysql_db.RoleEdge , 0 )
5417-
5418- // Deserialize the flatbuffer
5419- serialMySQLDb := serial .GetRootAsMySQLDb (buf , 0 )
5420-
5421- // Fill in users
5422- for i := 0 ; i < serialMySQLDb .UserLength (); i ++ {
5423- serialUser := new (serial.User )
5424- if ! serialMySQLDb .User (serialUser , i ) {
5425- continue
5426- }
5427- user := mysql_db .LoadUser (serialUser )
5428- users = append (users , user )
5429- }
5430-
5431- // Fill in roles
5432- for i := 0 ; i < serialMySQLDb .RoleEdgesLength (); i ++ {
5433- serialRoleEdge := new (serial.RoleEdge )
5434- if ! serialMySQLDb .RoleEdges (serialRoleEdge , i ) {
5435- continue
5436- }
5437- role := mysql_db .LoadRoleEdge (serialRoleEdge )
5438- roles = append (roles , role )
5439- }
5440- return nil
5441- },
5442- )
54435411
5444- engine .Analyzer .Catalog .MySQLDb .CanPersist = true
5412+ // TODO: do I need this?
5413+ //engine.Analyzer.Catalog.MySQLDb.SetPersistCallback(
5414+ // func(ctx *sql.Context, buf []byte) error {
5415+ // // erase everything from users and roles
5416+ // users = make([]*mysql_db.User, 0)
5417+ // roles = make([]*mysql_db.RoleEdge, 0)
5418+ //
5419+ // // Deserialize the flatbuffer
5420+ // serialMySQLDb := serial.GetRootAsMySQLDb(buf, 0)
5421+ //
5422+ // // Fill in users
5423+ // for i := 0; i < serialMySQLDb.UserLength(); i++ {
5424+ // serialUser := new(serial.User)
5425+ // if !serialMySQLDb.User(serialUser, i) {
5426+ // continue
5427+ // }
5428+ // user := mysql_db.LoadUser(serialUser)
5429+ // users = append(users, user)
5430+ // }
5431+ //
5432+ // // Fill in roles
5433+ // for i := 0; i < serialMySQLDb.RoleEdgesLength(); i++ {
5434+ // serialRoleEdge := new(serial.RoleEdge)
5435+ // if !serialMySQLDb.RoleEdges(serialRoleEdge, i) {
5436+ // continue
5437+ // }
5438+ // role := mysql_db.LoadRoleEdge(serialRoleEdge)
5439+ // roles = append(roles, role)
5440+ // }
5441+ // return nil
5442+ // },
5443+ //)
54455444
54465445 RunQueryWithContext (t , engine , harness , ctx , "CREATE USER tester@localhost" )
54475446 // If the user exists in []*mysql_db.User, then it must be NOT nil.
0 commit comments