whisper
所属分类:其他
开发工具:PHP
文件大小:138KB
下载次数:2
上传日期:2020-11-21 09:44:36
上 传 者:
1881499
说明: 开源客服系统服务端Open source customer service system server
(Open source customer service system server)
文件列表:
whisper_server (0, 2018-04-12)
whisper_server\GatewayWorker (0, 2018-03-09)
whisper_server\GatewayWorker\Applications (0, 2018-03-09)
whisper_server\GatewayWorker\Applications\whisper (0, 2018-03-31)
whisper_server\GatewayWorker\Applications\whisper\Events.php (30395, 2018-04-20)
whisper_server\GatewayWorker\Applications\whisper\start_businessworker.php (1027, 2018-01-20)
whisper_server\GatewayWorker\Applications\whisper\start_gateway.php (2140, 2018-04-20)
whisper_server\GatewayWorker\Applications\whisper\start_register.php (779, 2018-01-20)
whisper_server\GatewayWorker\composer.json (145, 2018-03-09)
whisper_server\GatewayWorker\composer.lock (5852, 2018-03-09)
whisper_server\GatewayWorker\start.php (1073, 2018-03-09)
whisper_server\GatewayWorker\vendor (0, 2018-03-09)
whisper_server\GatewayWorker\vendor\autoload.php (178, 2018-03-09)
whisper_server\GatewayWorker\vendor\composer (0, 2018-03-09)
whisper_server\GatewayWorker\vendor\composer\autoload_classmap.php (147, 2018-03-09)
whisper_server\GatewayWorker\vendor\composer\autoload_namespaces.php (149, 2018-03-09)
whisper_server\GatewayWorker\vendor\composer\autoload_psr4.php (429, 2018-03-09)
whisper_server\GatewayWorker\vendor\composer\autoload_real.php (1762, 2018-03-09)
whisper_server\GatewayWorker\vendor\composer\autoload_static.php (1348, 2018-03-09)
whisper_server\GatewayWorker\vendor\composer\ClassLoader.php (13451, 2018-03-09)
whisper_server\GatewayWorker\vendor\composer\installed.json (5031, 2018-03-09)
whisper_server\GatewayWorker\vendor\composer\LICENSE (1070, 2018-03-09)
whisper_server\GatewayWorker\vendor\workerman (0, 2018-03-09)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker (0, 2018-03-09)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\composer.json (298, 2017-12-04)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\MIT-LICENSE.txt (1166, 2017-12-04)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src (0, 2018-03-09)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src\BusinessWorker.php (17256, 2017-12-04)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src\Gateway.php (33623, 2017-12-04)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src\Lib (0, 2018-03-09)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src\Lib\Context.php (2885, 2017-12-04)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src\Lib\Db.php (1940, 2017-12-04)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src\Lib\DbConnection.php (42757, 2017-12-04)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src\Lib\Gateway.php (33569, 2017-12-04)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src\Protocols (0, 2018-03-09)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src\Protocols\GatewayProtocol.php (5633, 2017-12-04)
whisper_server\GatewayWorker\vendor\workerman\gateway-worker\src\Register.php (5685, 2017-12-04)
whisper_server\GatewayWorker\vendor\workerman\globaldata (0, 2018-03-09)
... ...
# Workerman\Mysql\Connection
Long-living MySQL connection for daemon.
# Install
```composer require workerman/mysql```
# Usage
```php
$db = new Workerman\MySQL\Connection($mysql_host, $mysql_port, $user, $password, $db_bname);
// Get all rows.
$db1->select('ID,Sex')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->query();
// Equivalent to.
$db1->select('ID,Sex')->from('Persons')->where("sex='F'")->query();
// Equivalent to.
$db->query("SELECT ID,Sex FROM `Persons` WHERE sex='M'");
// Get one row.
$db->select('ID,Sex')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->row();
// Equivalent to.
$db->select('ID,Sex')->from('Persons')->where("sex= 'F' ")->row();
// Equivalent to.
$db->row("SELECT ID,Sex FROM `Persons` WHERE sex='M'");
// Get a column.
$db->select('ID')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->column();
// Equivalent to.
$db->select('ID')->from('Persons')->where("sex= 'F' ")->column();
// Equivalent to.
$db->column("SELECT `ID` FROM `Persons` WHERE sex='M'");
// Get single.
$db->select('ID,Sex')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->single();
// Equivalent to.
$db->select('ID,Sex')->from('Persons')->where("sex= 'F' ")->single();
// Equivalent to.
$db->single("SELECT ID,Sex FROM `Persons` WHERE sex='M'");
// Complex query.
$db->select('*')->from('table1')->innerJoin('table2','table1.uid = table2.uid')->where('age > :age')
->groupBy(array('aid'))->having('foo="foo"')->orderByASC/*orderByDESC*/(array('did'))
->limit(10)->offset(20)->bindValues(array('age' => 13));
// Equivalent to.
$db->query(SELECT * FROM `table1` INNER JOIN `table2` ON `table1`.`uid` = `table2`.`uid` WHERE age > 13
GROUP BY aid HAVING foo="foo" ORDER BY did LIMIT 10 OFFSET 20);
// Insert.
$insert_id = $db->insert('Persons')->cols(array(
'Firstname'=>'abc',
'Lastname'=>'efg',
'Sex'=>'M',
'Age'=>13))->query();
// Equivalent to.
$insert_id = $db->query("INSERT INTO `Persons` ( `Firstname`,`Lastname`,`Sex`,`Age`)
VALUES ( 'abc', 'efg', 'M', 13)");
// Updagte.
$row_count = $db->update('Persons')->cols(array('sex'))->where('ID=1')
->bindValue('sex', 'F')->query();
// Equivalent to.
$row_count = $db->update('Persons')->cols(array('sex'=>'F'))->where('ID=1')->query();
// Equivalent to.
$row_count = $db->query("UPDATE `Persons` SET `sex` = 'F' WHERE ID=1");
// Delete.
$row_count = $db->delete('Persons')->where('ID=9')->query();
// Equivalent to.
$row_count = $db->query("DELETE FROM `Persons` WHERE ID=9");
// Transaction.
$db1->beginTrans();
....
$db1->commitTrans(); // or $db1->rollBackTrans();
```
近期下载者:
相关文件:
收藏者: