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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

SQL column error but not ParentID


Go to End
Reply


621 Views

Avatar
ICM

Community Member, 3 Posts

2 August 2011 at 12:20am

Edited: 02/08/2011 12:22am

Hi!

I have tried this on a fresh 2.4.5 and on a fresh 2.4.0 setup but the same error occur.
Im using the latest versions from git of
dataobject_manager
image_gallery
uploadify

And everything goes accoording to plan until i try to add images.
On a local machine i get the first album to be correct, but when trying to add or modify more albums i get the error below.
On a live site the error occurs directly.

After searching the fourms i see alot of information about the missing column error, but i can't seem to apply those fixes on my project since i intend to use the image gallery module straight out of the box, so i have not modified any code.

the files are uploaded and file permissions are set ok.

my untrained eye says that the error-message:

FROM "File"
WHERE ("File"."ID" IN (17))
ORDER BY "SortOrder" ASC 

is wrong and is missing something in (xxxx IS 17) or something like that, but I have no idea on how to correct it.

At this point my Files table is looks like this:

ID ClassName Created LastEdited Name Title Filename Content Sort SortOrder ParentID OwnerID
1 Folder 2011-08-01 13:54:55 2011-08-01 13:54:55 image-gallery Image Gallery assets/image-gallery/ NULL 0 0 0 0
2 Folder 2011-08-01 13:54:55 2011-08-01 13:55:08 Album Album assets/image-gallery/Album/ NULL 0 2 1 0
16 ImageGalleryImage 2011-08-01 14:03:41 2011-08-01 14:03:41 06.jpg 06 assets/image-gallery/Album/testalbum/06.jpg NULL 0 5 11 0
4 Folder 2011-08-01 13:55:32 2011-08-01 13:55:32 Uploads Uploads assets/Uploads/ NULL 0 3 0 0
11 Folder 2011-08-01 14:03:01 2011-08-01 14:03:01 testalbum testalbum assets/image-gallery/Album/testalbum/ NULL 0 4 2 0
12 ImageGalleryImage 2011-08-01 14:03:33 2011-08-01 14:03:33 01.jpg 01 assets/image-gallery/Album/testalbum/01.jpg NULL 0 0 11 0
13 ImageGalleryImage 2011-08-01 14:03:34 2011-08-01 14:03:34 03.jpg 03 assets/image-gallery/Album/testalbum/03.jpg NULL 0 2 11 0
14 ImageGalleryImage 2011-08-01 14:03:37 2011-08-01 14:03:37 04.jpg 04 assets/image-gallery/Album/testalbum/04.jpg NULL 0 3 11 0
15 ImageGalleryImage 2011-08-01 14:03:39 2011-08-01 14:03:39 05.jpg 05 assets/image-gallery/Album/testalbum/05.jpg NULL 0 4 11 0
17 ImageGalleryImage 2011-08-01 14:04:47 2011-08-01 14:04:47 2.jpg 2 assets/image-gallery/Album/testalbum/2.jpg NULL 0 6 11 0

so ID 17 exist but no column named 17 so i can see how it gets messed up.

The full error is:

ERROR [User Error]: Couldn't run query: 
SELECT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."Sort", "File"."SortOrder", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName"
FROM "File"
WHERE ("File"."ID" IN (17))
ORDER BY "SortOrder" ASC 

Unknown column '17' in 'where clause'
IN GET /admin/EditForm/field/GalleryItems/UploadifyForm/field/UploadedFiles/refresh?ctf[GalleryItems][start]=0&ctf[GalleryItems][per_page]=10&ctf[GalleryItems][showall]=0&ctf[GalleryItems][sort]=SortOrder&ctf[GalleryItems][sort_dir]=&ctf[GalleryItems][search]=&ctf[GalleryItems][filter]=AlbumID_3&ctf[GalleryItems][view]=grid&ctf[GalleryItems][imagesize]=100&FileIDs=%EF%BB%BF17
Line 536 in /www/webvol11/w5/l6lgn8fcossyycu/bergstensbilder.se/public_html/sapphire/core/model/MySQLDatabase.php

Source
======
  527: 	}
  528: 	
  529: 	function databaseError($msg, $errorLevel = E_USER_ERROR) {
  530: 		// try to extract and format query
  531: 		if(preg_match('/Couldn\'t run query: ([^\|]*)\|\s*(.*)/', $msg, $matches)) {
  532: 			$formatter = new SQLFormatter();
  533: 			$msg = "Couldn't run query: \n" . $formatter->formatPlain($matches[1]) . "\n\n" . $matches[2];
  534: 		}
  535: 		
* 536: 		user_error($msg, $errorLevel);
  537: 	}
  538: 	
  539: 	/**
  540: 	 * Return a boolean type-formatted string
  541: 	 * 
  542: 	 * @param array $values Contains a tokenised list of info about this data type

Trace
=====
<ul>user_error(Couldn't run query: 
SELECT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."Sort", "File"."SortOrder", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName"
FROM "File"
WHERE ("File"."ID" IN (17))
ORDER BY "SortOrder" ASC 

Unknown column '17' in 'where clause',256)
line 536 of MySQLDatabase.php

MySQLDatabase->databaseError(Couldn't run query: SELECT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."Sort", "File"."SortOrder", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("File"."ID" IN (17)) ORDER BY "SortOrder" ASC | Unknown column '17' in 'where clause',256)
line 134 of MySQLDatabase.php

MySQLDatabase->query(SELECT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."Sort", "File"."SortOrder", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("File"."ID" IN (17)) ORDER BY "SortOrder" ASC,256)
line 126 of DB.php

DB::query(SELECT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."Sort", "File"."SortOrder", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("File"."ID" IN (17)) ORDER BY "SortOrder" ASC,256)
line 386 of SQLQuery.php

SQLQuery->execute()
line 599 of File.php

File->instance_get("File"."ID" IN (17),,,,DataObjectSet)
line 2657 of DataObject.php

DataObject::get(File,"File"."ID" IN (17))
line 161 of MultipleFileUploadField.php

MultipleFileUploadField->Files()
line 369 of ViewableData.php

ViewableData->obj(Files,,,1,)
line 411 of ViewableData.php

ViewableData->cachedCall(Files,)
line 424 of ViewableData.php

ViewableData->hasValue(Files)
line 11 of .cache.www.webvol11.w5.l6lgn8fcossyycu.bergstensbilder.se.public_html.uploadify.templates.Includes.AttachedFiles.ss

include(/tmp/silverstripe-cache-www-webvol11-w5-l6lgn8fcossyycu-bergstensbilder.se-public_html/.cache.www.webvol11.w5.l6lgn8fcossyycu.bergstensbilder.se.public_html.uploadify.templates.Includes.AttachedFiles.ss)
line 392 of SSViewer.php

SSViewer->process(MultipleImageUploadField)
line 342 of ViewableData.php

ViewableData->renderWith(AttachedFiles)
line 107 of MultipleFileUploadField.php

MultipleFileUploadField->refresh(SS_HTTPRequest)
line 134 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 152 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 152 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 152 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 152 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 147 of Controller.php

Controller->handleRequest(SS_HTTPRequest)
line 283 of Director.php

Director::handleRequest(SS_HTTPRequest,Session)
line 127 of Director.php

Director::direct(/admin/EditForm/field/GalleryItems/UploadifyForm/field/UploadedFiles/refresh)
line 127 of main.php

</ul>

Thanks for all help!