(t *testing.T)
| 158 | } |
| 159 | |
| 160 | func testMultiStatement(t *testing.T) { |
| 161 | dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { |
| 162 | SkipIfUnsupportedArch(t, c) |
| 163 | ip, port, err := c.Port(defaultPort) |
| 164 | if err != nil { |
| 165 | t.Fatal(err) |
| 166 | } |
| 167 | |
| 168 | addr := msConnectionString(ip, port) |
| 169 | ms := &SQLServer{} |
| 170 | d, err := ms.Open(addr) |
| 171 | if err != nil { |
| 172 | t.Fatal(err) |
| 173 | } |
| 174 | defer func() { |
| 175 | if err := d.Close(); err != nil { |
| 176 | t.Error(err) |
| 177 | } |
| 178 | }() |
| 179 | if err := d.Run(strings.NewReader("CREATE TABLE foo (foo text); CREATE TABLE bar (bar text);")); err != nil { |
| 180 | t.Fatalf("expected err to be nil, got %v", err) |
| 181 | } |
| 182 | |
| 183 | // make sure second table exists |
| 184 | var exists int |
| 185 | if err := d.(*SQLServer).conn.QueryRowContext(context.Background(), "SELECT COUNT(1) FROM information_schema.tables WHERE table_name = 'bar' AND table_schema = (SELECT schema_name()) AND table_catalog = (SELECT db_name())").Scan(&exists); err != nil { |
| 186 | t.Fatal(err) |
| 187 | } |
| 188 | if exists != 1 { |
| 189 | t.Fatalf("expected table bar to exist") |
| 190 | } |
| 191 | }) |
| 192 | } |
| 193 | |
| 194 | func testErrorParsing(t *testing.T) { |
| 195 | dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…