File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -618,13 +618,19 @@ func (b *bolt4) GetRoutingTable(database string, context map[string]string) (*db
618
618
return nil , err
619
619
}
620
620
621
+ // The query should run in system database, preserve current setting and restore it when
622
+ // done.
623
+ originalDatabaseName := b .databaseName
624
+ b .databaseName = "system"
625
+ defer func () { b .databaseName = originalDatabaseName }()
626
+
627
+ // Query for the users default database or a specific database
621
628
const (
622
629
queryDefault = "CALL dbms.routing.getRoutingTable($context)"
623
630
queryDatabase = "CALL dbms.routing.getRoutingTable($context, $db)"
624
631
)
625
632
query := queryDefault
626
633
params := map [string ]interface {}{"context" : context }
627
-
628
634
if database != db .DefaultDatabase {
629
635
query = queryDatabase
630
636
params ["db" ] = database
@@ -634,7 +640,6 @@ func (b *bolt4) GetRoutingTable(database string, context map[string]string) (*db
634
640
if err != nil {
635
641
return nil , err
636
642
}
637
-
638
643
rec , _ , err := b .Next (stream .Handle )
639
644
if err != nil {
640
645
return nil , err
@@ -649,7 +654,6 @@ func (b *bolt4) GetRoutingTable(database string, context map[string]string) (*db
649
654
if table == nil {
650
655
return nil , errors .New ("Unable to parse routing table" )
651
656
}
652
-
653
657
return table , nil
654
658
}
655
659
You can’t perform that action at this time.
0 commit comments