2017 © Pedro Peláez
 

yii2-extension yii2-db

Yii2 database tools

image

mrssoft/yii2-db

Yii2 database tools

  • Friday, June 9, 2017
  • by mrs2000
  • Repository
  • 2 Watchers
  • 0 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 3 % Grown

The README.md

yii2-db

Batch insert into database., (*1)

PHP Github Total Downloads, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist mrssoft/yii2-db "*"

or add, (*5)

"mrssoft/yii2-db": "*"

to the require section of your composer.json file., (*6)

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();

The Versions

09/06 2017

dev-master

9999999-dev

Yii2 database tools

  Sources   Download

MIT

The Requires

 

by Melnikov Ruslan

database extension yii2