2017 © Pedro Peláez
 

library aliyun-analytic-db

阿里云分析型数据库pdo连接层

image

donng/aliyun-analytic-db

阿里云分析型数据库pdo连接层

  • Monday, July 9, 2018
  • by Donng
  • Repository
  • 1 Watchers
  • 2 Stars
  • 43 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 126 % Grown

The README.md

aliyun-analytic-db

阿里云分析型数据库的连接层 , 基于laravel5.5实现, (*1)

安装

安装有两种方式:, (*2)

① 执行命令安装
composer require donng/aliyun-analytic-db 
② 直接编辑composer.json
require: {
    "donng/aliyun-analytic-db": "^1.4",
}

然后运行 composer update, (*3)

配置

① 生成配置文件
php artisan vendor:publish --provider="Donng\AnalyticDB\Providers\AnalyticDBProvider"
② 配置数据库信息

在 .env 文件中配置阿里云的数据库连接和sql记录的数据库连接名称., (*4)

如果不配置以下两个常量,将连接数据库配置文件中的默认配置。, (*5)

ANALYTIC_CONNECTION=your analytic connection
RECORD_CONNECTION=your record connection
③ 数据库迁移(生成sql记录的表 )
php artisan migrate

 , (*6)

生成sql_records表,记录执行的表和运行的时间,默认关闭。如果不需要sql记录功能,####可跳过此步骤。, (*7)

使用

use AnalyticDB;

// 插入记录(无绑定)
$result = AnalyticDB::withoutPrepare()->insert($sql);
// 插入记录(预编译,绑定数据)
$result = AnalyticDB::insert($sql, $bindingArr);

// 获得所有记录
$result = AnalyticDB::select($sql)->get();
// 获得第一条记录
$result = AnalyticDB::select($sql)->first();
// 不记录sql获取数据(可在配置文件中配置record => false 全部禁用记录sql)
$result = AnalyticDB::select($sql)->disableRecord()->get();
当前可调用方法
  1. ->select($sql) //输入原生sql
  2. ->get() // 查询所有记录
  3. ->first() // 查询一条记录
  4. disableRecord() // 此条记录禁用记录功能
  5. withoutPrepare() // 此条查询不执行预编译
  6. insert()       // 插入数据

The Versions

09/07 2018

dev-master

9999999-dev

阿里云分析型数据库pdo连接层

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Avatar Donng

09/07 2018

1.4.4

1.4.4.0

阿里云分析型数据库pdo连接层

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Avatar Donng

06/02 2018

1.4.1

1.4.1.0

阿里云分析型数据库pdo连接层

  Sources   Download

MIT

The Requires

 

by Avatar Donng

06/02 2018

1.4

1.4.0.0

阿里云分析型数据库pdo连接层

  Sources   Download

MIT

The Requires

 

by Avatar Donng

17/01 2018

1.3

1.3.0.0

阿里云分析型数据库pdo连接层

  Sources   Download

MIT

The Requires

 

by Avatar Donng

16/01 2018

1.2

1.2.0.0

阿里云分析型数据库pdo连接层

  Sources   Download

MIT

The Requires

 

by Avatar Donng

15/01 2018

1.1

1.1.0.0

阿里云分析型数据库pdo连接层

  Sources   Download

MIT

The Requires

 

by Avatar Donng

15/01 2018

1.0

1.0.0.0

阿里云分析型数据库pdo连接层

  Sources   Download

MIT

The Requires

 

by Avatar Donng