2017 © Pedro Peláez
 

library sql

SQL core methods for MySQL, Posgres and SQLite

image

eden/sql

SQL core methods for MySQL, Posgres and SQLite

  • Friday, April 29, 2016
  • by cblanquera
  • Repository
  • 14 Watchers
  • 0 Stars
  • 9,748 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 6 Forks
  • 3 Open issues
  • 9 Versions
  • 2 % Grown

The README.md

logo Eden Sql

Build Status

====, (*1)

, (*2)

Install

composer install eden/sql, (*3)

====, (*4)

, (*5)

Introduction

SQL is an abstract package used in:, (*6)

See these documentations for more details. The following API methods are common amongst all SQL type databases., (*7)

====, (*8)

, (*9)

API

====, (*10)

, (*11)

bind

Binds a value and returns the bound key, (*12)

Usage

eden('sql')->bind(*string|array|number|null $value);

Parameters

  • *string|array|number|null $value - What to bind

Returns string, (*13)

Example

eden('sql')->bind('foo');

====, (*14)

, (*15)

collection

Returns collection, (*16)

Usage

eden('sql')->collection(array $data);

Parameters

  • array $data - Initial collection data

Returns Eden\Sql\Collection, (*17)

Example

eden('sql')->collection();

====, (*18)

, (*19)

delete

Returns the delete query builder, (*20)

Usage

eden('sql')->delete(*string|null $table);

Parameters

  • *string|null $table - The table name

Returns Eden\Sql\Delete, (*21)

Example

eden('sql')->delete('foo');

====, (*22)

, (*23)

deleteRows

Removes rows that match a filter, (*24)

Usage

eden('sql')->deleteRows(*string|null $table, array|string $filters);

Parameters

  • *string|null $table - The table name
  • array|string $filters - Filters to test against

Returns Eden\Sql\Collection, (*25)

Example

eden('sql')->deleteRows('foo');

====, (*26)

, (*27)

getBinds

Returns all the bound values of this query, (*28)

Usage

eden('sql')->getBinds();

Parameters

Returns array, (*29)

====, (*30)

, (*31)

getConnection

Returns the connection object if no connection has been made it will attempt to make it, (*32)

Usage

eden('sql')->getConnection();

Parameters

Returns resource - PDO connection resource, (*33)

====, (*34)

, (*35)

getLastInsertedId

Returns the last inserted id, (*36)

Usage

eden('sql')->getLastInsertedId(string|null $column);

Parameters

  • string|null $column - A particular column name

Returns int - the id, (*37)

Example

eden('sql')->getLastInsertedId();

====, (*38)

, (*39)

getModel

Returns a model given the column name and the value, (*40)

Usage

eden('sql')->getModel(*string $table, *string $name, *scalar|null $value);

Parameters

  • *string $table - Table name
  • *string $name - Column name
  • *scalar|null $value - Column value

Returns Eden\Sql\Model|null, (*41)

Example

eden('sql')->getModel('foo', 'foo', $value);

====, (*42)

, (*43)

getQueries

Returns the history of queries made still in memory, (*44)

Usage

eden('sql')->getQueries(int|string|null $index);

Parameters

  • int|string|null $index - A particular index to return

Returns array|null - the queries, (*45)

Example

eden('sql')->getQueries();

====, (*46)

, (*47)

getRow

Returns a 1 row result given the column name and the value, (*48)

Usage

eden('sql')->getRow(*string $table, *string $name, *scalar|null $value);

Parameters

  • *string $table - Table name
  • *string $name - Column name
  • *scalar|null $value - Column value

Returns array|null, (*49)

Example

eden('sql')->getRow('foo', 'foo', $value);

====, (*50)

, (*51)

insert

Returns the insert query builder, (*52)

Usage

eden('sql')->insert(string|null $table);

Parameters

  • string|null $table - Name of table

Returns Eden\Sql\Insert, (*53)

Example

eden('sql')->insert();

====, (*54)

, (*55)

insertRow

Inserts data into a table and returns the ID, (*56)

Usage

eden('sql')->insertRow(*string $table, *array $setting, bool|array $bind);

Parameters

  • *string $table - Table name
  • *array $setting - Key/value array matching table columns
  • bool|array $bind - Whether to compute with binded variables

Returns Eden\Sql\Index, (*57)

Example

eden('sql')->insertRow('foo', array('foo' => 'bar'));

====, (*58)

, (*59)

insertRows

Inserts multiple rows into a table, (*60)

Usage

eden('sql')->insertRows(*string $table, array $setting, bool|array $bind);

Parameters

  • *string $table - Table name
  • array $setting - Key/value 2D array matching table columns
  • bool|array $bind - Whether to compute with binded variables

Returns Eden\Sql\Index, (*61)

Example

eden('sql')->insertRows('foo');

====, (*62)

, (*63)

model

Returns model, (*64)

Usage

eden('sql')->model(array $data);

Parameters

  • array $data - The initial data to set

Returns Eden\Sql\Model, (*65)

Example

eden('sql')->model();

====, (*66)

, (*67)

query

Queries the database, (*68)

Usage

eden('sql')->query(*string $query, array $binds);

Parameters

  • *string $query - The query to ran
  • array $binds - List of binded values

Returns array, (*69)

Example

eden('sql')->query('foo');

====, (*70)

, (*71)

Returns search, (*72)

Usage

eden('sql')->search(string|null $table);

Parameters

  • string|null $table - Table name

Returns Eden\Sql\Search, (*73)

Example

eden('sql')->search();

====, (*74)

, (*75)

select

Returns the select query builder, (*76)

Usage

eden('sql')->select(string|array $select);

Parameters

  • string|array $select - Column list

Returns Eden\Sql\Select, (*77)

Example

eden('sql')->select();

====, (*78)

, (*79)

setBinds

Sets all the bound values of this query, (*80)

Usage

eden('sql')->setBinds(*array $binds);

Parameters

  • *array $binds - key/values to bind

Returns Eden\Sql\Index, (*81)

Example

eden('sql')->setBinds(array('foo' => 'bar'));

====, (*82)

, (*83)

setCollection

Sets default collection, (*84)

Usage

eden('sql')->setCollection(*string $collection);

Parameters

  • *string $collection - Collection class name

Returns Eden\Sql\Index, (*85)

Example

eden('sql')->setCollection('foo');

====, (*86)

, (*87)

setModel

Sets the default model, (*88)

Usage

eden('sql')->setModel(*string Model);

Parameters

  • *string Model - class name

Returns Eden\Sql\Index, (*89)

Example

eden('sql')->setModel('foo');

====, (*90)

, (*91)

setRow

Sets only 1 row given the column name and the value, (*92)

Usage

eden('sql')->setRow(*string $table, *string $name, *scalar|null $value, *array $setting);

Parameters

  • *string $table - Table name
  • *string $name - Column name
  • *scalar|null $value - Column value
  • *array $setting - Key/value array matching table columns

Returns Eden\Sql\Index, (*93)

Example

eden('sql')->setRow('foo', 'foo', $value, array('foo' => 'bar'));

====, (*94)

, (*95)

update

Returns the update query builder, (*96)

Usage

eden('sql')->update(string|null $table);

Parameters

  • string|null $table - Name of table

Returns Eden\Sql\Update, (*97)

Example

eden('sql')->update();

====, (*98)

, (*99)

updateRows

Updates rows that match a filter given the update settings, (*100)

Usage

eden('sql')->updateRows(*string $table, *array $setting, array|string $filters, bool|array $bind);

Parameters

  • *string $table - Table name
  • *array $setting - Key/value array matching table columns
  • array|string $filters - Filters to test against
  • bool|array $bind - Whether to compute with binded variables

Returns Eden\Sql\Index, (*101)

Example

eden('sql')->updateRows('foo', array('foo' => 'bar'));

====, (*102)

, (*103)

Contributing to Eden

Contributions to Eden are following the Github work flow. Please read up before contributing., (*104)

Setting up your machine with the Eden repository and your fork

  1. Fork the repository
  2. Fire up your local terminal create a new branch from the v4 branch of your fork with a branch name describing what your changes are. Possible branch name types:
    • bugfix
    • feature
    • improvement
  3. Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")

Making pull requests

  1. Please ensure to run phpunit before making a pull request.
  2. Push your code to your remote forked version.
  3. Go back to your forked version on GitHub and submit a pull request.
  4. An Eden developer will review your code and merge it in when it has been classified as suitable.

The Versions

29/04 2016

v3.x-dev

3.9999999.9999999.9999999-dev http://eden-php.com

SQL core methods for MySQL, Posgres and SQLite

  Sources   Download

MIT

The Requires

 

by Christian Blanquera

library eden

29/04 2016

1.0.4

1.0.4.0 http://eden-php.com

SQL core methods for MySQL, Posgres and SQLite

  Sources   Download

MIT

The Requires

 

by Christian Blanquera

library eden

11/02 2016

dev-master

9999999-dev http://eden-php.com

SQL core methods for MySQL, Posgres and SQLite

  Sources   Download

MIT

The Requires

 

by Christian Blanquera

library eden

13/11 2015

4.x-dev

4.9999999.9999999.9999999-dev http://eden-php.com

SQL core methods for MySQL, Posgres and SQLite

  Sources   Download

MIT

The Requires

 

by Christian Blanquera

library eden

13/10 2015

4.0.1

4.0.1.0 http://eden-php.com

SQL core methods for MySQL, Posgres and SQLite

  Sources   Download

MIT

The Requires

 

by Christian Blanquera

library eden

07/10 2015

v4

4.0.0.0 http://eden-php.com

SQL core methods for MySQL, Posgres and SQLite

  Sources   Download

MIT

The Requires

 

by Christian Blanquera

library eden

24/09 2013

1.0.3

1.0.3.0 http://eden-php.com

SQL core methods for MySQL, Posgres and SQLite

  Sources   Download

MIT

The Requires

 

by Christian Blanquera

library eden

24/09 2013

1.0.2

1.0.2.0 http://eden-php.com

SQL core methods for MySQL, Posgres and SQLite

  Sources   Download

MIT

The Requires

 

by Christian Blanquera

library eden

17/09 2013

1.0.0

1.0.0.0 http://eden-php.com

SQL core methods for MySQL, Posgres and SQLite

  Sources   Download

MIT

The Requires

  • php >=5.3.1
  • eden-php/utility 1.*.*

 

by Christian Blanquera

library eden