MCPcopy
hub / github.com/go-sql-driver/mysql / TestPreparedManyCols

Function TestPreparedManyCols

driver_test.go:1905–1934  ·  view source on GitHub ↗

Regression test for * more than 32 NULL parameters (issue 209) * more parameters than fit into the buffer (issue 201) * parameters * 64 > max_allowed_packet (issue 734)

(t *testing.T)

Source from the content-addressed store, hash-verified

1903// * more parameters than fit into the buffer (issue 201)
1904// * parameters * 64 > max_allowed_packet (issue 734)
1905func TestPreparedManyCols(t *testing.T) {
1906 numParams := 65535
1907 runTests(t, dsn, func(dbt *DBTest) {
1908 query := "SELECT ?" + strings.Repeat(",?", numParams-1)
1909 stmt, err := dbt.db.Prepare(query)
1910 if err != nil {
1911 dbt.Fatal(err)
1912 }
1913 defer stmt.Close()
1914
1915 // create more parameters than fit into the buffer
1916 // which will take nil-values
1917 params := make([]any, numParams)
1918 rows, err := stmt.Query(params...)
1919 if err != nil {
1920 dbt.Fatal(err)
1921 }
1922 rows.Close()
1923
1924 // Create 0byte string which we can't send via STMT_LONG_DATA.
1925 for i := range numParams {
1926 params[i] = ""
1927 }
1928 rows, err = stmt.Query(params...)
1929 if err != nil {
1930 dbt.Fatal(err)
1931 }
1932 rows.Close()
1933 })
1934}
1935
1936func TestConcurrent(t *testing.T) {
1937 if enabled, _ := readBool(os.Getenv("MYSQL_TEST_CONCURRENT")); !enabled {

Callers

nothing calls this directly

Calls 4

runTestsFunction · 0.85
PrepareMethod · 0.80
CloseMethod · 0.45
QueryMethod · 0.45

Tested by

no test coverage detected