[Rt-commit] rt branch 5.0/shortener-load-by-content created. rt-5.0.3-494-gb93d1d2888
BPS Git Server
git at git.bestpractical.com
Thu Apr 20 18:35:31 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 "rt".
The branch, 5.0/shortener-load-by-content has been created
at b93d1d2888c7dfaff1e3e577a1440a208ecef3cc (commit)
- Log -----------------------------------------------------------------
commit b93d1d2888c7dfaff1e3e577a1440a208ecef3cc
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Apr 21 01:06:17 2023 +0800
Load indexed Code column instead when load shortener by content
It's much faster and also gets around the datatype issue with Oracle:
ORA-00932: inconsistent datatypes: expected - got CLOB
diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
index 5d59278828..4074b56aed 100644
--- a/lib/RT/Attribute.pm
+++ b/lib/RT/Attribute.pm
@@ -462,7 +462,7 @@ sub Delete {
if ( $name eq 'SavedSearch' ) {
my $shortener = RT::Shortener->new( $self->CurrentUser );
- $shortener->LoadByCols( Content => 'SavedSearchId=' . $self->Id );
+ $shortener->LoadByContent( 'SavedSearchId=' . $self->Id );
if ( $shortener->Id ) {
my ( $ret, $msg ) = $shortener->Delete;
if ( !$ret ) {
diff --git a/lib/RT/Shortener.pm b/lib/RT/Shortener.pm
index 908f2fd3d0..3fd6b7f949 100644
--- a/lib/RT/Shortener.pm
+++ b/lib/RT/Shortener.pm
@@ -142,6 +142,12 @@ sub LoadByCode {
return $self->LoadByCols( Code => $code );
}
+sub LoadByContent {
+ my $self = shift;
+ my $content = shift;
+ return $self->LoadByCols( Code => sha1_hex($content) );
+}
+
sub DecodedContent {
my $self = shift;
my $content = shift || $self->Content;
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list