|
20 | 20 | import io.r2dbc.mssql.message.tds.Encode; |
21 | 21 | import io.r2dbc.mssql.message.tds.Redirect; |
22 | 22 | import io.r2dbc.mssql.message.tds.ServerCharset; |
23 | | -import io.r2dbc.mssql.message.token.Column; |
24 | | -import io.r2dbc.mssql.message.token.ColumnMetadataToken; |
25 | | -import io.r2dbc.mssql.message.token.DoneToken; |
26 | | -import io.r2dbc.mssql.message.token.ErrorToken; |
27 | | -import io.r2dbc.mssql.message.token.Prelogin; |
28 | | -import io.r2dbc.mssql.message.token.RowToken; |
29 | | -import io.r2dbc.mssql.message.token.RowTokenFactory; |
30 | | -import io.r2dbc.mssql.message.token.SqlBatch; |
| 23 | +import io.r2dbc.mssql.message.token.*; |
31 | 24 | import io.r2dbc.mssql.message.type.LengthStrategy; |
32 | 25 | import io.r2dbc.mssql.message.type.SqlServerType; |
33 | 26 | import io.r2dbc.mssql.message.type.TypeInformation; |
@@ -171,6 +164,19 @@ void shouldFailOnMultipleRedirects() { |
171 | 164 | assertThat(redirect.isClosed()).isTrue(); |
172 | 165 | } |
173 | 166 |
|
| 167 | + @Test |
| 168 | + void shouldCreateNewPreparedStatement() { |
| 169 | + |
| 170 | + MssqlConnectionFactory connectionFactory = new MssqlConnectionFactory(config -> Mono.empty(), this.configuration); |
| 171 | + ConnectionOptions options = connectionFactory.getConnectionOptions(); |
| 172 | + ConnectionOptions other = connectionFactory.getConnectionOptions(); |
| 173 | + |
| 174 | + options.getPreparedStatementCache().putHandle(1, "foo", new Binding()); |
| 175 | + |
| 176 | + assertThat(options.getPreparedStatementCache().getHandle("foo", new Binding())).isEqualTo(1); |
| 177 | + assertThat(other.getPreparedStatementCache().getHandle("foo", new Binding())).isEqualTo(0); |
| 178 | + } |
| 179 | + |
174 | 180 | private static Column createColumn(int index, String name, SqlServerType serverType, int length, LengthStrategy lengthStrategy, @Nullable Charset charset) { |
175 | 181 |
|
176 | 182 | TypeInformation.Builder builder = TypeInformation.builder().withServerType(serverType).withMaxLength(length).withLengthStrategy(lengthStrategy); |
|
0 commit comments