我有一个用此SQL创建的表:
CREATE TABLE `test_table` (
`id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
`data` TEXT,
`timestamp` TIMESTAMP
) CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE InnoDB;
Run Code Online (Sandbox Code Playgroud)
但是当我跑步时SHOW CREATE TABLE test_table,我得到:
CREATE TABLE `test_table` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`data` text COLLATE utf8_unicode_ci,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
Run Code Online (Sandbox Code Playgroud)
为什么默认情况下将时间戳列分配为ON UPDATE CURRENT_TIMESTAMP?我不知道该如何摆脱。任何帮助将不胜感激。
初始化隐藏时,我无法获得select2下拉列表以适合父容器(折叠).我知道这不是一个错误,因为select2无法计算父宽度.但我无法克服这一点.我需要100%给父母.
<div class="panel panel-default">
<div class="panel-body">
<div class="btn-toolbar">
<button class="btn btn-default" data-toggle="collapse" data-target="#collapse-select2" aria-expanded="false">Toggle</button>
</div>
<div class="collapse" id="collapse-select2">
<select class="form-control" data-role="select2">
<option value="1">Option #1</option>
<option value="2">Option #2</option>
<option value="3">Option #3</option>
</select>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
小提琴:这里
有人可以帮忙吗?
我在单独的标头中声明了一些常量变量(即constant.h)。
我将constant.h 包含在我的debug.cpp中以访问该变量。
我在main.cpp中包含constant.h、debug.h来访问变量。
当我编译时,它显示错误**multiple definition** of **IF_DEBUG_ENABLED**。
请告诉我我实际上做错了什么。另外,请注意,这是我第一次使用c/c++应用程序的第一天。我什至在学校里都没读过。
我的代码源码如下:如
/ -- 常量.h -- /
#ifndef CONSTANT_H
#define CONSTANT_H
const char* APP_NAME = "ymcmcb";
const bool IF_DEBUG_ENABLED = true;
#endif // CONSTANT_H
Run Code Online (Sandbox Code Playgroud)
/ -- 调试.h -- /
#ifndef DEBUG_H
#define DEBUG_H
#include <QString>
class Debug
{
public:
static void Log(QString Message);
};
#endif // DEBUG_H
Run Code Online (Sandbox Code Playgroud)
/ -- 调试.cpp -- /
#include "constant.h"
#include "debug.h"
#include "QDebug" …Run Code Online (Sandbox Code Playgroud)