Update version support information and spruce up README file

This commit is contained in:
Timothy Warren 2016-07-19 20:51:18 -04:00
parent 6e1f28724e
commit 97eccfd706
3 changed files with 20 additions and 21 deletions

View File

@ -15,11 +15,6 @@ variables:
POSTGRES_USER: test POSTGRES_USER: test
POSTGRES_PASSWORD: test POSTGRES_PASSWORD: test
test:5.5:
image: php:5.5
script:
- phpunit -c build --no-coverage
test:5.6: test:5.6:
image: php:5.6 image: php:5.6
script: script:

View File

@ -3,6 +3,7 @@ sudo: false
language: php language: php
php: php:
- 5.3
- 5.4 - 5.4
- 5.5 - 5.5
- 5.6 - 5.6
@ -27,5 +28,7 @@ after_script:
matrix: matrix:
allow_failures: allow_failures:
- php: 5.3
- php: 5.4 - php: 5.4
- php: hhvm - php: 5.5
- php: nightly

View File

@ -1,30 +1,31 @@
# Query # Query
A query builder/database abstraction layer, using prepared queries for security. A query builder/database abstraction layer, using prepared statements for security.
[![Build Status](https://jenkins.timshomepage.net/buildStatus/icon?job=query)](https://jenkins.timshomepage.net/job/query/) [![Build Status](https://jenkins.timshomepage.net/buildStatus/icon?job=query)](https://jenkins.timshomepage.net/job/query/)
[![Code Coverage](https://scrutinizer-ci.com/g/timw4mail/Query/badges/coverage.png?s=a96df5417089f90250aeb59013a3964b1ff9b588)](https://scrutinizer-ci.com/g/timw4mail/Query/) [![Code Coverage](https://scrutinizer-ci.com/g/aviat4ion/Query/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/aviat4ion/Query/?branch=develop)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/timw4mail/Query/badges/quality-score.png?s=ce0f185067d7049cfe3f0aba2ca30ed56fb97b20)](https://scrutinizer-ci.com/g/timw4mail/Query/) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/aviat4ion/Query/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/aviat4ion/Query/?branch=develop)
[![Latest Stable Version](https://poser.pugx.org/aviat4ion/query/v/stable.png)](https://packagist.org/packages/aviat4ion/query) [![Latest Stable Version](https://poser.pugx.org/aviat4ion/query/v/stable.png)](https://packagist.org/packages/aviat4ion/query)
[![Total Downloads](https://poser.pugx.org/aviat4ion/query/downloads.png)](https://packagist.org/packages/aviat4ion/query) [![Total Downloads](https://poser.pugx.org/aviat4ion/query/downloads.png)](https://packagist.org/packages/aviat4ion/query)
[![Latest Unstable Version](https://poser.pugx.org/aviat4ion/query/v/unstable.png)](https://packagist.org/packages/aviat4ion/query) [![Latest Unstable Version](https://poser.pugx.org/aviat4ion/query/v/unstable.png)](https://packagist.org/packages/aviat4ion/query)
[![License](https://poser.pugx.org/aviat4ion/query/license.png)](http://www.dbad-license.org/) [![License](https://poser.pugx.org/aviat4ion/query/license.png)](http://www.dbad-license.org/)
## Requirements ## Requirements
* Pdo extensions for the databases you wish to use (unless it's Firebird, in which case, the interbase extension is required) * PDO extensions for the databases you wish to use (unless it's Firebird, in which case, the interbase extension is required)
* PHP 5.3+ * Supported version of PHP (Older versions may work, but are not supported)
## Databases Supported ## Databases Supported
* Firebird (via interbase extension) * Firebird (via interbase extension)
* Firebird (via PDO) -- experimental
* MySQL * MySQL
* PostgreSQL * PostgreSQL
* SQLite * SQLite
## Including Query in your application ## Including Query in your application
To include Query in your PHP project, just include the `autoload.php` file. This will automatically load the classes that are supported by the current PHP installation. * Install via composer and include `vendor/autoload.php`
or
* Just include the `autoload.php` file. This will automatically load the classes that are supported by the current PHP installation.
## Connecting ## Connecting
@ -35,14 +36,14 @@ Create a connection array or object similar to this:
<?php <?php
$params = array( $params = array(
'type' => 'mysql', 'type' => 'mysql', // mysql, pgsql, firebird, sqlite
'host' => 'localhost', 'host' => 'localhost', // address or socket
'user' => 'root', 'user' => 'root',
'pass' => '', 'pass' => '',
'port' => '3306', 'port' => '3306',
'database' => 'test_db', 'database' => 'test_db',
// Only required // Only required for
// SQLite or Firebird // SQLite or Firebird
'file' => '/path/to/db/file', 'file' => '/path/to/db/file',
@ -81,9 +82,9 @@ Query('old')->query($sql);
``` ```
### Running Queries ### Running Queries
Query uses the same interface as CodeIgniter's [Active Record class](http://ellislab.com/codeigniter/user-guide/database/active_record.html). However, it does not implement the `update_batch` or caching methods. Query uses the same interface as CodeIgniter's [Query Builder](http://www.codeigniter.com/user_guide/database/query_builder.html) class. However, it does not implement the `update_batch` or caching methods. For specific query builder methods, see the [class documentation](https://gitdev.timshomepage.net/Query/docs/classes/Query_QueryBuilder.html#methods).
####You can also run queries manually. #### You can also run queries manually.
To run a prepared statement, call To run a prepared statement, call
`$db->prepare_execute($sql, $params)`. `$db->prepare_execute($sql, $params)`.
@ -105,7 +106,7 @@ $query = $db->select('id, key as k, val')
->get(); ->get();
``` ```
This will generate a query similar to (with this being the output for a Postgres database): This will generate a query similar to (with this being the output for a PostgreSQL database):
```sql ```sql
SELECT "id", "key" AS "k", "val" SELECT "id", "key" AS "k", "val"
@ -117,7 +118,7 @@ LIMIT 3 OFFSET 1
``` ```
To retreive the results of a query, use the PDO method [fetch](http://php.net/manual/en/pdostatement.fetch.php) and/or [fetchAll](http://php.net/manual/en/pdostatement.fetchall.php). To retrieve the results of a query, use the PDO method [fetch](http://php.net/manual/en/pdostatement.fetch.php) and/or [fetchAll](http://php.net/manual/en/pdostatement.fetchall.php).
```php ```php
<?php <?php
@ -148,5 +149,5 @@ $query = $db->set('foo', 'bar')
->update('table'); ->update('table');
``` ```
The `set` method can also take an array as a paramater, instead of setting individual values. The `set` method can also take an array as a parameter, instead of setting individual values.