简体   繁体   English

MDB2准备转义冒号

[英]MDB2 prepare escaping colon

I'm using mdb2 prepare for creating a select query with date_format, and I need to receive datetime in format "%Y-%m-%d %H:%i:%s". 我正在使用mdb2准备创建带date_format的选择查询,并且我需要接收格式为“%Y-%m-%d%H:%i:%s”的datetime。 When using such format with mdb2 query - there are no problems, but when i'm trying to prepare this query, I get a syntax error because of colons in it. 当将这种格式与mdb2查询一起使用时-没有问题,但是当我尝试准备此查询时,由于冒号而导致语法错误。 Is there a way to escape these colons? 有没有办法摆脱这些结肠?

It's just a MySQL timestamp string. 这只是一个MySQL时间戳字符串。 You don't escape anything. 你什么也逃不掉。 It just needs to be quoted. 它只需要引用。 eg 例如

INSERT ... VALUES ('2014-06-10 13:47:00', 2014-06-10 13:47:00)

is seen as a timestamp, and some mathematical operations (2014 minus 6 minus 10 and some syntax error bare values). 被视为时间戳和一些数学运算(2014减6减10以及某些语法错误的裸值)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM