Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Error browsing files in BE on WinServer platform


Go to End


5 Posts   1659 Views

Avatar
bb-drummer

Community Member, 14 Posts

4 December 2012 at 11:46pm

Hello!

Trying to browse the files section in SilverStripes Backend (win-setup), i get an error when
moving 'to the next page' (or the last one). A window pops up, saying:
"An error occured while fetching data from the server. Please try again later."
(well... i tried 'later' but the result was the same ^^ )

when i take look at the request done (chrome's inspector) the following message
is returned by that ajax-request (next/last page):

ERROR [User Error]: Couldn't run query (42S22, 207, [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name '_SortColumn0'.): SELECT * FROM (SELECT DISTINCT ROW_NUMBER() OVER ( ORDER BY "_SortColumn0" ASC, "File"."Name" ASC) AS Number, (CASE WHEN "File"."ClassName" = 'Folder' THEN 0 ELSE 1 END) AS "_SortColumn0", "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."ShowInSearch", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE N'File' END AS "RecordClassName" FROM "File" WHERE ("ParentID" = '143')) AS Numbered WHERE Number BETWEEN 16 AND 30 ORDER BY Number: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name '_SortColumn0'. IN POST /of-infonet/admin/assets/EditForm/field/File Line 670 in C:\inetpub\wwwroot\of-infonet\framework\model\Database.php

this SS-install is utilizing v3.02 (WebInstaller) on a basic WinServer2008R2 setup...

Any help is much appreciated!

YT
BB

Avatar
bb-drummer

Community Member, 14 Posts

20 December 2012 at 2:39am

Edited: 20/12/2012 2:41am

Hi!

I currently noticed that when sorting the files grid by one column first (click on that header), browsing the files works just fine... :-S

Has anyone else experienced something like this?
Or can someone tell, maybe what is wrong with that query? (exuting the query in SQL-mgmt-studio also throws that error)

All those files also don't show up when I try to select one editing a page...

YT
BB

Avatar
Sean

Forum Moderator, 922 Posts

20 December 2012 at 11:21am

Hi bb-drummer,

It appears to be a bug where SQL Server doesn't like SortColumn0 in the query.

I can replicate the same thing on my machine using SQL Server as the database and trying to page through files.
MySQL seems to be unaffected.

I've raised it as a bug marked "critical", I'll try to look into it as soon as possible.

Thanks,
Sean

Avatar
Sean

Forum Moderator, 922 Posts

20 December 2012 at 3:51pm

Edited: 20/12/2012 6:05pm

I've attached a fix for this. If you apply it to your copy of MSSQLDatabase.php does it work for you?

Fix was committed to the mssql module on Github here: https://github.com/silverstripe/silverstripe-mssql/commit/7c369a383a8e6a6828a74209d70cc88678d7f411

The fix will appear in the next release to the Web Platform Installer, but until then you can patch your copy of MSSQLDatabase.php.

Thanks,
Sean

Attached Files
Avatar
bb-drummer

Community Member, 14 Posts

22 December 2012 at 12:34am

Hi Sean!

that's awesome! that fix works for my setup :) great work!

for the uploaded pics not showing up in the 'file selection' dialog (when editing a page) i found out this:

initially, when developing that site on a linux box, we used 'Image' as the (db-)field type and 'ImageField' as the object in the page's 'getCMSFields'... when porting that to the windows box, messages popped up claiming the deprecated use of 'ImageField' :-S
after digging in the docs i changed the code so i have a 'MultipleImages' (db-)field and the corresponding 'UploadField('MultipleImages'...)' in 'getCMSFields'...
now, when i upload a new pic in that file management view, the picture is always stored with the 'classname' set to 'Image' and doesn't show up in that selection dialog, when uploaded via the page's upload button, the classname is set to 'MultipleImages' and, fo course, show up there... when I set that image classname (in db tab, manually) to 'MultipleImages' it also shows up in the selection dialog...

so my question is: what is the a way to handle that (changing the classname in db is definitely no option, of course ;) )

thanks a lot for your help...

wish you a merry x-mas and a happy new year!

YT
BB