fixing a problem with long keys in utf-8 encoded database tables
This commit is contained in:
parent
53538d366f
commit
1f0b19a609
2 changed files with 6 additions and 10 deletions
|
|
@ -23,7 +23,8 @@ finish();
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
sub makeQueriesFaster {
|
sub makeQueriesFaster {
|
||||||
print "\tMaking queries a little faster.\n" unless ($quiet);
|
print "\tMaking queries a little faster.\n" unless ($quiet);
|
||||||
WebGUI::SQL->write("alter table assetData add index assetId_url_revisionDate_status_tagId (assetId,url,revisionDate,status,tagId)");
|
WebGUI::SQL->write("alter table assetData add index assetId_url (assetId,url)");
|
||||||
|
WebGUI::SQL->write("alter table assetData add index assetId_revisionDate_status_tagId (assetId,revisionDate,status,tagId)");
|
||||||
WebGUI::SQL->write("alter table asset add index className_assetId_state (className,assetId,state)");
|
WebGUI::SQL->write("alter table asset add index className_assetId_state (className,assetId,state)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1074,26 +1074,21 @@ sub newByUrl {
|
||||||
$url =~ s/\"//;
|
$url =~ s/\"//;
|
||||||
my $asset;
|
my $asset;
|
||||||
if ($url ne "") {
|
if ($url ne "") {
|
||||||
my ($id, $class, $version) = WebGUI::SQL->quickArray("
|
my ($id, $class) = WebGUI::SQL->quickArray("
|
||||||
select
|
select
|
||||||
asset.assetId,
|
asset.assetId,
|
||||||
asset.className,
|
asset.className
|
||||||
max(assetData.revisionDate)
|
|
||||||
from
|
from
|
||||||
asset
|
asset
|
||||||
left join
|
left join
|
||||||
assetData on asset.assetId=assetData.assetId
|
assetData on asset.assetId=assetData.assetId
|
||||||
where
|
where
|
||||||
assetData.url=".quote($url)." and
|
assetData.url=".quote($url)."
|
||||||
(
|
|
||||||
assetData.status='approved' or assetData.status='archived' or
|
|
||||||
assetData.tagId=".quote($session{scratch}{versionTag})."
|
|
||||||
)
|
|
||||||
group by
|
group by
|
||||||
assetData.assetId
|
assetData.assetId
|
||||||
");
|
");
|
||||||
if ($id ne "" || $class ne "") {
|
if ($id ne "" || $class ne "") {
|
||||||
return WebGUI::Asset->new($id, $class, $version);
|
return WebGUI::Asset->new($id, $class);
|
||||||
} else {
|
} else {
|
||||||
WebGUI::ErrorHandler::warn("The URL $url was requested, but does not exist in your asset tree.");
|
WebGUI::ErrorHandler::warn("The URL $url was requested, but does not exist in your asset tree.");
|
||||||
return undef;
|
return undef;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue