mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-18 13:41:49 +03:00
1ceb50e795
* initial refactoring for the numRows param * work on driver.NewBatchInsert * work on NewBatchInsert * batch insert seems to work * switched testh.Insert to use BatchInsert * doc cleanup * batch insert for dbwriter and csv * removed unneeded NumRows from driver.StmtExecer * minor tidyup
29 lines
576 B
Go
29 lines
576 B
Go
package mysql
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
var KindFromDBTypeName = kindFromDBTypeName
|
|
|
|
func TestPlaceholders(t *testing.T) {
|
|
testCases := []struct {
|
|
numCols int
|
|
numRows int
|
|
want string
|
|
}{
|
|
{numCols: 0, numRows: 0, want: ""},
|
|
{numCols: 1, numRows: 1, want: "(?)"},
|
|
{numCols: 2, numRows: 1, want: "(?, ?)"},
|
|
{numCols: 1, numRows: 2, want: "(?), (?)"},
|
|
{numCols: 2, numRows: 2, want: "(?, ?), (?, ?)"},
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
got := placeholders(tc.numCols, tc.numRows)
|
|
require.Equal(t, tc.want, got)
|
|
}
|
|
}
|