Skip to content

Commit

Permalink
Make SQL::Abstract work.
Browse files Browse the repository at this point in the history
This removes the optional dependence on SQL::Abstract::Classic or a
version of SQL::Abstract prior to 2.000000, and only uses version
2.000000 or newer of SQL::Abstract.

For this to work the capability of a field override needs to be removed.
There doesn't seem to be a reliable way to do that with the newer
versions of SQL::Abstract, although I didn't try very hard.  I also
don't see the need for having a field override.  The only field that has
an override is the `key_not_a_keyfield` or `key` field.  Why was that
ever done?  Did someone think that MySQL would make a field a database
key field if it had the name "key"?  Did someone think it would be
confusing to have a field named "key" that was not a database key field?
It was probably the latter, but in my opinion the field override was
even more confusing.

The `key` field in the `key` table does not contain any permanent data,
so upgrading courses does not require any special handling.  The data
from the old `key_not_a_keyfield` field can be safely dropped, and the
new `key` field used in its place.  You can leave the
`key_not_a_keyfield` field in the database if you want to switch back
and forth between other pull requests that use the `key_not_a_keyfield`
field.
  • Loading branch information
drgrice1 committed Dec 9, 2023
1 parent 7d0f568 commit f6bd38c
Show file tree
Hide file tree
Showing 6 changed files with 236 additions and 358 deletions.
27 changes: 3 additions & 24 deletions bin/check_modules.pl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ =head1 DESCRIPTION
Scalar::Util
SOAP::Lite
Socket
SQL::Abstract
Statistics::R::IO
String::ShellQuote
SVG
Expand All @@ -166,7 +167,8 @@ =head1 DESCRIPTION
'LWP::Protocol::https' => 6.06,
'Mojolicious' => 9.22,
'Net::SSLeay' => 1.46,
'Perl::Tidy' => 20220613
'Perl::Tidy' => 20220613,
'SQL::Abstract' => 2.000000
);

my ($test_programs, $test_modules, $show_help);
Expand Down Expand Up @@ -249,29 +251,6 @@ sub check_modules {
print " $module found and loaded\n";
}
}
checkSQLabstract();
}

## this is specialized code to check for either SQL::Abstract or SQL::Abstract::Classic

sub checkSQLabstract {
print "\n checking for SQL::Abstract\n\n";
eval "use SQL::Abstract";
my $sql_abstract = not($@);
my $sql_abstract_version = $SQL::Abstract::VERSION if $sql_abstract;

eval "use SQL::Abstract::Classic";
my $sql_abstract_classic = not($@);

if ($sql_abstract_classic) {
print qq/ You have SQL::Abstract::Classic installed. This package will be used if either
the installed version of SQL::Abstract is version > 1.87 or if that package is not installed.\n/;
} elsif ($sql_abstract && $sql_abstract_version <= 1.87) {
print "You have version $sql_abstract_version of SQL::Abstract installed. This will be used\n";
} else {
print qq/You need either SQL::Abstract version <= 1.87 or need to install SQL::Abstract::Classic.
If you are using cpan or cpanm, it is recommended to install SQL::Abstract::Classic.\n/;
}
}

1;
Loading

0 comments on commit f6bd38c

Please sign in to comment.