@@ -457,7 +457,7 @@ func TestCAS(t *testing.T) {
457457
458458 successBatch := session .Batch (LoggedBatch )
459459 successBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?) IF NOT EXISTS" , title , revid , modified )
460- if applied , _ , err := session . ExecuteBatchCAS ( successBatch , & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
460+ if applied , _ , err := successBatch . ExecCAS ( & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
461461 t .Fatal ("insert:" , err )
462462 } else if ! applied {
463463 t .Fatalf ("insert should have been applied: title=%v revID=%v modified=%v" , titleCAS , revidCAS , modifiedCAS )
@@ -466,15 +466,15 @@ func TestCAS(t *testing.T) {
466466 successBatch = session .Batch (LoggedBatch )
467467 successBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?) IF NOT EXISTS" , title + "_foo" , revid , modified )
468468 casMap := make (map [string ]interface {})
469- if applied , _ , err := session . MapExecuteBatchCAS ( successBatch , casMap ); err != nil {
469+ if applied , _ , err := successBatch . MapExecCAS ( casMap ); err != nil {
470470 t .Fatal ("insert:" , err )
471471 } else if ! applied {
472472 t .Fatal ("insert should have been applied" )
473473 }
474474
475475 failBatch := session .Batch (LoggedBatch )
476476 failBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?) IF NOT EXISTS" , title , revid , modified )
477- if applied , _ , err := session . ExecuteBatchCAS ( successBatch , & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
477+ if applied , _ , err := successBatch . ExecCAS ( & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
478478 t .Fatal ("insert:" , err )
479479 } else if applied {
480480 t .Fatalf ("insert should have not been applied: title=%v revID=%v modified=%v" , titleCAS , revidCAS , modifiedCAS )
@@ -483,14 +483,14 @@ func TestCAS(t *testing.T) {
483483 insertBatch := session .Batch (LoggedBatch )
484484 insertBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES ('_foo', 2c3af400-73a4-11e5-9381-29463d90c3f0, DATEOF(NOW()))" )
485485 insertBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES ('_foo', 3e4ad2f1-73a4-11e5-9381-29463d90c3f0, DATEOF(NOW()))" )
486- if err := session . ExecuteBatch ( insertBatch ); err != nil {
486+ if err := insertBatch . Exec ( ); err != nil {
487487 t .Fatal ("insert:" , err )
488488 }
489489
490490 failBatch = session .Batch (LoggedBatch )
491491 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());" )
492492 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());" )
493- if applied , iter , err := session . ExecuteBatchCAS ( failBatch , & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
493+ if applied , iter , err := failBatch . ExecCAS ( & titleCAS , & revidCAS , & modifiedCAS ); err != nil {
494494 t .Fatal ("insert:" , err )
495495 } else if applied {
496496 t .Fatalf ("insert should have not been applied: title=%v revID=%v modified=%v" , titleCAS , revidCAS , modifiedCAS )
@@ -521,20 +521,20 @@ func TestCAS(t *testing.T) {
521521 notCASBatch := session .Batch (LoggedBatch )
522522 notCASBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?)" , title + "_baz" , revid , modified )
523523 casMap = make (map [string ]interface {})
524- if _ , _ , err := session . MapExecuteBatchCAS ( notCASBatch , casMap ); err != ErrNotFound {
524+ if _ , _ , err := notCASBatch . MapExecCAS ( casMap ); err != ErrNotFound {
525525 t .Fatal ("insert should have returned not found:" , err )
526526 }
527527
528528 notCASBatch = session .Batch (LoggedBatch )
529529 notCASBatch .Query ("INSERT INTO cas_table (title, revid, last_modified) VALUES (?, ?, ?)" , title + "_baz" , revid , modified )
530530 casMap = make (map [string ]interface {})
531- if _ , _ , err := session . ExecuteBatchCAS ( notCASBatch , & revidCAS ); err != ErrNotFound {
531+ if _ , _ , err := notCASBatch . ExecCAS ( & revidCAS ); err != ErrNotFound {
532532 t .Fatal ("insert should have returned not found:" , err )
533533 }
534534
535535 failBatch = session .Batch (LoggedBatch )
536536 failBatch .Query ("UPDATE cas_table SET last_modified = DATEOF(NOW()) WHERE title='_foo' AND revid=3e4ad2f1-73a4-11e5-9381-29463d90c3f0 IF last_modified = ?" , modified )
537- if _ , _ , err := session . ExecuteBatchCAS ( failBatch , new (bool )); err == nil {
537+ if _ , _ , err := failBatch . ExecCAS ( new (bool )); err == nil {
538538 t .Fatal ("update should have errored" )
539539 }
540540 // make sure MapScanCAS does not panic when MapScan fails
@@ -550,7 +550,7 @@ func TestCAS(t *testing.T) {
550550 failBatch .Query ("UPDATE cas_table SET last_modified = DATEOF(NOW()) WHERE title='_foo' AND revid=3e4ad2f1-73a4-11e5-9381-29463d90c3f0 IF last_modified = ?" , modified )
551551 casMap = make (map [string ]interface {})
552552 casMap ["last_modified" ] = false
553- if _ , _ , err := session . MapExecuteBatchCAS ( failBatch , casMap ); err == nil {
553+ if _ , _ , err := failBatch . MapExecCAS ( casMap ); err == nil {
554554 t .Fatal ("update should have errored" )
555555 }
556556}
@@ -666,7 +666,7 @@ func TestBatch(t *testing.T) {
666666 batch .Query (`INSERT INTO batch_table (id) VALUES (?)` , i )
667667 }
668668
669- if err := session . ExecuteBatch ( batch ); err != nil {
669+ if err := batch . Exec ( ); err != nil {
670670 t .Fatal ("execute batch:" , err )
671671 }
672672
@@ -702,7 +702,7 @@ func TestUnpreparedBatch(t *testing.T) {
702702 batch .Query (`UPDATE batch_unprepared SET c = c + 1 WHERE id = 1` )
703703 }
704704
705- if err := session . ExecuteBatch ( batch ); err != nil {
705+ if err := batch . Exec ( ); err != nil {
706706 t .Fatal ("execute batch:" , err )
707707 }
708708
@@ -738,8 +738,8 @@ func TestBatchLimit(t *testing.T) {
738738 for i := 0 ; i < 65537 ; i ++ {
739739 batch .Query (`INSERT INTO batch_table2 (id) VALUES (?)` , i )
740740 }
741- if err := session . ExecuteBatch ( batch ); err != ErrTooManyStmts {
742- t .Fatal ("gocql attempted to execute a batch larger than the support limit of statements." )
741+ if err := batch . Exec ( ); err != ErrTooManyStmts {
742+ t .Fatalf ("gocql attempted to execute a batch larger than the support limit of statements: expected %v, got %v" , ErrTooManyStmts , err )
743743 }
744744
745745}
@@ -790,7 +790,7 @@ func TestTooManyQueryArgs(t *testing.T) {
790790
791791 batch := session .Batch (UnloggedBatch )
792792 batch .Query ("INSERT INTO too_many_query_args (id, value) VALUES (?, ?)" , 1 , 2 , 3 )
793- err = session . ExecuteBatch ( batch )
793+ err = batch . Exec ( )
794794
795795 if err == nil {
796796 t .Fatal ("'`INSERT INTO too_many_query_args (id, value) VALUES (?, ?)`, 1, 2, 3' should return an error" )
@@ -822,7 +822,7 @@ func TestNotEnoughQueryArgs(t *testing.T) {
822822
823823 batch := session .Batch (UnloggedBatch )
824824 batch .Query ("INSERT INTO not_enough_query_args (id, cluster, value) VALUES (?, ?, ?)" , 1 , 2 )
825- err = session . ExecuteBatch ( batch )
825+ err = batch . Exec ( )
826826
827827 if err == nil {
828828 t .Fatal ("'`INSERT INTO not_enough_query_args (id, cluster, value) VALUES (?, ?, ?)`, 1, 2' should return an error" )
@@ -1448,7 +1448,7 @@ func TestBatchQueryInfo(t *testing.T) {
14481448 batch := session .Batch (LoggedBatch )
14491449 batch .Bind ("INSERT INTO batch_query_info (id, cluster, value) VALUES (?, ?,?)" , write )
14501450
1451- if err := session . ExecuteBatch ( batch ); err != nil {
1451+ if err := batch . Exec ( ); err != nil {
14521452 t .Fatalf ("batch insert into batch_query_info failed, err '%v'" , err )
14531453 }
14541454
@@ -1961,7 +1961,7 @@ func TestBatchStats(t *testing.T) {
19611961 b .Query ("INSERT INTO batchStats (id) VALUES (?)" , 1 )
19621962 b .Query ("INSERT INTO batchStats (id) VALUES (?)" , 2 )
19631963
1964- if err := session . ExecuteBatch ( b ); err != nil {
1964+ if err := b . Exec ( ); err != nil {
19651965 t .Fatalf ("query failed. %v" , err )
19661966 } else {
19671967 if b .Attempts () < 1 {
@@ -2018,7 +2018,7 @@ func TestBatchObserve(t *testing.T) {
20182018 batch .Query (fmt .Sprintf (`INSERT INTO batch_observe_table (id,other) VALUES (?,%d)` , i ), i )
20192019 }
20202020
2021- if err := session . ExecuteBatch ( batch ); err != nil {
2021+ if err := batch . Exec ( ); err != nil {
20222022 t .Fatal ("execute batch:" , err )
20232023 }
20242024 if observedBatch == nil {
@@ -3315,7 +3315,7 @@ func TestUnsetColBatch(t *testing.T) {
33153315 b .Query ("INSERT INTO gocql_test.batchUnsetInsert(id, my_int, my_text) VALUES (?,?,?)" , 1 , UnsetValue , "" )
33163316 b .Query ("INSERT INTO gocql_test.batchUnsetInsert(id, my_int, my_text) VALUES (?,?,?)" , 2 , 2 , UnsetValue )
33173317
3318- if err := session . ExecuteBatch ( b ); err != nil {
3318+ if err := b . Exec ( ); err != nil {
33193319 t .Fatalf ("query failed. %v" , err )
33203320 } else {
33213321 if b .Attempts () < 1 {
0 commit comments