doutang3077 2014-09-14 00:38
浏览 43
已采纳

通过连接整理而不是结构整理来命令mysql结果

I have a multilingual platform. I need it to sort results depending on the prefered collation for the mysql connection. Not by mysql structure collation.

Is this possible to do without rewriting every query? I don't wanna end up with example order by name asc collate utf8_swedish_ci in every query.

set names utf8 collate utf8_swedish_ci doesn't work as the results order å before b like utf8_general_ci does.

  • 写回答

1条回答 默认 最新

  • douyang5943 2014-09-14 00:48
    关注

    The SET NAMES stuff handles the character set used for queries and query metadata such as column names. It has no effect on the handling of data from your tables. See here. http://dev.mysql.com/doc/refman/5.6/en/charset-connection.html

    You asked whether it's possible to use a particular collation (presumably a user preference setting) to order results without rewriting queries. The answer is no.

    This is partly because collations are bound into indexes when the indexes are constructed or updated. That's very good for performance, but unfortunately not in your kind of pan-European multi-collation application.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口