MCPcopy Create free account
hub / github.com/dolthub/doltgresql / TestBindingWithTextArray

Function TestBindingWithTextArray

testing/go/binding_test.go:96–120  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestBindingWithTextArray(t *testing.T) {
97 ctx, connection, controller := CreateServer(t, "postgres")
98 defer func() {
99 connection.Close(ctx)
100 controller.Stop()
101 require.NoError(t, controller.WaitForStop())
102 }()
103 conn := connection.Default
104
105 m := pgtype.NewMap()
106 textArray := []string{"foo", "bar"}
107
108 plan := m.PlanEncode(pgtype.TextArrayOID, pgtype.BinaryFormatCode, textArray)
109 encodedArr, err := plan.Encode(textArray, nil)
110 require.NoError(t, err)
111
112 args := [][]byte{encodedArr}
113 paramOIDs := []uint32{1009}
114 paramFormats := []int16{1}
115 sql := "SELECT $1::text[]"
116
117 resultReader := conn.PgConn().ExecParams(ctx, sql, args, paramOIDs, paramFormats, nil)
118 result := resultReader.Read()
119 require.NoError(t, result.Err)
120}

Callers

nothing calls this directly

Calls 5

CreateServerFunction · 0.70
CloseMethod · 0.65
StopMethod · 0.45
EncodeMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected