diff --git a/lib/stores/modules/mysql_workspaces_compiler.php b/lib/stores/modules/mysql_workspaces_compiler.php index 704912a0f..a79c4da81 100644 --- a/lib/stores/modules/mysql_workspaces_compiler.php +++ b/lib/stores/modules/mysql_workspaces_compiler.php @@ -101,8 +101,9 @@ protected function priv_sql_compile($tree) { } $select_query = "select distinct($nodes.path), $nodes.id as nodeId, $nodes.layer as nodeLayer, $nodes.parent, $nodes.priority, "; - $select_query .= " $objects.object, $objects.id, $objects.type, $objects.vtype "; - $select_query .= " from $tables $join $query "; + $select_query .= "$objects.object, $objects.id, $objects.type, $objects.vtype, "; + $select_query .= "UNIX_TIMESTAMP($objects.lastchanged) as lastchanged "; + $select_query .= "from ($tables) $join $query "; $select_query .= $orderby." ".$this->limit_s; $count_query = "select count(distinct($objects.id)) as count from $tables ".$query; diff --git a/tests/unit/store/MysqlStoreTest.php b/tests/unit/store/MysqlStoreTest.php index f6b8b03cf..67d1d1bee 100644 --- a/tests/unit/store/MysqlStoreTest.php +++ b/tests/unit/store/MysqlStoreTest.php @@ -11,7 +11,7 @@ public static function setUpBeforeClass() protected function setUp() { global $store_config; - if( $store_config["dbms"] !== 'mysql' ) { + if( strpos($store_config["dbms"],'mysql') !== 0 ){ $this->marktestskipped( 'Skipping mysql tests, current config uses: '.$store_config["dbms"] ); @@ -25,5 +25,18 @@ public function test_format_for_fti(){ $res = $store->format_for_fti('abcü_-'); $this->assertEquals($prep,$res); } + + public function test(){ + global $store; + $res = $store->find('/','object.id = 1'); + $row = $res['list']->fetch_array(MYSQLI_ASSOC); + $this->assertArrayHasKey('id', $row); + $this->assertArrayHasKey('path', $row); + $this->assertArrayHasKey('parent', $row); + $this->assertArrayHasKey('lastchanged', $row); + $this->assertArrayHasKey('priority', $row); + $this->assertArrayHasKey('type', $row); + $this->assertArrayHasKey('vtype', $row); + } } ?>