Skip to content

Commit 862d443

Browse files
authored
Merge pull request #538 from eclipse-vertx/sql-template
close #626
2 parents 96611e6 + a266727 commit 862d443

File tree

59 files changed

+5134
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+5134
-5
lines changed

pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@
108108
<module>vertx-mysql-client</module>
109109
<module>vertx-mssql-client</module>
110110
<module>vertx-db2-client</module>
111+
<module>vertx-sql-client-templates</module>
111112
</modules>
112113

113-
114-
115114
</project>

vertx-mssql-client/src/main/java/io/vertx/mssqlclient/impl/MSSQLConnectionImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ public MSSQLConnectionImpl(MSSQLConnectionFactory factory, ContextInternal conte
2828
this.factory = factory;
2929
}
3030

31+
@Override
32+
public int appendQueryPlaceholder(StringBuilder queryBuilder, int index, int current) {
33+
queryBuilder.append('@').append(1 + index);
34+
return index;
35+
}
36+
3137
public static Future<MSSQLConnection> connect(Vertx vertx, MSSQLConnectOptions options) {
3238
ContextInternal ctx = (ContextInternal) vertx.getOrCreateContext();
3339
PromiseInternal<MSSQLConnection> promise = ctx.promise();

vertx-mssql-client/src/main/java/io/vertx/mssqlclient/impl/MSSQLPoolImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public MSSQLPoolImpl(ContextInternal context, boolean closeVertx, MSSQLConnectOp
3737
this.pool = new ConnectionPool(connectionFactory, context, poolOptions.getMaxSize(), poolOptions.getMaxWaitQueueSize());
3838
}
3939

40+
@Override
41+
public int appendQueryPlaceholder(StringBuilder queryBuilder, int index, int current) {
42+
queryBuilder.append('@').append(1 + index);
43+
return index;
44+
}
45+
4046
@Override
4147
public void connect(Handler<AsyncResult<Connection>> completionHandler) {
4248
connectionFactory.connect().onComplete(completionHandler);

vertx-pg-client/src/main/java/io/vertx/pgclient/impl/PgConnectionImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ public static Future<PgConnection> connect(ContextInternal context, PgConnectOpt
5454
this.factory = factory;
5555
}
5656

57+
@Override
58+
public int appendQueryPlaceholder(StringBuilder queryBuilder, int index, int current) {
59+
queryBuilder.append('$').append(1 + index);
60+
return index;
61+
}
62+
5763
@Override
5864
public PgConnection notificationHandler(Handler<PgNotification> handler) {
5965
notificationHandler = handler;

vertx-pg-client/src/main/java/io/vertx/pgclient/impl/PgPoolImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ public PgPoolImpl(ContextInternal context, boolean closeVertx, PgConnectOptions
6060
}
6161
}
6262

63+
@Override
64+
public int appendQueryPlaceholder(StringBuilder queryBuilder, int index, int current) {
65+
queryBuilder.append('$').append(1 + index);
66+
return index;
67+
}
68+
6369
@Override
6470
public void connect(Handler<AsyncResult<Connection>> completionHandler) {
6571
factory.connect().onComplete(completionHandler);

vertx-pg-client/src/test/java/io/vertx/pgclient/PgClientTestBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939

4040
public abstract class PgClientTestBase<C extends SqlClient> extends PgTestBase {
4141

42-
Vertx vertx;
43-
Consumer<Handler<AsyncResult<C>>> connector;
42+
protected Vertx vertx;
43+
protected Consumer<Handler<AsyncResult<C>>> connector;
4444

4545
@Before
4646
public void setup() throws Exception {

vertx-sql-client-templates/pom.xml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
~ Copyright (C) 2017 Julien Viet
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
~
17+
-->
18+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
19+
20+
<modelVersion>4.0.0</modelVersion>
21+
22+
<parent>
23+
<groupId>io.vertx</groupId>
24+
<artifactId>vertx-sql-client-parent</artifactId>
25+
<version>4.0.0-SNAPSHOT</version>
26+
</parent>
27+
28+
<artifactId>vertx-sql-client-templates</artifactId>
29+
30+
<name>Vertx SQL Client Templates</name>
31+
<url>https://github.com/eclipse-vertx/vertx-sql-client</url>
32+
<description>Vert.x SQL Client Templates</description>
33+
34+
<properties>
35+
<docs.dir>${project.basedir}/src/main/docs</docs.dir>
36+
<generated.dir>${project.basedir}/src/main/generated</generated.dir>
37+
</properties>
38+
39+
<dependencies>
40+
41+
<!-- Vert.x dependencies -->
42+
<dependency>
43+
<groupId>io.vertx</groupId>
44+
<artifactId>vertx-sql-client</artifactId>
45+
</dependency>
46+
<dependency>
47+
<groupId>io.vertx</groupId>
48+
<artifactId>vertx-codegen</artifactId>
49+
<optional>true</optional>
50+
</dependency>
51+
<dependency>
52+
<groupId>io.vertx</groupId>
53+
<artifactId>vertx-docgen</artifactId>
54+
<optional>true</optional>
55+
</dependency>
56+
57+
<!-- For testing -->
58+
<dependency>
59+
<groupId>com.fasterxml.jackson.core</groupId>
60+
<artifactId>jackson-databind</artifactId>
61+
<scope>test</scope>
62+
</dependency>
63+
<dependency>
64+
<groupId>com.fasterxml.jackson.datatype</groupId>
65+
<artifactId>jackson-datatype-jsr310</artifactId>
66+
<scope>test</scope>
67+
<version>2.10.2</version>
68+
</dependency>
69+
<dependency>
70+
<groupId>org.testcontainers</groupId>
71+
<artifactId>postgresql</artifactId>
72+
<version>${testcontainers.version}</version>
73+
<scope>test</scope>
74+
</dependency>
75+
<dependency>
76+
<groupId>io.vertx</groupId>
77+
<artifactId>vertx-pg-client</artifactId>
78+
<version>4.0.0-SNAPSHOT</version>
79+
<scope>test</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>io.vertx</groupId>
83+
<artifactId>vertx-mysql-client</artifactId>
84+
<version>4.0.0-SNAPSHOT</version>
85+
<scope>test</scope>
86+
</dependency>
87+
<dependency>
88+
<groupId>io.vertx</groupId>
89+
<artifactId>vertx-pg-client</artifactId>
90+
<version>4.0.0-SNAPSHOT</version>
91+
<type>test-jar</type>
92+
<scope>test</scope>
93+
</dependency>
94+
</dependencies>
95+
96+
<build>
97+
<plugins>
98+
<plugin>
99+
<groupId>org.bsc.maven</groupId>
100+
<artifactId>maven-processor-plugin</artifactId>
101+
<executions>
102+
<execution>
103+
<id>generate-test-sources</id>
104+
<goals>
105+
<goal>process-test</goal>
106+
</goals>
107+
<phase>generate-test-sources</phase>
108+
<configuration>
109+
<systemProperties>
110+
<java.util.logging.SimpleFormatter.format>%4$s: %3$s - %5$s %6$s%n</java.util.logging.SimpleFormatter.format>
111+
</systemProperties>
112+
<processors>
113+
<processor>io.vertx.codegen.CodeGenProcessor</processor>
114+
</processors>
115+
<outputDirectory>${project.basedir}/src/test/generated</outputDirectory>
116+
</configuration>
117+
</execution>
118+
</executions>
119+
</plugin>
120+
<plugin>
121+
<groupId>org.codehaus.mojo</groupId>
122+
<artifactId>build-helper-maven-plugin</artifactId>
123+
<executions>
124+
<execution>
125+
<id>add-test-source</id>
126+
<goals>
127+
<goal>add-test-source</goal>
128+
</goals>
129+
<configuration>
130+
<sources>
131+
<source>${basedir}/src/test/generated</source>
132+
</sources>
133+
</configuration>
134+
</execution>
135+
</executions>
136+
</plugin>
137+
</plugins>
138+
<pluginManagement>
139+
<plugins>
140+
<plugin>
141+
<artifactId>maven-clean-plugin</artifactId>
142+
<executions>
143+
<execution>
144+
<id>default-clean</id>
145+
<configuration>
146+
<filesets>
147+
<fileset>
148+
<directory>${project.basedir}/src/test/generated</directory>
149+
</fileset>
150+
</filesets>
151+
</configuration>
152+
</execution>
153+
</executions>
154+
</plugin>
155+
</plugins>
156+
</pluginManagement>
157+
</build>
158+
159+
</project>

0 commit comments

Comments
 (0)