MySQL / ColdFusion 8:sql 模式
我们一直在使用 ColdFusion 和 MySQL 进行一些测试,但有些困惑。 我们知道您可以在 /etc/my.cnf 文件中设置不同的“sql-mode”标志,这将导致 MySQL 根据定义的模式以某些方式运行。 我们知道您还可以在启动 MySQL 时使用“--sql-mode=”标志来设置这些标志。
在/etc/my.cnf中,我们看到没有定义任何模式(其中一个被注释掉),因此我们添加了'sql-nodes=""'并重新启动了mysql(/etc/init.d/mysqld restart)。 每当我们进入 MySQL 命令行查看设置的模式时,输出如下:
mysql> SELECT @@GLOBAL.sql_mode;
+-------------------+
| @@GLOBAL.sql_mode |
+-------------------+
| |
+-------------------+
1 row in set (0.00 sec)
mysql> SELECT @@SESSION.sql_mode;
+--------------------+
| @@SESSION.sql_mode |
+--------------------+
| |
+--------------------+
1 row in set (0.00 sec)
这告诉我没有模式,这正是我们想要的。 但是,在 ColdFusion 8 中执行相同的操作,我们会看到以下内容:
SELECT @@GLOBAL.sql_mode;
[empty string]
SELECT @@SESSION.sql_mode;
STRICT_TRANS_TABLES
这显示全局 sql 模式为空,而会话 sql 模式设置为“STRICT_TRANS_TABLES
”,这正是我们所做的”不想要。
现在,我可以在做任何其他事情之前将 ColdFusion 中的会话 sql-mode 设置为空,这给了我想要的效果,但我真的不想去每个查询并添加它。
我(尝试)查看 /etc/init.d/mysqld 脚本以查看是否可以找到它设置模式的位置,但没有看到任何内容。
你们对正在发生的事情有什么建议或想法吗? 就好像 ColdFusion 正在某个地方设置它,但是我在 ColdFusion 管理器中没有看到任何可以设置它的内容。
We've been doing some testing with ColdFusion and MySQL and are a bit puzzled. We know that there are different 'sql-mode' flags you can set in the /etc/my.cnf file which will cause MySQL to behave certain ways, depending on the modes defined. We know you can also set these flags whenever starting MySQL using '--sql-mode=' flags.
In /etc/my.cnf, we see that there were no modes defined (one was commented out) so we added 'sql-nodes=""' and restarted mysql (/etc/init.d/mysqld restart). Whenever we go to the MySQL command line to see what mode is set, here's the output:
mysql> SELECT @@GLOBAL.sql_mode;
+-------------------+
| @@GLOBAL.sql_mode |
+-------------------+
| |
+-------------------+
1 row in set (0.00 sec)
mysql> SELECT @@SESSION.sql_mode;
+--------------------+
| @@SESSION.sql_mode |
+--------------------+
| |
+--------------------+
1 row in set (0.00 sec)
This tells me that there is no mode, which is what we're going for. However, doing the same thing in ColdFusion 8, we see the following:
SELECT @@GLOBAL.sql_mode;
[empty string]
SELECT @@SESSION.sql_mode;
STRICT_TRANS_TABLES
This shows the Global sql-mode is empty, while the Session sql-mode is set to 'STRICT_TRANS_TABLES
' which is what we don't want.
Now, I can set the Session sql-mode to be empty in ColdFusion before we do anything else, which gives me the desired effect, but I don't really want to go to every query and add that.
I (tried) looking in the /etc/init.d/mysqld script to see if I could find where it would set the mode, but didn't see anything.
Do you guys have ANY suggestions or thoughts to what's going on? It's as if ColdFusion is setting it somewhere, however there's nothing in the ColdFusion Administrator that I can see that would set this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的猜测是 CF/JDBC 连接中的某处正在缓存该信息。 您是否尝试过重新启动 CF 或添加新的数据源来看看会发生什么?
My guess is that somewhere in the CF/JDBC connection is caching that information. Have you tried restarting CF or adding a new datasource to see what happens?
根据 Ben Doom 的说法,您可能需要尝试使用 MySQL 的 MyODBC 驱动程序为 MYSQL 设置数据源,看看是否会得到不同的结果。
Based on what Ben Doom said, you might want to try setting up a datasource using MySQL's MyODBC driver for MYSQL to see if you get a different result.
我对此做了一些研究,看起来这是与 Java 或 JDBC 的兼容性问题:
在这里找到:http://bugs.mysql.com/bug.php?id=23371< /a>
I did a little research on this, and it looks like it's a compatibility issue with either Java or JDBC:
Found here: http://bugs.mysql.com/bug.php?id=23371