@@ -46,6 +46,21 @@ func (this *Fixture) Teardown() {
4646 this .So (this .db .Close (), better .BeNil )
4747}
4848
49+ func (this * Fixture ) TestScript () {
50+ script := & InsertOne {name : "foo" , expectedRowsAffected : 1 }
51+ err := this .DB .Execute (this .Context (), script )
52+ this .So (err , better .BeNil )
53+ row := this .db .QueryRowContext (this .Context (), "select name from sqldb_integration_test where name = 'foo';" )
54+ var foo string
55+ err = row .Scan (& foo )
56+ this .So (err , better .BeNil )
57+ this .So (foo , should .Equal , "foo" )
58+ }
59+ func (this * Fixture ) TestScript_OptimisticConcurrencyCheckFailure () {
60+ script := & InsertOne {name : "foo" , expectedRowsAffected : 2 }
61+ err := this .DB .Execute (this .Context (), script )
62+ this .So (err , should .WrapError , sqldb .ErrOptimisticConcurrencyCheckFailed )
63+ }
4964func (this * Fixture ) TestQuery () {
5065 for range 10 { // should transition to prepared statements
5166 query := & SelectAll {Result : make (map [int ]string )}
@@ -74,6 +89,23 @@ func (this *Fixture) TestQueryQueryRow_NoResult() {
7489
7590///////////////////////////////////////////////
7691
92+ type InsertOne struct {
93+ expectedRowsAffected uint64
94+ name string
95+ }
96+
97+ func (this * InsertOne ) Statements () string {
98+ return "INSERT INTO sqldb_integration_test (name) VALUES (?);"
99+ }
100+ func (this * InsertOne ) Parameters () []any {
101+ return []any {this .name }
102+ }
103+ func (this * InsertOne ) ExpectedRowsAffected () uint64 {
104+ return this .expectedRowsAffected
105+ }
106+
107+ ///////////////////////////////////////////////
108+
77109type DDL struct {
78110 totalRows uint64
79111}
0 commit comments