Browse Source

Resolved issue with keyspace defined at cluster not being set at the
connection level.

Updated the gocql_test to test this issue to prevent it from recurring.

Phillip Couto 12 years ago
parent
commit
bbc31839c5
3 changed files with 5 additions and 4 deletions
  1. 1 0
      AUTHORS
  2. 1 0
      cluster.go
  3. 3 4
      gocql_test/main.go

+ 1 - 0
AUTHORS

@@ -4,3 +4,4 @@ Christoph Hack <christoph@tux21b.org>
 Jonathan Rudenberg <jonathan@titanous.com>
 Thorsten von Eicken <tve@rightscale.com>
 Matt Robenolt <mattr@disqus.com>
+Phillip Couto <phillip.couto@stemstudios.com>

+ 1 - 0
cluster.go

@@ -59,6 +59,7 @@ func (cfg *ClusterConfig) CreateSession() *Session {
 		connPool: make(map[string]*RoundRobin),
 		conns:    make(map[*Conn]struct{}),
 		quitWait: make(chan bool),
+		keyspace: cfg.Keyspace,		
 	}
 	impl.wgStart.Add(1)
 	for i := 0; i < len(impl.cfg.Hosts); i++ {

+ 3 - 4
gocql_test/main.go

@@ -51,10 +51,9 @@ func initSchema() error {
 		}`).Exec(); err != nil {
 		return err
 	}
-
-	if err := session.Query("USE gocql_test").Exec(); err != nil {
-		return err
-	}
+	session.Close()
+	cluster.Keyspace = "gocql_test"
+	session = cluster.CreateSession()
 
 	if err := session.Query(`CREATE TABLE page (
 			title       varchar,