<commit_before>jaqb
===========

[![Build Status](https://travis-ci.org/jaredtking/jaqb.png?branch=master)](https://travis-ci.org/jaredtking/jaqb)
[![Coverage Status](https://coveralls.io/repos/jaredtking/jaqb/badge.svg?branch=master)](https://coveralls.io/r/jaredtking/jaqb?branch=master)
[![Latest Stable Version](https://poser.pugx.org/jaredtking/jaqb/v/stable.png)](https://packagist.org/packages/jaredtking/jaqb)
[![Total Downloads](https://poser.pugx.org/jaredtking/jaqb/downloads.png)](https://packagist.org/packages/jaredtking/jaqb)
[![HHVM Status](http://hhvm.h4cc.de/badge/jaredtking/jaqb.svg)](http://hhvm.h4cc.de/package/jaredtking/jaqb)

JAQB: Just Another Query Builder (pronounced "jacob")

## Requirements

- PHP 5.4+ or HHVM 3.3+
- [PDO](http://php.net/pdo)

## Tests

Use phpunit to run the included tests:

```
phpunit
```

## Usage

```php
$qb = new JAQB\QueryBuilder($pdo);
```

### SELECT Query

```php
$qb->select('*')
   ->from('Users')
   ->where('uid', 10)
   ->having('first_name', 'something')
   ->groupBy('last_name')
   ->orderBy('first_name', 'ASC')
   ->limit(100, 10)
   ->all();
```

### INSERT Query

```php
$qb->insert(['field1' => 'what', 'field2' => 'test'])
   ->into('Users')
   ->execute();
```

### UPDATE Query

```php
$qb->table('Users')
   ->where('uid', 10)
   ->values(['test' => 'hello', 'test2' => 'field'])
   ->orderBy('uid', 'ASC')
   ->limit(100)
   ->execute();
```

### DELETE Query

```php
$qb->update('Users')
   ->where('uid', 10)
   ->values(['test' => 'hello', 'test2' => 'field'])
   ->orderBy('uid', 'ASC')
   ->limit(100)
   ->execute();
```

### SQL Query

```php<commit_msg>improve readme examples<commit_after>jaqb
===========

[![Build Status](https://travis-ci.org/jaredtking/jaqb.png?branch=master)](https://travis-ci.org/jaredtking/jaqb)
[![Coverage Status](https://coveralls.io/repos/jaredtking/jaqb/badge.svg?branch=master)](https://coveralls.io/r/jaredtking/jaqb?branch=master)
[![Latest Stable Version](https://poser.pugx.org/jaredtking/jaqb/v/stable.png)](https://packagist.org/packages/jaredtking/jaqb)
[![Total Downloads](https://poser.pugx.org/jaredtking/jaqb/downloads.png)](https://packagist.org/packages/jaredtking/jaqb)
[![HHVM Status](http://hhvm.h4cc.de/badge/jaredtking/jaqb.svg)](http://hhvm.h4cc.de/package/jaredtking/jaqb)

JAQB: Just Another Query Builder (pronounced "jacob")

## Requirements

- PHP 5.4+ or HHVM 3.3+
- [PDO](http://php.net/pdo)

## Tests

Use phpunit to run the included tests:

```
phpunit
```

## Usage

```php
$qb = new JAQB\QueryBuilder($pdo);
```

### SELECT Query

```php
$qb->select('*')
   ->from('Movies')
   ->where('year', 2015, '<')
   ->where('year', 1990, '>=')
   ->groupBy('category')
   ->having('rating', 4.5, '>')
   ->orderBy('rating', 'DESC')
   ->limit(100, 10)
   ->all();
```

### INSERT Query

```php
$qb->insert(['name' => 'Catcher in the Rye', 'author' => '<NAME>'])
   ->into('Books')
   ->execute();
```

### UPDATE Query

```php
$qb->table('Users')
   ->where('uid', 10)
   ->values(['first_name' => 'JAQB', 'website' => 'example.com'])
   ->orderBy('uid', 'ASC')
   ->limit(100)
   ->execute();
```

### DELETE Query

```php
$qb->delete('Users')
   ->where('last_login', strtotime('-1 year'), '<')
   ->limit(100)
   ->orderBy('last_login', 'ASC')
   ->execute();
```

### SQL Query

```php
{'fraction_non_alphanumeric': 0.25705705705705706, 'fraction_numerical': 0.017117117117117116, 'mean_word_length': 4.496699669966997, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 62, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1807393', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1340, 'n_words': 193}