Permalink
Browse files

[48] Use timestamp instead of date output in SQL dump

Signed-off-by: DoesntMatter <jaed1@gmx.net>
  • Loading branch information...
DoesntMatter committed Jan 27, 2012
1 parent 999a36b commit 8440dece4075f9aa676776ed54e06706d9ac7d2e
Showing with 7 additions and 1 deletion.
  1. +7 −1 libs/SQL.pm
View
@@ -20,6 +20,7 @@
# http://www.gnu.org/copyleft/gpl.html
use strict;
use Date::Parse;
no warnings 'uninitialized'; # We can use uninitialized variables without any problem here
package SQL;
@@ -56,7 +57,7 @@ sub TableStruct {
print FILE "-- Create table structure
CREATE TABLE IF NOT EXISTS `$table` (
`hash` varchar(40) NOT NULL DEFAULT '' COMMENT 'Unique identifier of commit',
`date` varchar(40) NOT NULL DEFAULT '' COMMENT 'Time of commit',
`date` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Time of commit',
`author` varchar(30) NOT NULL DEFAULT '' COMMENT 'Author of commit',
`email` varchar(30) NOT NULL DEFAULT '' COMMENT 'Email of commit',
`subject` text NOT NULL COMMENT 'Subject of commit',
@@ -94,6 +95,11 @@ sub CreateSQL {
$items[$i][6] =~ s/'/\\'/; # Needed to escape string in query
}
# Convert Commit-Date to UNIX timestamp
if ($items[$i][2]) {
$items[$i][2] = Date::Parse::str2time($items[$i][2]);
}
print FILE "
INSERT IGNORE INTO `$table` VALUES ('$items[$i][1]', '$items[$i][2]', '$items[$i][3]', '$items[$i][4]', '$items[$i][5]', '$items[$i][6]');";
}

0 comments on commit 8440dec

Please sign in to comment.