}
if (eval { lc ${ $info->{default_value} } }||'' eq 'current timestamp') {
- ${ $info->{default_value} } = 'CURRENT_TIMESTAMP';
+ ${ $info->{default_value} } = 'current_timestamp';
delete $info->{size};
}
}
$info->{default_value} = $def =~ /^\d/ ? $def : \$def;
}
}
+
+ ${ $info->{default_value} } = 'current_timestamp'
+ if ref $info->{default_value} && ${ $info->{default_value} } eq 'CURRENT_TIMESTAMP';
}
return $result;
$default =~ /^\d/ ? $default : \$default;
if (eval { lc ${ $info->{default_value} } }||'' eq 'getdate()') {
- ${ $info->{default_value} } = 'CURRENT_TIMESTAMP';
+ ${ $info->{default_value} } = 'current_timestamp';
}
}
}
delete $result->{$col}{default_value};
}
-# alias now() to CURRENT_TIMESTAMP for deploying to other DBs
+# alias now() to current_timestamp for deploying to other DBs
if (eval { lc ${ $result->{$col}{default_value} }||'' eq 'now()' }) {
# do not use a ref to a constant, that breaks Data::Dump output
- ${$result->{$col}{default_value}} = 'CURRENT_TIMESTAMP';
+ ${$result->{$col}{default_value}} = 'current_timestamp';
}
}
delete $info->{default_value} if ref($info->{default_value}) eq 'SCALAR' && ${ $info->{default_value} } eq 'NULL';
if (eval { lc ${ $info->{default_value} } }||'' eq 'current timestamp') {
- ${ $info->{default_value} } = 'CURRENT_TIMESTAMP';
+ ${ $info->{default_value} } = 'current_timestamp';
}
}
if ( lc($dbi_info->{COLUMN_DEF}) eq 'current_timestamp'
&& lc($dbi_info->{mysql_type_name}) eq 'timestamp') {
- $extra_info{default_value} = \'CURRENT_TIMESTAMP';
+ my $current_timestamp = 'current_timestamp';
+ $extra_info{default_value} = \$current_timestamp;
}
return \%extra_info;
# Date and Time Types
'date' => { data_type => 'date' },
'datetime' => { data_type => 'datetime' },
- 'timestamp DEFAULT current_timestamp'
- => { data_type => 'timestamp', default_value => \"CURRENT_TIMESTAMP" },
+ 'timestamp default current_timestamp'
+ => { data_type => 'timestamp', default_value => \'current_timestamp' },
'time' => { data_type => 'time' },
'year' => { data_type => 'year' },
'year(4)' => { data_type => 'year' },
'time(2) with time zone' => { size => 2, data_type => 'time with time zone' },
timestamp => { data_type => 'timestamp without time zone' },
'timestamp default current_timestamp'
- => { data_type => 'timestamp without time zone', default_value => \'CURRENT_TIMESTAMP' },
+ => { data_type => 'timestamp without time zone', default_value => \'current_timestamp' },
'timestamp(2)' => { size => 2, data_type => 'timestamp without time zone' },
'timestamp without time zone' => { data_type => 'timestamp without time zone' },
'timestamp(2) without time zone' => { size => 2, data_type => 'timestamp without time zone' },
password => $password,
null => '',
data_types => {
- 'timestamp DEFAULT CURRENT TIMESTAMP' => { data_type => 'timestamp', default_value => \'CURRENT_TIMESTAMP' }
+ 'timestamp default current timestamp' => { data_type => 'timestamp', default_value => \'current_timestamp' }
},
);
# datetime types
date => { data_type => 'date' },
datetime => { data_type => 'datetime' },
- # test rewriting getdate() to CURRENT_TIMESTAMP
- 'datetime DEFAULT getdate()'
- => { data_type => 'datetime', default_value => \'CURRENT_TIMESTAMP' },
+ # test rewriting getdate() to current_timestamp
+ 'datetime default getdate()'
+ => { data_type => 'datetime', default_value => \'current_timestamp' },
smalldatetime => { data_type => 'smalldatetime' },
time => { data_type => 'time' },
'time(0)'=> { data_type => 'time', size => 0 },
'smalldatetime'
=> { data_type => 'smalldatetime' },
'timestamp' => { data_type => 'timestamp' },
- # rewrite 'current timestamp' as 'CURRENT_TIMESTAMP'
- 'timestamp DEFAULT current timestamp'
- => { data_type => 'timestamp', default_value => \"CURRENT_TIMESTAMP" },
+ # rewrite 'current timestamp' as 'current_timestamp'
+ 'timestamp default current timestamp'
+ => { data_type => 'timestamp', default_value => \'current_timestamp' },
'time' => { data_type => 'time' },
# String Types
# Date and Time Types
'date' => { data_type => 'date' },
- 'timestamp DEFAULT CURRENT_TIMESTAMP'
- => { data_type => 'timestamp', default_value => \"CURRENT_TIMESTAMP" },
+ 'timestamp default current_timestamp'
+ => { data_type => 'timestamp', default_value => \'current_timestamp' },
'time' => { data_type => 'time' },
# String Types
$self->{date_datatype} ||= 'DATE';
# Not all DBS do SQL-standard CURRENT_TIMESTAMP
- $self->{default_function} ||= "CURRENT_TIMESTAMP";
- $self->{default_function_def} ||= "TIMESTAMP DEFAULT $self->{default_function}";
+ $self->{default_function} ||= "current_timestamp";
+ $self->{default_function_def} ||= "timestamp default $self->{default_function}";
$self = bless $self, $class;