====
composer install eden/sql
====
SQL is an abstract package used in:
See these documentations for more details. The following API methods are common amongst all SQL type databases.
====
====
Binds a value and returns the bound key
eden('sql')->bind(*string|array|number|null $value);
*string|array|number|null $value
- What to bind
Returns string
eden('sql')->bind('foo');
====
Returns collection
eden('sql')->collection(array $data);
array $data
- Initial collection data
Returns Eden\Sql\Collection
eden('sql')->collection();
====
Returns the delete query builder
eden('sql')->delete(*string|null $table);
*string|null $table
- The table name
Returns Eden\Sql\Delete
eden('sql')->delete('foo');
====
Removes rows that match a filter
eden('sql')->deleteRows(*string|null $table, array|string $filters);
*string|null $table
- The table namearray|string $filters
- Filters to test against
Returns Eden\Sql\Collection
eden('sql')->deleteRows('foo');
====
Returns all the bound values of this query
eden('sql')->getBinds();
Returns array
====
Returns the connection object if no connection has been made it will attempt to make it
eden('sql')->getConnection();
Returns resource
- PDO connection resource
====
Returns the last inserted id
eden('sql')->getLastInsertedId(string|null $column);
string|null $column
- A particular column name
Returns int
- the id
eden('sql')->getLastInsertedId();
====
Returns a model given the column name and the value
eden('sql')->getModel(*string $table, *string $name, *scalar|null $value);
*string $table
- Table name*string $name
- Column name*scalar|null $value
- Column value
Returns Eden\Sql\Model|null
eden('sql')->getModel('foo', 'foo', $value);
====
Returns the history of queries made still in memory
eden('sql')->getQueries(int|string|null $index);
int|string|null $index
- A particular index to return
Returns array|null
- the queries
eden('sql')->getQueries();
====
Returns a 1 row result given the column name and the value
eden('sql')->getRow(*string $table, *string $name, *scalar|null $value);
*string $table
- Table name*string $name
- Column name*scalar|null $value
- Column value
Returns array|null
eden('sql')->getRow('foo', 'foo', $value);
====
Returns the insert query builder
eden('sql')->insert(string|null $table);
string|null $table
- Name of table
Returns Eden\Sql\Insert
eden('sql')->insert();
====
Inserts data into a table and returns the ID
eden('sql')->insertRow(*string $table, *array $setting, bool|array $bind);
*string $table
- Table name*array $setting
- Key/value array matching table columnsbool|array $bind
- Whether to compute with binded variables
Returns Eden\Sql\Index
eden('sql')->insertRow('foo', array('foo' => 'bar'));
====
Inserts multiple rows into a table
eden('sql')->insertRows(*string $table, array $setting, bool|array $bind);
*string $table
- Table namearray $setting
- Key/value 2D array matching table columnsbool|array $bind
- Whether to compute with binded variables
Returns Eden\Sql\Index
eden('sql')->insertRows('foo');
====
Returns model
eden('sql')->model(array $data);
array $data
- The initial data to set
Returns Eden\Sql\Model
eden('sql')->model();
====
Queries the database
eden('sql')->query(*string $query, array $binds);
*string $query
- The query to ranarray $binds
- List of binded values
Returns array
eden('sql')->query('foo');
====
Returns search
eden('sql')->search(string|null $table);
string|null $table
- Table name
Returns Eden\Sql\Search
eden('sql')->search();
====
Returns the select query builder
eden('sql')->select(string|array $select);
string|array $select
- Column list
Returns Eden\Sql\Select
eden('sql')->select();
====
Sets all the bound values of this query
eden('sql')->setBinds(*array $binds);
*array $binds
- key/values to bind
Returns Eden\Sql\Index
eden('sql')->setBinds(array('foo' => 'bar'));
====
Sets default collection
eden('sql')->setCollection(*string $collection);
*string $collection
- Collection class name
Returns Eden\Sql\Index
eden('sql')->setCollection('foo');
====
Sets the default model
eden('sql')->setModel(*string Model);
*string Model
- class name
Returns Eden\Sql\Index
eden('sql')->setModel('foo');
====
Sets only 1 row given the column name and the value
eden('sql')->setRow(*string $table, *string $name, *scalar|null $value, *array $setting);
*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
eden('sql')->setRow('foo', 'foo', $value, array('foo' => 'bar'));
====
Returns the update query builder
eden('sql')->update(string|null $table);
string|null $table
- Name of table
Returns Eden\Sql\Update
eden('sql')->update();
====
Updates rows that match a filter given the update settings
eden('sql')->updateRows(*string $table, *array $setting, array|string $filters, bool|array $bind);
*string $table
- Table name*array $setting
- Key/value array matching table columnsarray|string $filters
- Filters to test againstbool|array $bind
- Whether to compute with binded variables
Returns Eden\Sql\Index
eden('sql')->updateRows('foo', array('foo' => 'bar'));
====
Contributions to Eden are following the Github work flow. Please read up before contributing.
##Setting up your machine with the Eden repository and your fork
- Fork the repository
- 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
- Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")
##Making pull requests
- Please ensure to run
phpunit
before making a pull request. - Push your code to your remote forked version.
- Go back to your forked version on GitHub and submit a pull request.
- An Eden developer will review your code and merge it in when it has been classified as suitable.