namespace data {
StampedElement::StampedElement()
- : timestamp_(boost::posix_time::microsec_clock::local_time()) {
+ /// @todo Change it to microsec_clock once we transition to subsecond
+ /// precision.
+ : timestamp_(boost::posix_time::second_clock::local_time()) {
}
void
StampedElement::updateModificationTime() {
- setModificationTime(boost::posix_time::microsec_clock::local_time());
+ /// @todo Change it to microsec_clock once we transition to subsecond
+ /// precision.
+ setModificationTime(boost::posix_time::second_clock::local_time());
}
} // end of namespace isc::data
output_time.hour = input_time.time_of_day().hours();
output_time.minute = input_time.time_of_day().minutes();
output_time.second = input_time.time_of_day().seconds();
- output_time.second_part = input_time.time_of_day().fractional_seconds()
- *1000000/time_duration::ticks_per_second();
+ /// @todo Use fractional seconds instead of 0 when minimum supported
+ /// MySQL version has it.
+ output_time.second_part = 0;
+/* output_time.second_part = input_time.time_of_day().fractional_seconds()
+ *1000000/time_duration::ticks_per_second(); */
output_time.neg = my_bool(0);
}
ptime
MySqlBinding::convertFromDatabaseTime(const MYSQL_TIME& database_time) {
- long fractional = database_time.second_part * time_duration::ticks_per_second()/1000000;
+ /// @todo Use fractional seconds instead of 0 when minimum supported
+ /// MySQL version has it.
+ long fractional = 0;
+ // long fractional = database_time.second_part * time_duration::ticks_per_second()/1000000;
ptime pt(boost::gregorian::date(database_time.year,
boost::gregorian::greg_month(database_time.month),
database_time.day),
// This test verifies that the binding preserves fractional seconds in
// millisecond precision.
-TEST(MySqlBindingTest, millisecondTimestampPrecision) {
+/// @todo This test is disabled until we decide that the minimum
+/// supported MySQL version has a fractional seconds precision.
+TEST(MySqlBindingTest, DISABLED_millisecondTimestampPrecision) {
// Set timestamp of 2019-01-28 01:12:10.123
// Fractional part depends on the clock resolution.
/// The new table contains 6 columns of various data types. All of
/// the columns accept null values.
void createTestTable() {
+ /// @todo TIMESTAMP value lacks sub second precision because
+ /// it is supported since MySQL 5.6.4, which is still not a
+ /// default version on some OSes. When the subsecond precision
+ /// is available on all OSes that Kea supports, the timestamp
+ /// column should be turned to TIMESTAMP(6). Until then, it
+ /// must remain TIMESTAMP.
runQuery("CREATE TABLE IF NOT EXISTS mysql_connection_test ("
"tinyint_value TINYINT NULL,"
"int_value INT NULL,"
"bigint_value BIGINT NULL,"
"string_value TEXT NULL,"
"blob_value BLOB NULL,"
- "timestamp_value TIMESTAMP(6) NULL"
+ "timestamp_value TIMESTAMP NULL"
")");
}
MySqlBinding::createInteger<int64_t>(-4096),
MySqlBinding::createString("shellfish"),
MySqlBinding::createBlob(blob.begin(), blob.end()),
- MySqlBinding::createTimestamp(boost::posix_time::microsec_clock::local_time())
+ /// @todo Change it to microsec_clock once we transition to subsecond
+ /// precision.
+ MySqlBinding::createTimestamp(boost::posix_time::second_clock::local_time())
};
testInsertSelect(in_bindings);
MySqlBinding::createInteger<int64_t>(-4096),
MySqlBinding::createString("shellfish"),
MySqlBinding::createBlob(blob.begin(), blob.end()),
- MySqlBinding::createTimestamp(boost::posix_time::microsec_clock::local_time())
+ /// @todo Change it to microsec_clock once we transition to subsecond
+ /// precision.
+ MySqlBinding::createTimestamp(boost::posix_time::second_clock::local_time())
};
testInsertSelect(in_bindings);
MySqlBinding::createInteger<int64_t>(-4096),
MySqlBinding::createNull(),
MySqlBinding::createBlob(blob.begin(), blob.end()),
- MySqlBinding::createTimestamp(boost::posix_time::microsec_clock::local_time())
+ /// @todo Change it to microsec_clock once we transition to subsecond
+ /// precision.
+ MySqlBinding::createTimestamp(boost::posix_time::second_clock::local_time())
};
testInsertSelect(in_bindings);
MySqlBinding::createInteger<int64_t>(-4096),
MySqlBinding::createString("shellfish"),
MySqlBinding::createNull(),
- MySqlBinding::createTimestamp(boost::posix_time::microsec_clock::local_time())
+ /// @todo Change it to microsec_clock once we transition to subsecond
+ /// precision.
+ MySqlBinding::createTimestamp(boost::posix_time::second_clock::local_time())
};
testInsertSelect(in_bindings);
MySqlBinding::createInteger<int64_t>(-4096),
MySqlBinding::createString(""),
MySqlBinding::createBlob(blob.begin(), blob.end()),
- MySqlBinding::createTimestamp(boost::posix_time::microsec_clock::local_time())
+ /// @todo Change it to microsec_clock once we transition to subsecond
+ /// precision.
+ MySqlBinding::createTimestamp(boost::posix_time::second_clock::local_time())
};
testInsertSelect(in_bindings);
# This line concludes database upgrade to version 7.0.
--- -----------------------------------------------------
--- Modify timestamps in the Configuration Backend
--- specific tables to use fractional seconds with
--- 6 decimal places precision.
--- -----------------------------------------------------
-
-ALTER TABLE dhcp4_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_audit
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_global_parameter
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_global_parameter_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_option_def
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_option_def_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_shared_network
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_shared_network_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_subnet
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_pool
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_subnet_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
ALTER TABLE dhcp4_options
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL
- DEFAULT CURRENT_TIMESTAMP(6);
-
-ALTER TABLE dhcp4_options_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_audit
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_global_parameter
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_global_parameter_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_option_def
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_option_def_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_shared_network
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_shared_network_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_subnet
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_pool
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_subnet_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
+ MODIFY COLUMN modification_ts TIMESTAMP NOT NULL
+ DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE dhcp6_options
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL
- DEFAULT CURRENT_TIMESTAMP(6);
-
-ALTER TABLE dhcp6_options_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
+ MODIFY COLUMN modification_ts TIMESTAMP NOT NULL
+ DEFAULT CURRENT_TIMESTAMP;
-- -----------------------------------------------------
-- Make sure that constraints on the 7.0 schema tables
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS dhcp4_audit_revision (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
- modification_ts TIMESTAMP(6) NOT NULL,
+ modification_ts TIMESTAMP NOT NULL,
log_message TEXT,
server_id BIGINT(10) UNSIGNED,
PRIMARY KEY (id),
-- -----------------------------------------------------
DROP PROCEDURE IF EXISTS createAuditRevisionDHCP4;
DELIMITER $$
-CREATE PROCEDURE createAuditRevisionDHCP4(IN audit_ts TIMESTAMP(6),
+CREATE PROCEDURE createAuditRevisionDHCP4(IN audit_ts TIMESTAMP,
IN server_tag VARCHAR(256),
IN audit_log_message TEXT,
IN cascade_transaction TINYINT(1))
mysql "$@" <<EOF
--- -----------------------------------------------------
--- Modify timestamps in the Configuration Backend
--- specific tables to use fractional seconds with
--- 6 decimal places precision.
--- -----------------------------------------------------
-
-ALTER TABLE dhcp4_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_audit
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_global_parameter
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_global_parameter_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_option_def
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_option_def_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_shared_network
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_shared_network_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_subnet
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_pool
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp4_subnet_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
ALTER TABLE dhcp4_options
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL
- DEFAULT CURRENT_TIMESTAMP(6);
-
-ALTER TABLE dhcp4_options_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_audit
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_global_parameter
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_global_parameter_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_option_def
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_option_def_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_shared_network
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_shared_network_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_subnet
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_pool
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
-
-ALTER TABLE dhcp6_subnet_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
+ MODIFY COLUMN modification_ts TIMESTAMP NOT NULL
+ DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE dhcp6_options
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL
- DEFAULT CURRENT_TIMESTAMP(6);
-
-ALTER TABLE dhcp6_options_server
- MODIFY COLUMN modification_ts TIMESTAMP(6) NOT NULL;
+ MODIFY COLUMN modification_ts TIMESTAMP NOT NULL
+ DEFAULT CURRENT_TIMESTAMP;
-- -----------------------------------------------------
-- Make sure that constraints on the 7.0 schema tables
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS dhcp4_audit_revision (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
- modification_ts TIMESTAMP(6) NOT NULL,
+ modification_ts TIMESTAMP NOT NULL,
log_message TEXT,
server_id BIGINT(10) UNSIGNED,
PRIMARY KEY (id),
-- -----------------------------------------------------
DROP PROCEDURE IF EXISTS createAuditRevisionDHCP4;
DELIMITER $$
-CREATE PROCEDURE createAuditRevisionDHCP4(IN audit_ts TIMESTAMP(6),
+CREATE PROCEDURE createAuditRevisionDHCP4(IN audit_ts TIMESTAMP,
IN server_tag VARCHAR(256),
IN audit_log_message TEXT,
IN cascade_transaction TINYINT(1))