(t *testing.T)
| 84 | } |
| 85 | |
| 86 | func TestConnectWithPreferSimpleProtocol(t *testing.T) { |
| 87 | t.Parallel() |
| 88 | |
| 89 | connConfig := mustParseConfig(t, os.Getenv("PGX_TEST_DATABASE")) |
| 90 | connConfig.DefaultQueryExecMode = pgx.QueryExecModeSimpleProtocol |
| 91 | |
| 92 | conn := mustConnect(t, connConfig) |
| 93 | defer closeConn(t, conn) |
| 94 | |
| 95 | // If simple protocol is used we should be able to correctly scan the result |
| 96 | // into a pgtype.Text as the integer will have been encoded in text. |
| 97 | |
| 98 | var s pgtype.Text |
| 99 | err := conn.QueryRow(context.Background(), "select $1::int4", 42).Scan(&s) |
| 100 | require.NoError(t, err) |
| 101 | require.Equal(t, pgtype.Text{String: "42", Valid: true}, s) |
| 102 | |
| 103 | ensureConnValid(t, conn) |
| 104 | } |
| 105 | |
| 106 | func TestConnectConfigRequiresConnConfigFromParseConfig(t *testing.T) { |
| 107 | config := &pgx.ConnConfig{} |
nothing calls this directly
no test coverage detected