Skip to content

Commit

Permalink
Add new DECIMAL testcase into t/rt122541-decimals.t
Browse files Browse the repository at this point in the history
Add a new test case with CAST AS DECIMAL which verifies that support for
trailing zeros is working in Perl and which works also with new MySQL
server versions.
  • Loading branch information
pali committed Aug 21, 2023
1 parent e058db2 commit b0d55ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion t/rt122541-decimals.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ require "lib.pl";

my $dbh = DbiTestConnect($test_dsn, $test_user, $test_password, { PrintError => 0, RaiseError => 1 });

plan tests => 2;
plan tests => 4;

for my $mariadb_server_prepare (0, 1) {
$dbh->{mariadb_server_prepare} = $mariadb_server_prepare;
is $dbh->selectrow_arrayref('SELECT CAST(DEGREES(0.00043) * 69 AS DECIMAL(65, 2))')->[0], '1.70',
'float casted to decimal with fixed length and trailing zeros returns correct value for mariadb_server_prepare=' . $mariadb_server_prepare;
SKIP: {
skip 'MySQL 8.0.22+ server have broken ROUND() function', 1 if $dbh->get_info($GetInfoType{SQL_DBMS_NAME}) eq 'MySQL' and $dbh->{mariadb_serverversion} >= 80022;
is $dbh->selectrow_arrayref('SELECT round(degrees(0.00043) * 69, 2)')->[0], '1.70',
Expand Down

0 comments on commit b0d55ce

Please sign in to comment.