Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/techsneeze/dmarcts-report-parser.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumann <robert@schumann.link>2021-07-04 12:24:40 +0300
committerRobert Schumann <robert@schumann.link>2021-07-04 12:24:40 +0300
commitb74c4ea85fa2910d9d479a18da8a516756fd85a8 (patch)
tree9bc545847816b5a1fcffac1b3675bd244e21d1b0
parente07bb49f9630e982c26eedf0f26a654d660b3bea (diff)
Fixes #102
* display width is a deprecated feature for recent MySQL versions and breaks the table bootstrapping logic * determine MySQL version and remove display width or default back to initial display width setting
-rwxr-xr-xdmarcts-report-parser.pl14
1 files changed, 9 insertions, 5 deletions
diff --git a/dmarcts-report-parser.pl b/dmarcts-report-parser.pl
index 6c4264a..7164c26 100755
--- a/dmarcts-report-parser.pl
+++ b/dmarcts-report-parser.pl
@@ -1053,10 +1053,14 @@ sub storeXMLInDatabase {
sub checkDatabase {
my $dbh = $_[0];
+ # display width is deprecated in MySQL 8+ and will not be shown in show create statements
+ my $mysql_main_version = $dbh->selectrow_array("SELECT SUBSTRING_INDEX(VERSION(), '.', 1);") || 5;
+ my $display_width = ( $mysql_main_version <= 5 ? "(10)" : "" );
+
my %tables = (
"report" => {
column_definitions => [
- "serial" , "int(10) unsigned NOT NULL AUTO_INCREMENT",
+ "serial" , "int${ display_width } unsigned NOT NULL AUTO_INCREMENT",
"mindate" , "timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP",
"maxdate" , "timestamp NULL",
"domain" , "varchar(255) NOT NULL",
@@ -1076,11 +1080,11 @@ sub checkDatabase {
},
"rptrecord" =>{
column_definitions => [
- "id" , "int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY",
- "serial" , "int(10) unsigned NOT NULL",
- "ip" , "int(10) unsigned",
+ "id" , "int${ display_width } unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY",
+ "serial" , "int${ display_width } unsigned NOT NULL",
+ "ip" , "int${ display_width } unsigned",
"ip6" , "binary(16)",
- "rcount" , "int(10) unsigned NOT NULL",
+ "rcount" , "int${ display_width } unsigned NOT NULL",
"disposition" , "enum('" . join("','", ALLOWED_DISPOSITION) . "')",
"reason" , "varchar(255)",
"dkimdomain" , "varchar(255)",