1. <i id='1Skak'><tr id='1Skak'><dt id='1Skak'><q id='1Skak'><span id='1Skak'><b id='1Skak'><form id='1Skak'><ins id='1Skak'></ins><ul id='1Skak'></ul><sub id='1Skak'></sub></form><legend id='1Skak'></legend><bdo id='1Skak'><pre id='1Skak'><center id='1Skak'></center></pre></bdo></b><th id='1Skak'></th></span></q></dt></tr></i><div id='1Skak'><tfoot id='1Skak'></tfoot><dl id='1Skak'><fieldset id='1Skak'></fieldset></dl></div>

          <bdo id='1Skak'></bdo><ul id='1Skak'></ul>

      1. <legend id='1Skak'><style id='1Skak'><dir id='1Skak'><q id='1Skak'></q></dir></style></legend>

        <small id='1Skak'></small><noframes id='1Skak'>

        <tfoot id='1Skak'></tfoot>
      2. 在 Rails4 中将我的数据库从 sqlite3 切换到 mysql 时出现 strftime 错误

        strftime error while switching my database from sqlite3 to mysql in Rails4(在 Rails4 中将我的数据库从 sqlite3 切换到 mysql 时出现 strftime 错误)
      3. <i id='mXKXN'><tr id='mXKXN'><dt id='mXKXN'><q id='mXKXN'><span id='mXKXN'><b id='mXKXN'><form id='mXKXN'><ins id='mXKXN'></ins><ul id='mXKXN'></ul><sub id='mXKXN'></sub></form><legend id='mXKXN'></legend><bdo id='mXKXN'><pre id='mXKXN'><center id='mXKXN'></center></pre></bdo></b><th id='mXKXN'></th></span></q></dt></tr></i><div id='mXKXN'><tfoot id='mXKXN'></tfoot><dl id='mXKXN'><fieldset id='mXKXN'></fieldset></dl></div>
          • <bdo id='mXKXN'></bdo><ul id='mXKXN'></ul>
          • <small id='mXKXN'></small><noframes id='mXKXN'>

                <tbody id='mXKXN'></tbody>
              <tfoot id='mXKXN'></tfoot>
                  <legend id='mXKXN'><style id='mXKXN'><dir id='mXKXN'><q id='mXKXN'></q></dir></style></legend>
                • 本文介绍了在 Rails4 中将我的数据库从 sqlite3 切换到 mysql 时出现 strftime 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  最近我将我的数据库从 sqlite3 更改为 mysql.当我运行我的项目时,我在使用此查询的文件之一中收到此错误.

                  Recently i changed my database from sqlite3 to mysql.When i ran my project i am getting this error in one of the file which is using this query.

                  日期 = 日期.今天 + 1

                  date = Date.today + 1

                  @employees = Employee.where("status = ? AND strftime('%d/%m', date_of_birth) = ?", "Active" , date.strftime('%d/%m')

                  @employees = Employee.where("status = ? AND strftime('%d/%m', date_of_birth) = ?", "Active" , date.strftime('%d/%m')

                  ActionView::Template::Error (Mysql2::Error: FUNCTION hrms_development.strftime does not exist: SELECT COUNT(*) FROM `employees` WHERE (status = 'Active' AND strftime('%d/%m', date_of_birth) = '28/03')):
                      210:             
                      211:               <% date = Date.today %>
                      212:              <% @employees = Employee.where("status = ? AND strftime('%d/%m', date_of_birth) = ?", "Active" , date.strftime('%d/%m')) %>
                      213:             <% if @employees.empty? %>
                      214:              
                      215:             <%else%>
                      216:               <% @employees.each do |e| %>
                    app/views/home/_group_admin.html.erb:213:in `_app_views_home__group_admin_html_erb___2522183600721478262_91627100'
                    app/views/home/index.html.erb:17:in `_app_views_home_index_html_erb__2772204906267359422_86967120'
                  
                  
                  
                  ActionView::Template::Error: Mysql2::Error: FUNCTION hrms_development.strftime does not exist: SELECT COUNT(*) FROM `employees` WHERE (status = 'Active' AND strftime('%d/%m', date_of_birth) = '28/03')

                  推荐答案

                  用简单的替换试试这个,

                  Try this with simply replace,

                  <% @employees = Employee.where("status = ? AND strftime('%d/%m', date_of_birth) = ?", "Active" , date.strftime('%d/%m')) %>
                  

                  <% @employees = Employee.where("status = ? AND DATE_FORMAT(date_of_birth,'%d/%m') = ?", "Active" , date.strftime('%d/%m')) %>
                  

                  这篇关于在 Rails4 中将我的数据库从 sqlite3 切换到 mysql 时出现 strftime 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Set the variable result, from query(设置变量结果,来自查询)
                  What is dynamic SQL?(什么是动态 SQL?)
                  Mysql - How to quit/exit from stored procedure(Mysql - 如何退出/退出存储过程)
                  Does MySQL have time-based triggers?(MySQL 有基于时间的触发器吗?)
                  is it possible to call a sql script from a stored procedure in another sql script?(是否可以从另一个 sql 脚本中的存储过程调用 sql 脚本?)
                  Procedure to loop through comma separated string is not working(遍历逗号分隔字符串的过程不起作用)
                    <bdo id='u8TzZ'></bdo><ul id='u8TzZ'></ul>
                      <tfoot id='u8TzZ'></tfoot>
                        <legend id='u8TzZ'><style id='u8TzZ'><dir id='u8TzZ'><q id='u8TzZ'></q></dir></style></legend>

                        <small id='u8TzZ'></small><noframes id='u8TzZ'>

                          <tbody id='u8TzZ'></tbody>

                            <i id='u8TzZ'><tr id='u8TzZ'><dt id='u8TzZ'><q id='u8TzZ'><span id='u8TzZ'><b id='u8TzZ'><form id='u8TzZ'><ins id='u8TzZ'></ins><ul id='u8TzZ'></ul><sub id='u8TzZ'></sub></form><legend id='u8TzZ'></legend><bdo id='u8TzZ'><pre id='u8TzZ'><center id='u8TzZ'></center></pre></bdo></b><th id='u8TzZ'></th></span></q></dt></tr></i><div id='u8TzZ'><tfoot id='u8TzZ'></tfoot><dl id='u8TzZ'><fieldset id='u8TzZ'></fieldset></dl></div>