出于某种原因,当我指定的findAll()的我的订单条款“随机”,CFWHeels抛出一个错误:CFWheels - 订单=“随机”抛出一列错误
Wheels.ColumnNotFound
Wheels looked for the column mapped to the random property but couldn't find it in the database table. Suggested action
Verify the order argument and/or your property to column mappings done with the property method inside the model's init method to make sure everything is correct.
我已经使用计算属性之前,但这不应该寻找关于“随机”排序的任何内容。
<cffunction name="random">
<cfparam name="params.page" default="1" />
<cfparam name="params.pageQuantity" default="5" />
<cfset posts = model("post").findAll(
select = "
posts.postID,
postTitle,
postPoints,
postAuthority,
postCreated,
postCommentCount,
postUpVoteCount,
postDownVoteCount,
users.userID,
userName,
categories.categoryID,
categoryTitle,
categoryToken",
include = "user,category",
order = "random",
page = params.page,
perPage = params.pageQuantity
) />
</cffunction>
这是否可能与使用select
语句有关?
希望得到任何帮助。
非常感谢, Michael。
这会产生什么样的sql?如果你直接对你的数据库运行sql,会发生什么? –
@DanBracuk我无法查看生成的SQL,因为这是一个CFWheels错误页面,而不是一个Railo错误 - 有什么办法可以做到这一点? –
它可能是一个CFWheels错误页面,但确实看起来像一个数据库错误。当random既不是您的select子句的字段名也不是别名时,您的数据库是否支持“随机排序”? –