2017 © Pedro Peláez
 

project sql-builder

SQL QUERY BUILDER

image

aweitian/sql-builder

SQL QUERY BUILDER

  • Friday, May 25, 2018
  • by awei.tian
  • Repository
  • 1 Watchers
  • 0 Stars
  • 64 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 10 % Grown

The README.md

开始使用

安装组件

使用 composer 命令进行安装或下载源代码使用。, (*1)

composer require aweitian/sql-builder, (*2)

select :


$demo = new Crud ( 'tablename' );
$demo->bindField ( "id" );
$demo->bindField ( "concat('%',:lol,'%')" );
$demo->bindField ( "name as n" );
//SELECT id,concat('%',:lol,'%'),name as n FROM tablename

$demo = new Crud ( 'tablename' );
$demo->bindField ( "id" );
$demo->bindField ( "concat('%',:lol,'%')" );
$demo->bindField ( "name as n" );
$demo->bindJoin ( 'left join tba on tba.sid = tablename.hid' );
$demo->bindJoin ( 'left join tbb on tba.sid = tbb.sid' );
$demo->bindWhere ( 'tablename.sid > 100' );
$demo->bindWhere ( 'tablename.name = \'55\'' );
//SELECT id,concat('%',:lol,'%'),name as n FROM tablename 
//left join tba on tba.sid = tablename.hid left join tbb on tba.sid = tbb.sid 
//WHERE tablename.sid > 100 AND tablename.name = '55'

$demo = new Crud ( 'tablename' );
$demo->bindField ( "id" );
$demo->bindField ( "concat('%',:lol,'%')" );
$demo->bindField ( "count(tablename.name) as cc" );
$demo->bindJoin ( 'left join tba on tba.sid = tablename.hid' );
$demo->bindJoin ( 'left join tbb on tba.sid = tbb.sid' );
$demo->bindWhere ( 'tablename.sid > 100' );
$demo->bindWhere ( 'tablename.name = \'55\'' );
$demo->bindGroupBy ( 'tablename.name' );
$demo->bindHaving ( 'cc > 1' );
$demo->bindLimit ( '0,100' );
//SELECT id,concat('%',:lol,'%'),count(tablename.name) as cc 
//FROM tablename left join tba on tba.sid = tablename.hid 
//left join tbb on tba.sid = tbb.sid WHERE tablename.sid > 100 AND tablename.name = '55' 
//GROUP BY tablename.name HAVING cc > 1 LIMIT 0,100

INSERT:

, (*3)

$demo = new Crud ('tablename');
$demo->bindField('aaa');
$demo->bindField('bbb', 'bbb');
$demo->bindValues("concat('aa>',:bbb,'',:bbb,'

REPLACE:

, (*4)

$demo = new \Tian\SqlBuild\MysqlReplaceBuild ( 'tablename' );
$demo->bindField ( 'aaa' );
$demo->bindField('bbb', 'bbb');
$demo->bindValues("concat('aa>',:bbb,'',:bbb,'

UPDATE:

, (*5)

$demo = new \Tian\SqlBuild\MysqlUpdateBuild ( 'tablename' );
$demo->bindField ( 'aaa' );
$demo->bindField ( 'bbb' );
$demo->bindValues("concat('aa>',:bbb,'bindWhere ( 'sid>100' );
$demo->bindOrderBy ( 'name desc' );
$demo->bindLimit ( '2' );
//UPDATE tablename SET aaa=:aaa,bbb=concat('aa>',:bbb,'100 ORDER BY name desc LIMIT 2

DELETE:

, (*6)

$demo = new \Tian\SqlBuild\MysqlDeleteBuild ( 'tablename' );
$demo->bindWhere ( 'sid>100' );
$demo->bindOrderBy ( 'name desc' );
$demo->bindLimit ( '2' );
//DELETE FROM tablename WHERE sid>100 ORDER BY name desc LIMIT 2

$demo = new \Tian\SqlBuild\MysqlDeleteBuild ( 'tablename,tb2' );
$demo->bindUsing ( 'tb2' );
$demo->bindWhere ( 'tablename.sid>100' );
$demo->bindWhere ( 'tablename.sid = tb2.tb1id' );
$demo->bindOrderBy ( 'name desc' ); // 多表删除中无效
$demo->bindLimit ( '2' ); // 多表删除中无效
//DELETE FROM tablename,tb2 USING tb2 WHERE tablename.sid>100 AND tablename.sid = tb2.tb1id

The Versions

25/05 2018

dev-master

9999999-dev https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

25/05 2018

v3.0.2

3.0.2.0 https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

10/05 2018

v3.0.1

3.0.1.0 https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

07/05 2018

v3.0.0

3.0.0.0 https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

19/04 2018

v2.1.7

2.1.7.0 https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

27/03 2018

v2.1.6

2.1.6.0 https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

27/03 2018

v2.1.5

2.1.5.0 https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

27/03 2018

v2.1.2

2.1.2.0 https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

25/03 2018

v2.1.1

2.1.1.0 https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

24/03 2018

v2.1.0

2.1.0.0 https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

23/03 2018

v2.0.0

2.0.0.0 https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei

25/09 2017

dev-dev

dev-dev https://github.com/aweitian/sql-builder

SQL QUERY BUILDER

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by awei.tian@qq.com

sql builder aweitian tiananwei