@@ -44,7 +44,7 @@ import (
4444 "time"
4545 "unicode"
4646
47- inf "gopkg.in/inf.v0"
47+ "gopkg.in/inf.v0"
4848)
4949
5050func TestEmptyHosts (t * testing.T ) {
@@ -453,15 +453,15 @@ func TestCAS(t *testing.T) {
453453 t .Fatal ("truncate:" , err )
454454 }
455455
456- successBatch := session .NewBatch (LoggedBatch )
456+ successBatch := session .Batch (LoggedBatch )
457457 successBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?) IF NOT EXISTS" , title , revid , modified )
458458 if applied , _ , err := session .ExecuteBatchCAS (successBatch , & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
459459 t .Fatal ("insert:" , err )
460460 } else if ! applied {
461461 t .Fatalf ("insert should have been applied: title=%v revID=%v modified=%v" , titleCAS , revidCAS , modifiedCAS )
462462 }
463463
464- successBatch = session .NewBatch (LoggedBatch )
464+ successBatch = session .Batch (LoggedBatch )
465465 successBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?) IF NOT EXISTS" , title + "_foo" , revid , modified )
466466 casMap := make (map [string ]interface {})
467467 if applied , _ , err := session .MapExecuteBatchCAS (successBatch , casMap ); err != nil {
@@ -470,22 +470,22 @@ func TestCAS(t *testing.T) {
470470 t .Fatal ("insert should have been applied" )
471471 }
472472
473- failBatch := session .NewBatch (LoggedBatch )
473+ failBatch := session .Batch (LoggedBatch )
474474 failBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?) IF NOT EXISTS" , title , revid , modified )
475475 if applied , _ , err := session .ExecuteBatchCAS (successBatch , & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
476476 t .Fatal ("insert:" , err )
477477 } else if applied {
478478 t .Fatalf ("insert should have been applied: title=%v revID=%v modified=%v" , titleCAS , revidCAS , modifiedCAS )
479479 }
480480
481- insertBatch := session .NewBatch (LoggedBatch )
481+ insertBatch := session .Batch (LoggedBatch )
482482 insertBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES ('_foo', 2c3af400-73a4-11e5-9381-29463d90c3f0, DATEOF(NOW()))" )
483483 insertBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES ('_foo', 3e4ad2f1-73a4-11e5-9381-29463d90c3f0, DATEOF(NOW()))" )
484484 if err := session .ExecuteBatch (insertBatch ); err != nil {
485485 t .Fatal ("insert:" , err )
486486 }
487487
488- failBatch = session .NewBatch (LoggedBatch )
488+ failBatch = session .Batch (LoggedBatch )
489489 failBatch .Query ("UPDATE cas_table SET last_modified = DATEOF(NOW()) WHERE title='_foo' AND revid=2c3af400-73a4-11e5-9381-29463d90c3f0 IF last_modified=DATEOF(NOW());" )
490490 failBatch .Query ("UPDATE cas_table SET last_modified = DATEOF(NOW()) WHERE title='_foo' AND revid=3e4ad2f1-73a4-11e5-9381-29463d90c3f0 IF last_modified=DATEOF(NOW());" )
491491 if applied , iter , err := session .ExecuteBatchCAS (failBatch , & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
@@ -610,7 +610,7 @@ func TestBatch(t *testing.T) {
610610 t .Fatal ("create table:" , err )
611611 }
612612
613- batch := session .NewBatch (LoggedBatch )
613+ batch := session .Batch (LoggedBatch )
614614 for i := 0 ; i < 100 ; i ++ {
615615 batch .Query (`INSERT INTO batch_table (id) VALUES (?)` , i )
616616 }
@@ -642,9 +642,9 @@ func TestUnpreparedBatch(t *testing.T) {
642642
643643 var batch * Batch
644644 if session .cfg .ProtoVersion == 2 {
645- batch = session .NewBatch (CounterBatch )
645+ batch = session .Batch (CounterBatch )
646646 } else {
647- batch = session .NewBatch (UnloggedBatch )
647+ batch = session .Batch (UnloggedBatch )
648648 }
649649
650650 for i := 0 ; i < 100 ; i ++ {
@@ -683,7 +683,7 @@ func TestBatchLimit(t *testing.T) {
683683 t .Fatal ("create table:" , err )
684684 }
685685
686- batch := session .NewBatch (LoggedBatch )
686+ batch := session .Batch (LoggedBatch )
687687 for i := 0 ; i < 65537 ; i ++ {
688688 batch .Query (`INSERT INTO batch_table2 (id) VALUES (?)` , i )
689689 }
@@ -737,7 +737,7 @@ func TestTooManyQueryArgs(t *testing.T) {
737737 t .Fatal ("'`SELECT * FROM too_many_query_args WHERE id = ?`, 1, 2' should return an error" )
738738 }
739739
740- batch := session .NewBatch (UnloggedBatch )
740+ batch := session .Batch (UnloggedBatch )
741741 batch .Query ("INSERT INTO too_many_query_args (id, value) VALUES (?, ?)" , 1 , 2 , 3 )
742742 err = session .ExecuteBatch (batch )
743743
@@ -769,7 +769,7 @@ func TestNotEnoughQueryArgs(t *testing.T) {
769769 t .Fatal ("'`SELECT * FROM not_enough_query_args WHERE id = ? and cluster = ?`, 1' should return an error" )
770770 }
771771
772- batch := session .NewBatch (UnloggedBatch )
772+ batch := session .Batch (UnloggedBatch )
773773 batch .Query ("INSERT INTO not_enough_query_args (id, cluster, value) VALUES (?, ?, ?)" , 1 , 2 )
774774 err = session .ExecuteBatch (batch )
775775
@@ -1342,7 +1342,7 @@ func TestBatchQueryInfo(t *testing.T) {
13421342 return values , nil
13431343 }
13441344
1345- batch := session .NewBatch (LoggedBatch )
1345+ batch := session .Batch (LoggedBatch )
13461346 batch .Bind ("INSERT INTO batch_query_info (id, cluster, value) VALUES (?, ?,?)" , write )
13471347
13481348 if err := session .ExecuteBatch (batch ); err != nil {
@@ -1470,7 +1470,7 @@ func TestPrepare_ReprepareBatch(t *testing.T) {
14701470 }
14711471
14721472 stmt , conn := injectInvalidPreparedStatement (t , session , "test_reprepare_statement_batch" )
1473- batch := session .NewBatch (UnloggedBatch )
1473+ batch := session .Batch (UnloggedBatch )
14741474 batch .Query (stmt , "bar" )
14751475 if err := conn .executeBatch (ctx , batch ).Close (); err != nil {
14761476 t .Fatalf ("Failed to execute query for reprepare statement: %v" , err )
@@ -1854,7 +1854,7 @@ func TestBatchStats(t *testing.T) {
18541854 t .Fatalf ("failed to create table with error '%v'" , err )
18551855 }
18561856
1857- b := session .NewBatch (LoggedBatch )
1857+ b := session .Batch (LoggedBatch )
18581858 b .Query ("INSERT INTO batchStats (id) VALUES (?)" , 1 )
18591859 b .Query ("INSERT INTO batchStats (id) VALUES (?)" , 2 )
18601860
@@ -1897,7 +1897,7 @@ func TestBatchObserve(t *testing.T) {
18971897
18981898 var observedBatch * observation
18991899
1900- batch := session .NewBatch (LoggedBatch )
1900+ batch := session .Batch (LoggedBatch )
19011901 batch .Observer (funcBatchObserver (func (ctx context.Context , o ObservedBatch ) {
19021902 if observedBatch != nil {
19031903 t .Fatal ("batch observe called more than once" )
@@ -3236,7 +3236,7 @@ func TestUnsetColBatch(t *testing.T) {
32363236 t .Fatalf ("failed to create table with error '%v'" , err )
32373237 }
32383238
3239- b := session .NewBatch (LoggedBatch )
3239+ b := session .Batch (LoggedBatch )
32403240 b .Query ("INSERT INTO gocql_test.batchUnsetInsert(id, my_int, my_text) VALUES (?,?,?)" , 1 , 1 , UnsetValue )
32413241 b .Query ("INSERT INTO gocql_test.batchUnsetInsert(id, my_int, my_text) VALUES (?,?,?)" , 1 , UnsetValue , "" )
32423242 b .Query ("INSERT INTO gocql_test.batchUnsetInsert(id, my_int, my_text) VALUES (?,?,?)" , 2 , 2 , UnsetValue )
0 commit comments