承接 nextpertise/pdo-bulk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nextpertise/pdo-bulk

Composer 安装命令:

composer require nextpertise/pdo-bulk

包简介

A PHP Pdo insert wrapper which allows you to bulk insert records wich contain subqueries.

README 文档

README

Build Status Scrutinizer Code Quality

Simple PHP helper class for working with bulk sets of data which needs to be imported in the database.

Installing

The easiest way to install PdoBulk is to use Composer, the awesome dependency manager for PHP. Once Composer is installed, run composer.phar require nextpertise/pdo-bulk:dev-master and composer will do all the hard work for you.

Usage

If you are using the autoloader in Composer (or your framework ties into it), then all you need to do is add a use PdoBulk\PdoBulk; statement at the top of each file you wish to use PdoBulk in and use it like a normal class:

<?php
namespace exampleApp;

require 'src/PdoBulk/PdoBulk.php';

use PdoBulk\PdoBulk;
use PdoBulk\PdoBulkSubquery;

// configuration
$dbhost 	= "localhost";
$dbname		= "dpkg";
$dbuser		= "user";
$dbpass		= "password";

// database connection
$conn = new \PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
$pdoBulk = new PdoBulk($conn);

Add a two entries

// Add entry 1 into `Package`
$packageEntry = array();
$packageEntry['name'] = 'wget';
$packageEntry['description'] = 'retrieves files from the web';
$packageEntry['architecture'] = 'amd64';
$pdoBulk->persist('Package', $packageEntry);

// Add entry 2 into `Package`
$packageEntry = array();
$packageEntry['name'] = 'curl';
$packageEntry['description'] = 'retrieves files from the web';
$packageEntry['architecture'] = 'amd64';
$pdoBulk->persist('Package', $packageEntry);

// Flush records to the database
$pdoBulk->flushQueue('Package');

统计信息

  • 总下载量: 38
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL
  • 更新时间: 2015-03-01