2017 © Pedro Peláez
 

library squid

MySQL library build on top of PDO

image

oktopost/squid

MySQL library build on top of PDO

  • Sunday, July 22, 2018
  • by alexey-pkv
  • Repository
  • 7 Watchers
  • 2 Stars
  • 637 Installations
  • PHP
  • 4 Dependents
  • 2 Suggesters
  • 1 Forks
  • 0 Open issues
  • 30 Versions
  • 5 % Grown

The README.md

Squid

Squid is a MySQL library, (*1)

Example code:, (*2)

$select = $connector->select();
$select
    ->column('a.*', 'b.Modified')
    ->from('TableName', 'a')
    ->leftJoin('AnotherTable', 'b', 'a.ID = b.TableNameID AND b.Status = ?', 'valid')
    ->byField('b.Name', 'Jhon')
    ->where('DATE(a.Created) > ?', new \DateTime());

$result = $select->query();

$modifiedAt = $result[0]['Modified'];

Basic Configuration

use Squid\MySql;

$mysql = new MySql();
$mysql->config()
    ->addConfig(
    'connection_name',
    [
        'db'    => 'db_name',
        'host'  => 'localhost',
        'pass'  => 'password',
        'user'  => 'user_name'
    ]);

// Aquire new connector object
$connector = $mysql->getConnector('connection_name');

// Aquiring commands
$select = $connector->select();
$insert = $connector->insert();
$delete = $connector->delete();

Select

Columns

column method

public function column(...$columns)

Set the columns to select., (*3)

Example:, (*4)

$select1->column('a', 'NOW()');
$select2->column('a.a', 'a.b');

Will result respectively in:, (*5)

SELECT a, NOW()
SELECT a.a, a.b

columns method

public function columns($columns, $table = false)

Set the columns to select using an array variable., (*6)

Example:, (*7)

$select1->columns(['a', 'NOW()']);
$select2->columns(['a', 'b'], 'a');

Will result respectively in:, (*8)

SELECT a, NOW()
SELECT a.a, a.b

From

from method

NOTE: A select can have only one main table. Calling this method a second time on the same select object will replace previous table selection., (*9)

public function from($table, $alias = false)

Describe the main table you want to select from. This method can't be used for selecting from multiplay tables. To do so, use the join method., (*10)

Example:, (*11)

$select1->from('Table');
$select2->from('Table', 'a');

Will result respectively in:, (*12)

SELECT * FROM Table
SELECT * FROM Table a

Where Clause

The where clause commands are available in select, insert, update, upsert and delete commands., (*13)

where method

public function where($exp, $bind = false)

Provide any costume where expression with optional bind parameters., (*14)

Example:, (*15)

$select1->where('1 + 1 = ?', 2);
$select2->where('Table.SomeFieldName = ? - ?', [3, 1]);
$delete->where('NOW() > DATE(NOW())');

Will result respectively in:, (*16)

SELECT * WHERE 1 + 1 = 2
SELECT * WHERE Table.SomeFieldName = 3 - 1
DELETE * WHERE NOW() > DATE(NOW())

byField method

public function byField($field, $value) 

Search for field = value or, if value is an array, where field IN (values), (*17)

Example:, (*18)

$select1->byField('Name', ['Jhon']);
$select1->byField('ROUND(Price)', [23]);
$select1->byField('ID', [2, 3]);

Will result respectively in:, (*19)

SELECT * WHERE Name = 'Jhon'
SELECT * WHERE ROUND(Price) = 23
SELECT * WHERE ID IN (2, 3)

The Versions

22/07 2018

1.1.0

1.1.0.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexey Puchkov
by Daniel Podrabinek
by Ivan Demchenkov

22/07 2018

dev-wherein-fix-5.6

dev-wherein-fix-5.6 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexey Puchkov
by Daniel Podrabinek
by Ivan Demchenkov

29/04 2018

dev-master

9999999-dev https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexey Puchkov
by Daniel Podrabinek
by Ivan Demchenkov

31/10 2017

1.0.26

1.0.26.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexey Puchkov
by Daniel Podrabinek
by Ivan Demchenkov

31/07 2017

1.0.25

1.0.25.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexey Puchkov
by Daniel Podrabinek
by Ivan Demchenkov

25/07 2017

1.0.24

1.0.24.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexey Puchkov
by Daniel Podrabinek
by Ivan Demchenkov

24/07 2017

1.0.23

1.0.23.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexey Puchkov
by Daniel Podrabinek
by Ivan Demchenkov

20/03 2017

dev-dev

dev-dev https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

16/03 2017

1.0.22

1.0.22.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

16/03 2017

1.0.21

1.0.21.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

25/01 2017

1.0.20

1.0.20.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

07/12 2016

1.0.19

1.0.19.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

04/12 2016

1.0.18

1.0.18.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

04/12 2016

1.0.17

1.0.17.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

01/12 2016

1.0.16

1.0.16.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

28/11 2016

1.0.15

1.0.15.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

28/11 2016

1.0.14

1.0.14.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

28/11 2016

1.0.13

1.0.13.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

28/11 2016

1.0.12

1.0.12.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

24/11 2016

1.0.11

1.0.11.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

24/11 2016

1.0.10

1.0.10.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

21/11 2016

1.0.9

1.0.9.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

20/11 2016

1.0.8

1.0.8.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

19/10 2016

1.0.6

1.0.6.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

17/10 2016

1.0.5

1.0.5.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

16/10 2016

1.0.4

1.0.4.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

20/07 2016

1.0.3

1.0.3.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

20/07 2016

1.0.2

1.0.2.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

20/07 2016

1.0.1

1.0.1.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov

20/07 2016

1.0.0

1.0.0.0 https://github.com/Oktopost/Squid

MySQL library build on top of PDO

  Sources   Download

MIT

The Requires

 

by Alexey Puchkov