1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
[User Error] Couldn't run query: SELECT "SiteTree_Live".*, "GhostPage_Live".*, "ErrorPage_Live".*, "RedirectorPage_Live".*, "VirtualPage_Live".*, "SiteTree_Live"."ID", CASE WHEN "SiteTree_Live"."ClassName" IS NOT NULL THEN "SiteTree_Live"."ClassName" ELSE 'SiteTree' END AS "RecordClassName" FROM "SiteTree_Live" LEFT JOIN "GhostPage_Live" ON "GhostPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "ErrorPage_Live" ON "ErrorPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "RedirectorPage_Live" ON "RedirectorPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "VirtualPage_Live" ON "VirtualPage_Live"."ID" = "SiteTree_Live"."ID" WHERE (SiteTree."URLSegment" = 'home') ORDER BY "Sort" LIMIT 1 Unknown column 'SiteTree.URLSegment' in 'where clause'
GET /silverstripetest2/?flush=1

Line 396 in /Applications/xampp/xamppfiles/htdocs/silverstripetest2/sapphire/core/model/MySQLDatabase.php
Source

387 	}
388 	
389 	function databaseError($msg, $errorLevel = E_USER_ERROR) {
390 		// try to extract and format query
391 		if(preg_match('/Couldn\'t run query: ([^\|]*)\|\s*(.*)/', $msg, $matches)) {
392 			$formatter = new SQLFormatter();
393 			$msg = "Couldn't run query: \n" . $formatter->formatPlain($matches[1]) . "\n\n" . $matches[2];
394 		}
395 		
396 		user_error($msg, $errorLevel);
397 	}
398 	
399 	/**
400 	 * Return a boolean type-formatted string
401 	 * 
402 	 * @params array $values Contains a tokenised list of info about this data type

Trace

    * Couldn't run query: SELECT "SiteTree_Live".*, "GhostPage_Live".*, "ErrorPage_Live".*, "RedirectorPage_Live".*, "VirtualPage_Live".*, "SiteTree_Live"."ID", CASE WHEN "SiteTree_Live"."ClassName" IS NOT NULL THEN "SiteTree_Live"."ClassName" ELSE 'SiteTree' END AS "RecordClassName" FROM "SiteTree_Live" LEFT JOIN "GhostPage_Live" ON "GhostPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "ErrorPage_Live" ON "ErrorPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "RedirectorPage_Live" ON "RedirectorPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "VirtualPage_Live" ON "VirtualPage_Live"."ID" = "SiteTree_Live"."ID" WHERE (SiteTree."URLSegment" = 'home') ORDER BY "Sort" LIMIT 1 Unknown column 'SiteTree.URLSegment' in 'where clause'
      Line 396 of MySQLDatabase.php
    * MySQLDatabase->databaseError(Couldn't run query: SELECT "SiteTree_Live".*, "GhostPage_Live".*, "ErrorPage_Live".*, "RedirectorPage_Live".*, "VirtualPage_Live".*, "SiteTree_Live"."ID", CASE WHEN "SiteTree_Live"."ClassName" IS NOT NULL THEN "SiteTree_Live"."ClassName" ELSE 'SiteTree' END AS "RecordClassName" FROM "SiteTree_Live" LEFT JOIN "GhostPage_Live" ON "GhostPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "ErrorPage_Live" ON "ErrorPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "RedirectorPage_Live" ON "RedirectorPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "VirtualPage_Live" ON "VirtualPage_Live"."ID" = "SiteTree_Live"."ID" WHERE (SiteTree."URLSegment" = 'home') ORDER BY "Sort" LIMIT 1 | Unknown column 'SiteTree.URLSegment' in 'where clause',256)
      Line 104 of MySQLDatabase.php
    * MySQLDatabase->query(SELECT "SiteTree_Live".*, "GhostPage_Live".*, "ErrorPage_Live".*, "RedirectorPage_Live".*, "VirtualPage_Live".*, "SiteTree_Live"."ID", CASE WHEN "SiteTree_Live"."ClassName" IS NOT NULL THEN "SiteTree_Live"."ClassName" ELSE 'SiteTree' END AS "RecordClassName" FROM "SiteTree_Live" LEFT JOIN "GhostPage_Live" ON "GhostPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "ErrorPage_Live" ON "ErrorPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "RedirectorPage_Live" ON "RedirectorPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "VirtualPage_Live" ON "VirtualPage_Live"."ID" = "SiteTree_Live"."ID" WHERE (SiteTree."URLSegment" = 'home') ORDER BY "Sort" LIMIT 1,256)
      Line 97 of DB.php
    * DB::query(SELECT "SiteTree_Live".*, "GhostPage_Live".*, "ErrorPage_Live".*, "RedirectorPage_Live".*, "VirtualPage_Live".*, "SiteTree_Live"."ID", CASE WHEN "SiteTree_Live"."ClassName" IS NOT NULL THEN "SiteTree_Live"."ClassName" ELSE 'SiteTree' END AS "RecordClassName" FROM "SiteTree_Live" LEFT JOIN "GhostPage_Live" ON "GhostPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "ErrorPage_Live" ON "ErrorPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "RedirectorPage_Live" ON "RedirectorPage_Live"."ID" = "SiteTree_Live"."ID" LEFT JOIN "VirtualPage_Live" ON "VirtualPage_Live"."ID" = "SiteTree_Live"."ID" WHERE (SiteTree."URLSegment" = 'home') ORDER BY "Sort" LIMIT 1)
      Line 396 of SQLQuery.php
    * SQLQuery->execute()
      Line 2366 of DataObject.php
    * DataObject->instance_get_one(SiteTree."URLSegment" = 'home',)
      Line 2305 of DataObject.php
    * DataObject::get_one(SiteTree,SiteTree."URLSegment" = 'home',)
      Line 39 of ModelAsController.php
    * ModelAsController->getNestedController()
      Line 16 of ModelAsController.php
    * ModelAsController->handleRequest(HTTPRequest)
      Line 27 of RootURLController.php
    * RootURLController->handleRequest(HTTPRequest)
      Line 258 of Director.php
    * Director::handleRequest(HTTPRequest,Session)
      Line 106 of Director.php
    * Director::direct(/)
      Line 111 of main.php