@blog • @learnku • @segmentfault • @nonprofit website • @daily favorites • @sponsors
guanguans / laravel-soar Goto Github PK
View Code? Open in Web Editor NEWSQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。
License: MIT License
SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。
License: MIT License
Describe the bug
Error Output: ================ panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1910ce5] goroutine 1 [running]: github.com/pingcap/tidb/util/memory.MemTotalNormal() pkg/mod/github.com/pingcap/[email protected]/util/memory/meminfo.go:41 +0x65 github.com/pingcap/tidb/util/memory.init.0() pkg/mod/github.com/pingcap/[email protected]/util/memory/meminfo.go:134 +0x175
To Reproduce
Additional context
macos 13.2
php
PHP 8.2.0 (cli) (built: Dec 9 2022 16:30:32) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
with Zend OPcache v8.2.0, Copyright (c), by Zend Technologies
Here's the Weekly Digest for guanguans/laravel-soar:
Last week, no issues were created.
Last week, no pull requests were created, updated or merged.
Last week there were no commits.
Last week there were no contributors.
Last week there were no stargazers.
Last week there were no releases.
That's all for last week, please 👀 Watch and ⭐ Star the repository guanguans/laravel-soar to receive next weekly updates. 😃
You can also view all Weekly Digests by clicking here.
Your Weekly Digest bot. 📆
Here's the Weekly Digest for guanguans/laravel-soar:
Last week, no issues were created.
Last week, no pull requests were created, updated or merged.
Last week there were no commits.
Last week there were no contributors.
Last week there were no stargazers.
Last week there were no releases.
That's all for last week, please 👀 Watch and ⭐ Star the repository guanguans/laravel-soar to receive next weekly updates. 😃
You can also view all Weekly Digests by clicking here.
Your Weekly Digest bot. 📆
Here's the Weekly Digest for guanguans/laravel-soar:
Last week, no issues were created.
Last week, no pull requests were created, updated or merged.
Last week there were no commits.
Last week there were no contributors.
Last week there were no stargazers.
Last week there were no releases.
That's all for last week, please 👀 Watch and ⭐ Star the repository guanguans/laravel-soar to receive next weekly updates. 😃
You can also view all Weekly Digests by clicking here.
Your Weekly Digest bot. 📆
return array_reduce($bindings, function ($sql, $binding) {
return preg_replace('/\?/', is_numeric($binding) ? (string)$binding : "'" . $binding . "'", $sql, 1);
}, $querySql);
增加强制转换为字符串类型解决此报错
(string)$binding
,也兼容低版本
Here's the Weekly Digest for guanguans/laravel-soar:
Last week, no issues were created.
Last week, no pull requests were created, updated or merged.
Last week there were no commits.
Last week there were no contributors.
Last week there were no stargazers.
Last week there were no releases.
That's all for last week, please 👀 Watch and ⭐ Star the repository guanguans/laravel-soar to receive next weekly updates. 😃
You can also view all Weekly Digests by clicking here.
Your Weekly Digest bot. 📆
Here's the Weekly Digest for guanguans/laravel-soar:
Last week, no issues were created.
Last week, no pull requests were created, updated or merged.
Last week there were no commits.
Last week there were no contributors.
Last week there were no stargazers.
Last week there were no releases.
That's all for last week, please 👀 Watch and ⭐ Star the repository guanguans/laravel-soar to receive next weekly updates. 😃
You can also view all Weekly Digests by clicking here.
Your Weekly Digest bot. 📆
如果接口输出的是文件流格式,这里会出现错误,自己试了下这样改是可以
`
$response = $next($request);
if (
$response instanceof JsonResponse &&
is_object($response->getData())
) {
return tap($next($request), fn(Response $response) => $this->outputManager->output(
$this->bootstrapper->getScores(),
$response
));
}
return $next($request);
`
Here's the Weekly Digest for guanguans/laravel-soar:
Last week, no issues were created.
Last week, no pull requests were created, updated or merged.
Last week there were no commits.
Last week there were no contributors.
Last week there were no stargazers.
Last week there were no releases.
That's all for last week, please 👀 Watch and ⭐ Star the repository guanguans/laravel-soar to receive next weekly updates. 😃
You can also view all Weekly Digests by clicking here.
Your Weekly Digest bot. 📆
###运行环境
PHP 7.4.3 (cli) (built: Feb 18 2020 17:29:57) ( NTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
'-soar-path' => env(
'SOAR_FILE',
OsHelper::isWindows() ? base_path('vendor/guanguans/soar-php/bin/soar.windows-amd64') :
(OsHelper::isMacOS() ? base_path('vendor/guanguans/soar-php/bin/soar.darwin-amd64') : base_path('vendor/guanguans/soar-php/bin/soar.linux-amd64'))
),
需要把 base_path('vendor/guanguans/soar-php/bin/soar.windows-amd64')
修改为base_path('vendor\guanguans\soar-php\bin\soar.windows-amd64')
/*
* soar 路径
*/
'-soar-path' => env(
'SOAR_FILE',
OsHelper::isWindows() ? base_path('vendor\guanguans\soar-php\bin\soar.windows-amd64') :
(OsHelper::isMacOS() ? base_path('vendor/guanguans/soar-php/bin/soar.darwin-amd64') : base_path('vendor/guanguans/soar-php/bin/soar.linux-amd64'))
),
<?php
declare(strict_types=1);
/*
* This file is part of the guanguans/soar-php.
*
* (c) 琯琯 <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/
namespace Guanguans\SoarPHP\Traits;
use Guanguans\SoarPHP\Exceptions\InvalidArgumentException;
use Guanguans\SoarPHP\Support\OsHelper;
/**
* Trait HasExecAble.
*/
trait HasExecAble
{
/**
* @throws \Guanguans\SoarPHP\Exceptions\InvalidArgumentException
*/
public function exec(string $command): ?string
{
if (false === strpos(strtolower($command), 'soar')) {
throw new InvalidArgumentException(sprintf("Command error: '%s'", $command));
}
if (true === OsHelper::isWindows()) {
$command = 'powershell '.$command;
}
$command=str_replace('"',"'",$command);
return shell_exec($command);
}
}
"powershell echo "select id, name, price, original_price, goods_type_id, details, status, is_featured, picture, useful_life from goods where store_id = 1 and goods_type = 2 and status = 1" | D:\phpstudy_pro\WWW\mh\vendor\guanguans\soar-php\bin\soar.windows-amd64 -test-dsn=mh_shop:[email protected]:3306/mh_shop -log-output=D:\phpstudy_pro\WWW\mh\storage\logs/soar.log -log-level=4 -report-type=html -allow-online-as-test=1 -drop-test-temporary=1 -max-join-table-count=5 -max-group-by-cols-count=5 -max-distinct-count=5 -max-index-cols-count=5 -max-total-rows=9999999 -spaghetti-query-length=2048 -explain-sql-report-type=pretty -explain-type=extended -explain-format=traditional -explain-warn-select-type=[] -explain-warn-access-type=[] -explain-max-keys=3 -explain-min-keys=0 -explain-max-rows=10000 -explain-warn-extra=[] -explain-max-filtered=100 -explain-warn-scalability=[] -ignore-rules=[] -blacklist=D:\phpstudy_pro\WWW\mh\soar.blacklist "
替换后
"powershell echo 'select id, name, price, original_price, goods_type_id, details, status, is_featured, picture, useful_life from goods where store_id = 1 and goods_type = 2 and status = 1' | D:\phpstudy_pro\WWW\mh\vendor\guanguans\soar-php\bin\soar.windows-amd64 -test-dsn=mh_shop:[email protected]:3306/mh_shop -log-output=D:\phpstudy_pro\WWW\mh\storage\logs/soar.log -log-level=4 -report-type=html -allow-online-as-test=1 -drop-test-temporary=1 -max-join-table-count=5 -max-group-by-cols-count=5 -max-distinct-count=5 -max-index-cols-count=5 -max-total-rows=9999999 -spaghetti-query-length=2048 -explain-sql-report-type=pretty -explain-type=extended -explain-format=traditional -explain-warn-select-type=[] -explain-warn-access-type=[] -explain-max-keys=3 -explain-min-keys=0 -explain-max-rows=10000 -explain-warn-extra=[] -explain-max-filtered=100 -explain-warn-scalability=[] -ignore-rules=[] -blacklist=D:\phpstudy_pro\WWW\mh\soar.blacklist "
主要是把 sql 语句的"替换成'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.