<commit_before>jdbc-query
==========
[![Build Status](https://travis-ci.org/TroyHisted/jdbc-query.svg?branch=master)](https://travis-ci.org/TroyHisted/jdbc-query)

JDBC query builder supporting named parameters and facilitating a more concise java syntax.

## Features
* Named parameters
* Automatic housekeeping
* Removes boilerplate

## Sample

```java
import java.sql.ResultSet;
import java.sql.SQLException;

import com.jdbcquery.Query;
import com.jdbcquery.RowMapper;

public class EmployeeDao {

	public String retrieveName(int employeeId) {
		return Query.forString("SELECT name FROM employees WHERE empId = :employeeId")
				.set("employeeId", employeeId)
				.execute();
	}
	
	public Date retrieveHireDate(int employeeId) {
		return Query.forObject(
				"SELECT hired FROM employees WHERE empId = :employeeId",
				new RowMapper<Date>(){
					protected Date mapRow(ResultSet resultSet) throws SQLException {
						return resultSet.getDate("hired");
				}})
			.set("employeeId", employeeId)
			.execute();
	}
}

```

## Configuration Steps
1. Create a class that implements _JdbcConnection_.
2. Expose the class as an SPI service.
  * Create a file called _com.jdbcquery.JdbcConnector_ in your _META-INF_ folder.
  * In that file specify the fully qualified name of your _JdbcConnection_ implementation.
 
### Sample JdbcConnection implementation
```java
package com.mydomain.dao;

import java.sql.Connection;
import java.sql.SQLException;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

import com.jdbcquery.DaoException;
import com.jdbcquery.JdbcConnector;
<commit_msg>Adding note about beta software<commit_after>jdbc-query
==========
[![Build Status](https://travis-ci.org/TroyHisted/jdbc-query.svg?branch=master)](https://travis-ci.org/TroyHisted/jdbc-query)

JDBC query builder that supports named parameters and reduces boilerplate code.

**IMPORTANT: This is beta software, it will have bugs. Do NOT use in a mission critical environment.**

## Features
* Named parameters
* Automatic housekeeping
* Removes boilerplate
* Works with POJOs
* No dependencies

## Example

```java
import java.sql.ResultSet;
import java.sql.SQLException;

import com.jdbcquery.Query;
import com.jdbcquery.RowMapper;

public class EmployeeDao {

	public String retrieveName(int employeeId) {
		return Query.forString("SELECT name FROM employees WHERE empId = :employeeId")
				.set("employeeId", employeeId)
				.execute();
	}
	
	public Date retrieveHireDate(int employeeId) {
		return Query.forObject(
				"SELECT hired FROM employees WHERE empId = :employeeId",
				new RowMapper<Date>(){
					protected Date mapRow(ResultSet resultSet) throws SQLException {
						return resultSet.getDate("hired");
				}})
			.set("employeeId", employeeId)
			.execute();
	}
}

```

## Configuration
1. Create a class that implements _JdbcConnection_.
  * This class must implement the `getConnection()` method that simply returns a `java.sql.Connectio`.
2. Expose the class as an SPI service.
  * Create a file called _com.jdbcquery.JdbcConnector_ in your _META-INF_ folder.
  * In that file specify the fully qualified name of your _JdbcConnection_ implementation.
 
### Sample JdbcConnection implementation
```java
package com.mydomain.dao;

import java.sql.Connection;
import java.sql.SQLException;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

import com.jdbcquery.DaoException;
import com.jdbcquery.JdbcConnector;

{'fraction_non_alphanumeric': 0.1034965034965035, 'fraction_numerical': 0.0011188811188811189, 'mean_word_length': 4.852700490998363, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1285439', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1038, 'n_words': 309}