JDBC Named Parameters

Library providing named parameter capability for JDBC

License

License

GroupId

GroupId

com.axiomalaska
ArtifactId

ArtifactId

jdbc-named-parameters
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

jar
Description

Description

JDBC Named Parameters
Library providing named parameter capability for JDBC
Project URL

Project URL

https://github.com/axiomalaska/jdbc-named-parameters
Source Code Management

Source Code Management

https://github.com/axiomalaska/jdbc-named-parameters

Download jdbc-named-parameters

How to add to project

<!-- https://jarcasting.com/artifacts/com.axiomalaska/jdbc-named-parameters/ -->
<dependency>
    <groupId>com.axiomalaska</groupId>
    <artifactId>jdbc-named-parameters</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.axiomalaska/jdbc-named-parameters/
implementation 'com.axiomalaska:jdbc-named-parameters:1.1'
// https://jarcasting.com/artifacts/com.axiomalaska/jdbc-named-parameters/
implementation ("com.axiomalaska:jdbc-named-parameters:1.1")
'com.axiomalaska:jdbc-named-parameters:jar:1.1'
<dependency org="com.axiomalaska" name="jdbc-named-parameters" rev="1.1">
  <artifact name="jdbc-named-parameters" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.axiomalaska', module='jdbc-named-parameters', version='1.1')
)
libraryDependencies += "com.axiomalaska" % "jdbc-named-parameters" % "1.1"
[com.axiomalaska/jdbc-named-parameters "1.1"]

Dependencies

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
com.google.guava : guava jar 24.0-jre

Project Modules

There are no modules declared in this project.

jdbc-named-parameters

Provides a NamedParameterPreparedStatement class which implements PreparedStatement and allows the use of named parameters in JDBC prepared SQL statements.

Credit to Adam Crume for his implementation of the SQL query parser:

http://www.javaworld.com/article/2077706/core-java/named-parameters-for-preparedstatement.html

Usage

Add as a dependency:

<dependency>
  <groupId>com.axiomalaska</groupId>
  <artifactId>jdbc-named-parameters</artifactId>
  <version>1.1</version>
</dependency>

Then use in place of PreparedStatement, e.g.

PreparedStatement stat = NamedParameterPreparedStatement.createNamedParameterPreparedStatement(
    connection, "SELECT id FROM some_table WHERE name = :name");

Query test parsing

Usually this library should be used internally by applications to parse queries containing named parameters. The jar is also executable and can be used to view the parsed results of a query containing named parameters.

Execute the jar and pass the path to a query file as the only argument:

java -jar jdbc-named-parameters.jar /home/you/test_query.sql

Versions

Version
1.1