table data/Duplicate row

BubikolRamios's profile image BubikolRamios posted 8 years ago in General Permalink

Bugged you abot this a while ago, should copy entire row data as they are, without limitation (no need to wory about insert errors as they will pop up at actual insert) & auto create null at new row autoinc field.

I you have some time to test, there is 'Xiphinema diversicaudatum', all I need is duplicate entire row & change 'diversicaudatum' to 'vuittenezi'. Likely to be mistyped hence I have that (vuittenezi) on clipboard.

Try to repeat, you will see that 'Duplicate row' is not duplicate row at all.

CREATE TABLE `test` (
    `id_master` INT(10) UNSIGNED NOT NULL,
    `term` VARCHAR(100) NOT NULL DEFAULT ' ' COMMENT 'zgolj podsetnik za update id_tezavra' COLLATE 'utf8_slovenian_ci',
    `op` TEXT NULL COLLATE 'utf8_slovenian_ci',
    `source` VARCHAR(400) NULL DEFAULT NULL COMMENT 'če je več sourcov ' COLLATE 'utf8_slovenian_ci',
    `source_sha1` VARCHAR(50) NOT NULL DEFAULT ' ' COLLATE 'utf8_slovenian_ci',
    `DSP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    `sources_record_id` INT(11) NOT NULL AUTO_INCREMENT,
    PRIMARY KEY (`id_master`, `term`, `source_sha1`),
    UNIQUE INDEX `auto` (`sources_record_id`)
)
COMMENT='viri za trditev, da ta in ta obstaja v tem in tem id_master'
COLLATE='utf8_slovenian_ci'
ENGINE=MyISAM
AUTO_INCREMENT=184536
;

CREATE DEFINER=`localhost` TRIGGER `test_before_insert` BEFORE INSERT ON `test` FOR EACH ROW BEGIN
  set new.source_sha1 = sha1(new.source);
END



INSERT INTO `test` (`id_master`, `term`, `op`, `source`, `source_sha1`, `DSP`, `sources_record_id`) VALUES (11, 'Xiphinema diversicaudatum', NULL, 'source', 'f417e92d36d95038fa9d58081aa6153e3d0e3462', '2016-01-25 11:00:23', 184595);

Please login to leave a reply, or register at first.