MySQL MAX

编程入门 行业动态 更新时间:2024-10-12 18:19:57
本文介绍了MySQL MAX_JOIN_SIZE错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我代表一小群有此问题的用户问这个问题.

I am asking this question on behalf of a small group of my users that have this problem.

他们使用的脚本一旦获得第21个ID,就会产生以下错误:

Once the script they are using gets to the 21st ID, it generates the following error:

SELECT会检查以下内容: MAX_JOIN_SIZE行;检查你的位置 并使用SET SQL_BIG_SELECTS = 1或SET SQL_MAX_JOIN_SIZE =#如果SELECT是 好吧

The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay

我已对此进行了尽可能多的研究,并找到了答案: dev.mysql/doc/refman/5.0/en/set-option.html

I have researched this as much as possible and found something of an answer : dev.mysql/doc/refman/5.0/en/set-option.html

问题在于它们位于共享主机上,因此它们无法更改MySQL设置来修复错误.

The problem is that they are on shared hosting so they cannot change their MySQL settings to fix the errors.

我可以在脚本中写些什么,以使他们没有这个问题吗?

Is there anything I can write into my script so that they do not have this problem?

此函数可根据加载的模块生成数据库查询: $ sql ='选择a.id作为id,a.address作为地址';

This is the function that generates the database query based on which modules are loaded: $sql = 'SELECT a.id as id , a.address as address';

$query = 'SELECT' . ' name AS module_name' . ', databasename AS module_database' . ', pregmatch AS module_pregmatch' . ', pregmatch2 AS module_pregmatch2' . ', html AS module_html' . ', sqlselect AS database_sqlselect' . ', sqljoin AS database_sqljoin' . ', sqlupdatewithvalue AS database_sqlupdatewithvalue' . ', sqlupdatenovalue AS database_sqlupdatenovalue' . ' FROM #__aqsgmeta_modules' . ' WHERE enabled = 1' . ' ORDER BY id'; $db->setQuery($query); $results = $db->loadObjectList(); if (count($results) != 0) { foreach ($results as $result) { $sqlselect .= ', '; $sqlselect .= $result->database_sqlselect; $sqljoin .= ' '; $result->database_sqljoin = preg_replace('/\{DATABASENAME\}/Ui', $result->module_database, $result->database_sqljoin); if (!(preg_match("/" . $result->database_sqljoin . "/Ui", $sqljoin))) $sqljoin .= $result->database_sqljoin; } } if ($use_sh404sef) $sqlselect .= ', g.oldurl AS sefurl'; $sql .= $sqlselect; $sql .= ' FROM #__aqsgmeta_address AS a'; $sql .= $sqljoin; if ($use_sh404sef) $sql .= ' LEFT JOIN #__redirection AS g ON g.newurl = a.address'; $sql .= //. ' WHERE a.id IN (' . $cids . ')' ' WHERE a.id = ' . $id . ' ORDER BY a.address asc,a.id ' ; $db->setQuery($sql); $rows = $db->loadObjectList();

推荐答案

MAX_JOIN_SIZE是共享主机上常用的安全防护.

MAX_JOIN_SIZE is a safety catch commonly used on the shared hostings.

它不会让您意外地运行长时间的查询,而这会使服务器挂起.

It won't let you accidentally run long queries which would hang the server.

发出此命令:

SET SQL_BIG_SELECTS = 1

在运行查询之前,您会返回很多值.

before running the query you know to return lots of values.

更多推荐

MySQL MAX

本文发布于:2023-11-22 01:12:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1615390.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:MySQL   MAX

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!