[Bps-public-commit] dbix-searchbuilder branch master updated. 1.74-4-g8f289d9
BPS Git Server
git at git.bestpractical.com
Wed Apr 19 20:08:32 UTC 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "dbix-searchbuilder".
The branch, master has been updated
via 8f289d932cb7da62fb76caa3c6159abc2bf3dfc1 (commit)
via e3dc1c3445f4b587ba5f9e5c2830214439eb8185 (commit)
from 8ebe59a9f2a5a0e52b62c90ba2e0c29217b738c6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8f289d932cb7da62fb76caa3c6159abc2bf3dfc1
Merge: 8ebe59a e3dc1c3
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Apr 20 03:59:02 2023 +0800
Merge branch 'fix-mariadb-mysql-versions-check'
commit e3dc1c3445f4b587ba5f9e5c2830214439eb8185
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Wed Apr 12 18:24:24 2023 -0300
Fix database version comparison
The version comparison was broken for MySQL and MariaDB because it was
comparing versions as decimal numbers instead of dot bersions, which
broke comparisons with MariaDB 10.10+.
diff --git a/lib/DBIx/SearchBuilder/Handle.pm b/lib/DBIx/SearchBuilder/Handle.pm
index 7a25876..ebec957 100755
--- a/lib/DBIx/SearchBuilder/Handle.pm
+++ b/lib/DBIx/SearchBuilder/Handle.pm
@@ -7,6 +7,7 @@ use Carp qw(croak cluck);
use DBI;
use Class::ReturnValue;
use Encode qw();
+use version;
use DBIx::SearchBuilder::Util qw/ sorted_values /;
@@ -332,10 +333,10 @@ sub Disconnect {
# interacting with a disconnected handle, here we unset
# dbh to inform other code that there is no connection any more.
# See also https://github.com/perl5-dbi/DBD-mysql/issues/306
-
+ my ($version) = $self->{'database_version'} =~ /^(\d+\.\d+)/;
if ( $self->isa('DBIx::SearchBuilder::Handle::mysql')
&& $self->{'database_version'} =~ /mariadb/i
- && $self->{'database_version'} ge '10.2' )
+ && version->parse('v'.$version) > version->parse('v10.2') )
{
$self->dbh(undef);
}
diff --git a/lib/DBIx/SearchBuilder/Handle/mysql.pm b/lib/DBIx/SearchBuilder/Handle/mysql.pm
index b89db19..17b353a 100755
--- a/lib/DBIx/SearchBuilder/Handle/mysql.pm
+++ b/lib/DBIx/SearchBuilder/Handle/mysql.pm
@@ -2,6 +2,7 @@ package DBIx::SearchBuilder::Handle::mysql;
use strict;
use warnings;
+use version;
use base qw(DBIx::SearchBuilder::Handle);
@@ -364,10 +365,10 @@ sub HasSupportForCombineSearchAndCount {
my ($version) = $self->DatabaseVersion =~ /^(\d+\.\d+)/;
if ( $self->_IsMariaDB ) {
- return $version >= 10.2 ? 1 : 0;
+ return (version->parse('v'.$version) >= version->parse('v10.2')) ? 1 : 0;
}
else {
- return $version >= 8 ? 1 : 0;
+ return (version->parse('v'.$version) >= version->parse('v8')) ? 1 : 0;
}
}
-----------------------------------------------------------------------
Summary of changes:
lib/DBIx/SearchBuilder/Handle.pm | 5 +++--
lib/DBIx/SearchBuilder/Handle/mysql.pm | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
hooks/post-receive
--
dbix-searchbuilder
More information about the Bps-public-commit
mailing list