<commit_before><commit_msg>Starting to write a readme for the database namespace<commit_after># A flexible and lightweight Database Library for PHP

This library abstracts and provides help with most aspects of dealing with relational
databases such as keeping connections to the server, building queries,
filtering possible SQL injections, inspecting and altering schemas and with debugging and
profiling queries sent to the database.

It adopts the API from the native PDO extension in PHP for familiarity, but solves many of the
inconsistencies PDO has, while also provides several features that extends PDO capabilities.


## Connecting to the database

This library is able to work with the following databases:

* MySQL
* Postges
* SQLite
* Microsoft SQL Server (2008 and above)

The first thing you need to do for using this library is creating a connection object,
and before performing any operations with the connection, you need to specify a driver
to use:

```php
use Cake\Database\Connection;
use Cake\Database\Driver\Mysql;

$driver = new Mysql([
	'database' => 'test',
	'login' => 'root',
	'password' => '<PASSWORD>'
]);
$connection = new Connection([
	'driver' => $driver
]);
```

Drivers are classes responsible for actually executing the commands to the database and
correctly building the SQL according to the database specific dialect. Drivers can also
be specified by passing a class name, in that case, include all the connection details
directly in the options array:

```php
use Cake\Database\Connection;

$connection = new Connection([
	'driver' => 'Cake\Driver\Sqlite'
	'database' => '/path/to/file.db'
]);
```

### Connection options

This is a list of possible options that can be passed for creating a connection:

* `persistent`: Creates a persistent connection
* `host`: The server host
* `database`: The database name
* `username`: Login credential
* `password`: <PASSWORD>
* `encoding`: The connection encoding (or charset)
* `timezone`: The connection timezone or time offset

## Using connections

After creating a connection, you can immediately interact with the database. You can choose
either to use the shorthand methods `execute()`, `insert()`, `update()`, `delete()` or use the
`newQuery()` for using a query builder.

The easiest way of executing queries is by using the `execute()` method, it will return a
`Cake\Database\StatementInterface` that you can use to get the data back:

```php
$statement = $connection->execute('SELECT * FROM articles');

while($row = $statement->fetch('assoc')) {
	echo $row['title'] . PHP_EOL;
}

```

{'fraction_non_alphanumeric': 0.0888975155279503, 'fraction_numerical': 0.0015527950310559005, 'mean_word_length': 5.077830188679245, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '4501892', 'n_tokens_mistral': 698, 'n_tokens_neox': 655, 'n_words': 337}