mrssoft/yii2-db
Composer 安装命令:
composer require mrssoft/yii2-db
包简介
Yii2 database tools
关键字:
README 文档
README
Batch insert into database.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist mrssoft/yii2-db "*"
or add
"mrssoft/yii2-db": "*"
to the require section of your composer.json file.
Usage
$batch = new DbBatch(); $batch->add([ 'field1' => $value1, 'field2' => $value2, ]); $batch->add([ 'field1' => $value1, 'field2' => $value2, ], $key) $batch->addUnique([ 'field1' => $value1, 'field2' => $value2, ]); $bool = $batch->insert('{{%table}}', true); $bool = $batch->replace('{{%table}}');
$batch = new DbBatch([ 'maxItemsInQuery' => 1000, 'table' => '{{%table}}', 'truncate' => true, 'command' => DbBatch::COMMAND_INSERT ]); $batch->add([ 'field1' => $value1, 'field2' => $value2, ], $key); $batch->update([ 'field1' => $value3, 'field2' => $value4, ], $key); $count = $batch->getCount(); $keys = $batch->getKeys(); $element = $batch->get($key); $data = $batch->getData(); $batch->setData($data); $bool = $batch->execute();
统计信息
- 总下载量: 182
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-12