Skip to content
Permalink
Browse files

Fixes manage deposit screen does not sort on maria db due to sub-quer…

…y sorting changes.
  • Loading branch information...
jiadiyao committed Nov 20, 2015
1 parent 465a4f5 commit d9dc16acc8f42f233e7aa981821fdebe75be455d
Showing with 21 additions and 1 deletion.
  1. +21 −1 perl_lib/EPrints/Database/mysql.pm
@@ -396,7 +396,10 @@ sub _cache_from_SELECT
$sql .= "INSERT INTO ".$self->quote_identifier( $cache_table );
$sql .= "($Q_pos, $Q_keyname)";
$sql .= " SELECT \@i:=\@i+1, $Q_keyname";
$sql .= " FROM ($select_sql) ".$self->quote_identifier( "S" );
# MariaDB does not order sub-queries unless limited. Using limit of 2^31-1 in case any system is using a signed 32-bit integer.
my $limit = " LIMIT 2147483647";
$limit = "" if $select_sql =~ /LIMIT/;
$sql .= " FROM ($select_sql$limit) ".$self->quote_identifier( "S" );

$self->do( $sql );
}
@@ -427,6 +430,23 @@ sub get_primary_key
return @COLS;
}

sub get_number_of_keys
{
my( $self, $table ) = @_;
my $sth = $self->prepare( "DESCRIBE ".$self->quote_identifier($table) );
$sth->execute;

my $NUM_KEYS = 0;
while(my $row = $sth->fetch)
{
if ( $row->[3] eq 'PRI' or $row->[3] eq 'MUL' or $row->[3] eq 'UNI' )
{
++$NUM_KEYS;
}
}
return $NUM_KEYS;
}

sub get_column_collation
{
my( $self, $table, $column ) = @_;

0 comments on commit d9dc16a

Please sign in to comment.
You can’t perform that action at this time.