定制 spliffs/mysqlfixer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

spliffs/mysqlfixer

Composer 安装命令:

composer require spliffs/mysqlfixer

包简介

Fix problems with MySQL-DB > 5.7.5 and some SilverStripe modules

README 文档

README

This is intended to fix problem Expression #1 of ORDER BY clause is not in SELECT list.....which is not in SELECT list; this is incompatible with DISTINCT caused by some modules.

The distinct error occures with MySQL >5.7.5 where the option ONLY_FULL_GROUP_BY became part of the combination on ANSI (which also includes 'REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE') used by SilverStripe for sql_mode.

( See also here https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-combo )

This module introduces the MySQL57Database class which extends the MySQLDatabase class, or better overwrites the connect() method using the sql_mode 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE' and instead of to 'ANSI'.

Maintainer Contact

Spliff Splendor <Spliff (dot) Splendor (at) gmail (dot) com>

Requirements

  • SilverStripe 3.3 or newer

Installation

  • If using composer, run composer require spliffs/mysqlfixer.
  • Otherwise, download, unzip and copy the 'mysqlfixer' folder to your project root so that it becomes a sibling of framework/.

Configuration

Add this to your _config.php (right after 'require_once("conf/ConfigureFromEnv.php");') or in your _ss_environment.php where you configure your database.

Sample/Excerpt _ss_environment.php

// DB config
define('SS_DATABASE_CLASS', 'MySQL57Database');`
define('SS_DATABASE_SERVER',   'mysql5.7.20.local');
define('SS_DATABASE_USERNAME', 'dbuser');
define('SS_DATABASE_PASSWORD', 'top-secret-password');
define('SS_DATABASE_NAME',   'ss_mysite');

Sample mysite/_config.php

<?php
global $project;
$project = 'mysite';

global $database;
$database = 'SS_mysite';

require_once("conf/ConfigureFromEnv.php");

global $databaseConfig;

$databaseConfig = array(
	"type" => 'MySQL57Database',
	"server" => 'mysql5.7.20.local',
	"username" => 'dbuser',
	"password" => 'top-secret-password',
	"database" => 'ss_mysite',
);

SSViewer::set_theme('simple');
SiteTree::enable_nested_urls();

Open Issues

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-11-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固