Last active
December 22, 2015 10:49
-
-
Save jstemmer/6461407 to your computer and use it in GitHub Desktop.
ODBC driver panic when executing a prepared statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
_ "code.google.com/p/odbc" | |
"database/sql" | |
"log" | |
) | |
func main() { | |
db, err := sql.Open("odbc", "DSN=xstreamds") | |
if err != nil { | |
log.Fatal(err) | |
} | |
defer db.Close() | |
if _, err := db.Exec("IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'testing') BEGIN DROP TABLE testing END;"); err != nil { | |
log.Fatal(err) | |
} | |
if _, err := db.Exec("CREATE TABLE testing(id INT PRIMARY KEY NOT NULL, v1 TEXT, v2 TEXT, v3 TEXT, v4 TEXT, v5 TEXT, v6 TEXT, v7 TEXT, v8 TEXT)"); err != nil { | |
log.Fatal(err) | |
} | |
stmt, err := db.Prepare("INSERT INTO testing(id, v1, v2, v3, v4, v5, v6, v7, v8) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)") | |
if err != nil { | |
log.Fatal(err) | |
} | |
b := "string string string string string string string string string" | |
for i := 0; i < 10000; i++ { | |
log.Printf("%d", i) | |
if _, err := stmt.Exec(i, b, b, b, b, b, b, b, b); err != nil { | |
log.Fatal(err) | |
} | |
//runtime.GC() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Y:\gocode\src\odbctest>odbctest | |
2013/09/06 11:18:09 0 | |
2013/09/06 11:18:09 1 | |
2013/09/06 11:18:09 2 | |
2013/09/06 11:18:09 3 | |
2013/09/06 11:18:09 4 | |
2013/09/06 11:18:09 5 | |
2013/09/06 11:18:09 6 | |
2013/09/06 11:18:09 7 | |
2013/09/06 11:18:09 8 | |
2013/09/06 11:18:09 9 | |
2013/09/06 11:18:09 10 | |
2013/09/06 11:18:09 11 | |
2013/09/06 11:18:09 12 | |
2013/09/06 11:18:09 13 | |
2013/09/06 11:18:09 14 | |
2013/09/06 11:18:09 15 | |
2013/09/06 11:18:09 16 | |
2013/09/06 11:18:09 17 | |
2013/09/06 11:18:09 18 | |
2013/09/06 11:18:09 19 | |
2013/09/06 11:18:09 20 | |
2013/09/06 11:18:09 21 | |
2013/09/06 11:18:09 22 | |
2013/09/06 11:18:09 23 | |
2013/09/06 11:18:09 24 | |
2013/09/06 11:18:09 25 | |
unexpected fault address 0x126f0004 | |
fatal error: fault | |
[signal 0xc0000005 code=0x0 addr=0x126f0004 pc=0x72bc979e] | |
goroutine 1 [syscall]: | |
[fp=0x1e14e8] return() | |
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist465310315/go/src/pkg/runtime/asm_386.s:472 | |
[fp=0x1e1510] runtime.cgocall(0x41d650, 0x1e1518) | |
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist465310315/go/src/pkg/runtime/cgocall.c:162 +0x10a | |
[fp=0x1e1534] syscall.Syscall(0x72cca474, 0x1, 0x3f9fc0, 0x0, 0x0, ...) | |
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist465310315/go/src/pkg/runtime/zsyscall_windows_windows_386.c:74 +0x49 | |
[fp=0x1e1558] code.google.com/p/odbc/api.SQLExecute(0x3f9fc0, 0x3f9fc0) | |
Y:/gocode/src/code.google.com/p/odbc/api/zapi_windows.go:89 +0x56 | |
[fp=0x1e15a4] code.google.com/p/odbc.(*ODBCStmt).Exec(0x12618390, 0x1261ca00, 0x9, 0x9, 0x44c4c8, ...) | |
Y:/gocode/src/code.google.com/p/odbc/odbcstmt.go:110 +0x153 | |
[fp=0x1e15d4] code.google.com/p/odbc.(*Stmt).Exec(0x12629c20, 0x1261ca00, 0x9, 0x9, 0x0, ...) | |
Y:/gocode/src/code.google.com/p/odbc/stmt.go:60 +0x18f | |
[fp=0x1e1650] database/sql.resultFromStatement(0x12629b60, 0x126182d0, 0x12618330, 0x12629c20, 0x1e171c, ...) | |
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist465310315/go/src/pkg/database/sql/sql.go:1077 +0x1de | |
[fp=0x1e169c] database/sql.(*Stmt).Exec(0x1261c1e0, 0x1e171c, 0x9, 0x9, 0x0, ...) | |
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist465310315/go/src/pkg/database/sql/sql.go:1056 +0x13c | |
[fp=0x1e17c4] main.main() | |
Y:/gocode/src/odbctest/main.go:32 +0x516 | |
[fp=0x1e17dc] runtime.main() | |
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist465310315/go/src/pkg/runtime/proc.c:182 +0x8e | |
[fp=0x1e17e0] runtime.goexit() | |
C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist465310315/go/src/pkg/runtime/proc.c:1223 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment