@@ -45,7 +45,7 @@ import (
4545 "time"
4646 "unicode"
4747
48- inf "gopkg.in/inf.v0"
48+ "gopkg.in/inf.v0"
4949)
5050
5151func TestEmptyHosts (t * testing.T ) {
@@ -454,15 +454,15 @@ func TestCAS(t *testing.T) {
454454 t .Fatal ("truncate:" , err )
455455 }
456456
457- successBatch := session .NewBatch (LoggedBatch )
457+ successBatch := session .Batch (LoggedBatch )
458458 successBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?) IF NOT EXISTS" , title , revid , modified )
459459 if applied , _ , err := session .ExecuteBatchCAS (successBatch , & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
460460 t .Fatal ("insert:" , err )
461461 } else if ! applied {
462462 t .Fatalf ("insert should have been applied: title=%v revID=%v modified=%v" , titleCAS , revidCAS , modifiedCAS )
463463 }
464464
465- successBatch = session .NewBatch (LoggedBatch )
465+ successBatch = session .Batch (LoggedBatch )
466466 successBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?) IF NOT EXISTS" , title + "_foo" , revid , modified )
467467 casMap := make (map [string ]interface {})
468468 if applied , _ , err := session .MapExecuteBatchCAS (successBatch , casMap ); err != nil {
@@ -471,22 +471,22 @@ func TestCAS(t *testing.T) {
471471 t .Fatal ("insert should have been applied" )
472472 }
473473
474- failBatch := session .NewBatch (LoggedBatch )
474+ failBatch := session .Batch (LoggedBatch )
475475 failBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?) IF NOT EXISTS" , title , revid , modified )
476476 if applied , _ , err := session .ExecuteBatchCAS (successBatch , & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
477477 t .Fatal ("insert:" , err )
478478 } else if applied {
479479 t .Fatalf ("insert should have been applied: title=%v revID=%v modified=%v" , titleCAS , revidCAS , modifiedCAS )
480480 }
481481
482- insertBatch := session .NewBatch (LoggedBatch )
482+ insertBatch := session .Batch (LoggedBatch )
483483 insertBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES ('_foo', 2c3af400-73a4-11e5-9381-29463d90c3f0, DATEOF(NOW()))" )
484484 insertBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES ('_foo', 3e4ad2f1-73a4-11e5-9381-29463d90c3f0, DATEOF(NOW()))" )
485485 if err := session .ExecuteBatch (insertBatch ); err != nil {
486486 t .Fatal ("insert:" , err )
487487 }
488488
489- failBatch = session .NewBatch (LoggedBatch )
489+ failBatch = session .Batch (LoggedBatch )
490490 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());" )
491491 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());" )
492492 if applied , iter , err := session .ExecuteBatchCAS (failBatch , & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
@@ -611,7 +611,7 @@ func TestBatch(t *testing.T) {
611611 t .Fatal ("create table:" , err )
612612 }
613613
614- batch := session .NewBatch (LoggedBatch )
614+ batch := session .Batch (LoggedBatch )
615615 for i := 0 ; i < 100 ; i ++ {
616616 batch .Query (`INSERT INTO batch_table (id) VALUES (?)` , i )
617617 }
@@ -643,9 +643,9 @@ func TestUnpreparedBatch(t *testing.T) {
643643
644644 var batch * Batch
645645 if session .cfg .ProtoVersion == 2 {
646- batch = session .NewBatch (CounterBatch )
646+ batch = session .Batch (CounterBatch )
647647 } else {
648- batch = session .NewBatch (UnloggedBatch )
648+ batch = session .Batch (UnloggedBatch )
649649 }
650650
651651 for i := 0 ; i < 100 ; i ++ {
@@ -684,7 +684,7 @@ func TestBatchLimit(t *testing.T) {
684684 t .Fatal ("create table:" , err )
685685 }
686686
687- batch := session .NewBatch (LoggedBatch )
687+ batch := session .Batch (LoggedBatch )
688688 for i := 0 ; i < 65537 ; i ++ {
689689 batch .Query (`INSERT INTO batch_table2 (id) VALUES (?)` , i )
690690 }
@@ -738,7 +738,7 @@ func TestTooManyQueryArgs(t *testing.T) {
738738 t .Fatal ("'`SELECT * FROM too_many_query_args WHERE id = ?`, 1, 2' should return an error" )
739739 }
740740
741- batch := session .NewBatch (UnloggedBatch )
741+ batch := session .Batch (UnloggedBatch )
742742 batch .Query ("INSERT INTO too_many_query_args (id, value) VALUES (?, ?)" , 1 , 2 , 3 )
743743 err = session .ExecuteBatch (batch )
744744
@@ -770,7 +770,7 @@ func TestNotEnoughQueryArgs(t *testing.T) {
770770 t .Fatal ("'`SELECT * FROM not_enough_query_args WHERE id = ? and cluster = ?`, 1' should return an error" )
771771 }
772772
773- batch := session .NewBatch (UnloggedBatch )
773+ batch := session .Batch (UnloggedBatch )
774774 batch .Query ("INSERT INTO not_enough_query_args (id, cluster, value) VALUES (?, ?, ?)" , 1 , 2 )
775775 err = session .ExecuteBatch (batch )
776776
@@ -1392,7 +1392,7 @@ func TestBatchQueryInfo(t *testing.T) {
13921392 return values , nil
13931393 }
13941394
1395- batch := session .NewBatch (LoggedBatch )
1395+ batch := session .Batch (LoggedBatch )
13961396 batch .Bind ("INSERT INTO batch_query_info (id, cluster, value) VALUES (?, ?,?)" , write )
13971397
13981398 if err := session .ExecuteBatch (batch ); err != nil {
@@ -1520,7 +1520,7 @@ func TestPrepare_ReprepareBatch(t *testing.T) {
15201520 }
15211521
15221522 stmt , conn := injectInvalidPreparedStatement (t , session , "test_reprepare_statement_batch" )
1523- batch := session .NewBatch (UnloggedBatch )
1523+ batch := session .Batch (UnloggedBatch )
15241524 batch .Query (stmt , "bar" )
15251525 if err := conn .executeBatch (ctx , batch ).Close (); err != nil {
15261526 t .Fatalf ("Failed to execute query for reprepare statement: %v" , err )
@@ -1904,7 +1904,7 @@ func TestBatchStats(t *testing.T) {
19041904 t .Fatalf ("failed to create table with error '%v'" , err )
19051905 }
19061906
1907- b := session .NewBatch (LoggedBatch )
1907+ b := session .Batch (LoggedBatch )
19081908 b .Query ("INSERT INTO batchStats (id) VALUES (?)" , 1 )
19091909 b .Query ("INSERT INTO batchStats (id) VALUES (?)" , 2 )
19101910
@@ -1947,7 +1947,7 @@ func TestBatchObserve(t *testing.T) {
19471947
19481948 var observedBatch * observation
19491949
1950- batch := session .NewBatch (LoggedBatch )
1950+ batch := session .Batch (LoggedBatch )
19511951 batch .Observer (funcBatchObserver (func (ctx context.Context , o ObservedBatch ) {
19521952 if observedBatch != nil {
19531953 t .Fatal ("batch observe called more than once" )
@@ -3286,7 +3286,7 @@ func TestUnsetColBatch(t *testing.T) {
32863286 t .Fatalf ("failed to create table with error '%v'" , err )
32873287 }
32883288
3289- b := session .NewBatch (LoggedBatch )
3289+ b := session .Batch (LoggedBatch )
32903290 b .Query ("INSERT INTO gocql_test.batchUnsetInsert(id, my_int, my_text) VALUES (?,?,?)" , 1 , 1 , UnsetValue )
32913291 b .Query ("INSERT INTO gocql_test.batchUnsetInsert(id, my_int, my_text) VALUES (?,?,?)" , 1 , UnsetValue , "" )
32923292 b .Query ("INSERT INTO gocql_test.batchUnsetInsert(id, my_int, my_text) VALUES (?,?,?)" , 2 , 2 , UnsetValue )
0 commit comments