File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,30 @@ var ScriptTests = []ScriptTest{
121121 },
122122 },
123123 },
124+ {
125+ Name : "GMS issue 2349" ,
126+ SetUpScript : []string {
127+ "CREATE TABLE table1 (id int NOT NULL AUTO_INCREMENT primary key, name text)" ,
128+ `
129+ CREATE TABLE table2 (
130+ id int NOT NULL AUTO_INCREMENT,
131+ name text,
132+ fk int,
133+ PRIMARY KEY (id),
134+ CONSTRAINT myConstraint FOREIGN KEY (fk) REFERENCES table1 (id)
135+ )` ,
136+ },
137+ Assertions : []ScriptTestAssertion {
138+ {
139+ Query : "INSERT INTO table1 (name) VALUES ('tbl1 row 1');" ,
140+ Expected : []sql.Row {{types.OkResult {RowsAffected : 1 , InsertID : 1 }}},
141+ },
142+ {
143+ Query : "INSERT INTO table1 (name) VALUES ('tbl1 row 2');" ,
144+ Expected : []sql.Row {{types.OkResult {RowsAffected : 1 , InsertID : 2 }}},
145+ },
146+ },
147+ },
124148 {
125149 Name : "missing indexes" ,
126150 SetUpScript : []string {
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ func (s *Session) dropTable(d *TableData) {
118118// Because we don't support concurrency, we store table data changes in the session, rather than the transaction itself.
119119func (s * Session ) StartTransaction (ctx * sql.Context , tCharacteristic sql.TransactionCharacteristic ) (sql.Transaction , error ) {
120120 s .tables = make (map [tableKey ]* TableData )
121+ s .editAccumulators = make (map [tableKey ]tableEditAccumulator )
121122 return & Transaction {tCharacteristic == sql .ReadOnly }, nil
122123}
123124
You can’t perform that action at this time.
0 commit comments